simplex-solver 3.2.2__cp39-abi3-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simplex_solver-3.2.2.dist-info/DELVEWHEEL +2 -0
- simplex_solver-3.2.2.dist-info/METADATA +94 -0
- simplex_solver-3.2.2.dist-info/RECORD +84 -0
- simplex_solver-3.2.2.dist-info/WHEEL +5 -0
- simplex_solver.libs/.load-order-simplex_solver-3.2.2 +1 -0
- simplex_solver.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- simplexui/__init__.py +86 -0
- simplexui/_version.py +1 -0
- simplexui/channelBox.py +867 -0
- simplexui/comboCheckDialog.py +396 -0
- simplexui/commands/__init__.py +16 -0
- simplexui/commands/alembicCommon.py +1148 -0
- simplexui/commands/alembic_walker.py +299 -0
- simplexui/commands/applyCorrectives.py +452 -0
- simplexui/commands/correctiveInterface.py +259 -0
- simplexui/commands/expandedExport.py +434 -0
- simplexui/commands/hdf5Convert.py +62 -0
- simplexui/commands/mayaCorrectiveInterface.py +159 -0
- simplexui/commands/mayatonumpy.py +416 -0
- simplexui/commands/mesh.py +1085 -0
- simplexui/commands/poseblendlib.py +168 -0
- simplexui/commands/reorderSimplexPoints.py +102 -0
- simplexui/commands/replaceDefinitionJson.py +74 -0
- simplexui/commands/rigidAlign.py +97 -0
- simplexui/commands/unsubdivide.py +1222 -0
- simplexui/commands/uvTransfer.py +976 -0
- simplexui/dragFilter.py +334 -0
- simplexui/falloffDialog.py +504 -0
- simplexui/img/ChefHead.png +0 -0
- simplexui/img/frozen.png +0 -0
- simplexui/interface/__init__.py +30 -0
- simplexui/interface/dummyInterface.py +1313 -0
- simplexui/interface/mayaInterface.py +2294 -0
- simplexui/interfaceModel.py +655 -0
- simplexui/interfaceModelTrees.py +456 -0
- simplexui/items/__init__.py +50 -0
- simplexui/items/accessor.py +145 -0
- simplexui/items/combo.py +645 -0
- simplexui/items/dragItem.py +44 -0
- simplexui/items/falloff.py +748 -0
- simplexui/items/group.py +267 -0
- simplexui/items/progression.py +613 -0
- simplexui/items/shape.py +384 -0
- simplexui/items/simplex.py +1734 -0
- simplexui/items/slider.py +632 -0
- simplexui/items/stack.py +147 -0
- simplexui/items/traversal.py +780 -0
- simplexui/items/treeItem.py +441 -0
- simplexui/main.pyw +22 -0
- simplexui/menu/__init__.py +73 -0
- simplexui/menu/dummyPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/__init__.py +16 -0
- simplexui/menu/genericPlugins/_builtins.py +270 -0
- simplexui/menu/genericPlugins/checkPossibleCombos.py +48 -0
- simplexui/menu/genericPlugins/exportSplit.py +67 -0
- simplexui/menu/genericPlugins/showFalloffs.py +26 -0
- simplexui/menu/genericPlugins/showTraversals.py +26 -0
- simplexui/menu/genericPlugins/simplexUvTransfer.py +106 -0
- simplexui/menu/genericPlugins/unsubdivide.py +72 -0
- simplexui/menu/mayaPlugins/__init__.py +16 -0
- simplexui/menu/mayaPlugins/exportOther.py +53 -0
- simplexui/menu/mayaPlugins/extractProgressives.py +68 -0
- simplexui/menu/mayaPlugins/freezeCombo.py +247 -0
- simplexui/menu/mayaPlugins/generateShapeIncrementals.py +99 -0
- simplexui/menu/mayaPlugins/importObjs.py +199 -0
- simplexui/menu/mayaPlugins/linearizeTraversal.py +60 -0
- simplexui/menu/mayaPlugins/makeShelfBtn.py +67 -0
- simplexui/menu/mayaPlugins/relaxToSelection.py +76 -0
- simplexui/menu/mayaPlugins/reloadDefinition.py +44 -0
- simplexui/menu/mayaPlugins/snapToNeutral.py +71 -0
- simplexui/menu/mayaPlugins/softSelectToCluster.py +201 -0
- simplexui/menu/mayaPlugins/tweakMix.py +136 -0
- simplexui/menu/mayaPlugins/updateRestShape.py +113 -0
- simplexui/pysimplex.lib +0 -0
- simplexui/pysimplex.pyd +0 -0
- simplexui/simplexDialog.py +1547 -0
- simplexui/travCheckDialog.py +419 -0
- simplexui/traversalDialog.py +299 -0
- simplexui/ui/comboCheckDialog.ui +475 -0
- simplexui/ui/falloffDialog.ui +243 -0
- simplexui/ui/simplexDialog.ui +1458 -0
- simplexui/ui/travCheckDialog.ui +488 -0
- simplexui/ui/traversalDialog.ui +532 -0
- simplexui/utils.py +307 -0
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
# Copyright 2016, Blur Studio
|
|
2
|
+
#
|
|
3
|
+
# This file is part of Simplex.
|
|
4
|
+
#
|
|
5
|
+
# Simplex is free software: you can redistribute it and/or modify
|
|
6
|
+
# it under the terms of the GNU Lesser General Public License as published by
|
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
|
8
|
+
# (at your option) any later version.
|
|
9
|
+
#
|
|
10
|
+
# Simplex is distributed in the hope that it will be useful,
|
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13
|
+
# GNU Lesser General Public License for more details.
|
|
14
|
+
#
|
|
15
|
+
# You should have received a copy of the GNU Lesser General Public License
|
|
16
|
+
# along with Simplex. If not, see <http://www.gnu.org/licenses/>.
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from itertools import combinations, product
|
|
21
|
+
|
|
22
|
+
from Qt import QtCompat
|
|
23
|
+
from Qt.QtCore import Qt
|
|
24
|
+
from Qt.QtGui import QBrush, QColor
|
|
25
|
+
from Qt.QtWidgets import (
|
|
26
|
+
QCheckBox,
|
|
27
|
+
QDialog,
|
|
28
|
+
QGroupBox,
|
|
29
|
+
QLabel,
|
|
30
|
+
QPushButton,
|
|
31
|
+
QSpinBox,
|
|
32
|
+
QTreeWidget,
|
|
33
|
+
QTreeWidgetItem,
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
from .dragFilter import DragFilter
|
|
37
|
+
from .items import Slider, Traversal
|
|
38
|
+
from .utils import getUiFile
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class TooManyPossibilitiesError(Exception):
|
|
42
|
+
"""Error raised when there are too many possibilities
|
|
43
|
+
Basically used as a stop-iteration
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
pass
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def buildPossibleTraversals(
|
|
50
|
+
simplex, sliders, minDepth: int, maxDepth: int, lockDict=None, maxPoss=100
|
|
51
|
+
):
|
|
52
|
+
"""Build a list of possible traversals
|
|
53
|
+
|
|
54
|
+
Parameters
|
|
55
|
+
----------
|
|
56
|
+
simplex : Simplex
|
|
57
|
+
The simplex system to check
|
|
58
|
+
sliders : Slider
|
|
59
|
+
The sliders to check
|
|
60
|
+
minDepth : int
|
|
61
|
+
The minimum number of sliders that will go into any traversals
|
|
62
|
+
maxDepth : int
|
|
63
|
+
The maximum number of sliders that will go into any traversals
|
|
64
|
+
lockDict : {Slider: ((float, ...), bool), ...}
|
|
65
|
+
An optional per-slider dict of possible values
|
|
66
|
+
maxPoss : float
|
|
67
|
+
The Maximum number of possibilities to return.(Default value = 100)
|
|
68
|
+
|
|
69
|
+
Returns
|
|
70
|
+
-------
|
|
71
|
+
: bool
|
|
72
|
+
True if the maximum number of possibilities was exceeded
|
|
73
|
+
: [([(Slider, (float, float)), ...], Traversal), ...]
|
|
74
|
+
Grouped slider/range pairs to existing (or None) Traversals
|
|
75
|
+
"""
|
|
76
|
+
allRanges = {}
|
|
77
|
+
allDyn = {}
|
|
78
|
+
sliderDict = {}
|
|
79
|
+
lockDict = lockDict or {}
|
|
80
|
+
|
|
81
|
+
# Get the range values for each slider
|
|
82
|
+
for slider in sliders:
|
|
83
|
+
rng, dyn = lockDict.get(slider, (slider.prog.getRange(), True))
|
|
84
|
+
rng = set(rng)
|
|
85
|
+
rng.discard(0) # ignore the zeros
|
|
86
|
+
allRanges[slider] = sorted(rng)
|
|
87
|
+
allDyn[slider] = dyn
|
|
88
|
+
sliderDict[slider.name] = slider
|
|
89
|
+
|
|
90
|
+
poss = []
|
|
91
|
+
tooMany = False
|
|
92
|
+
try:
|
|
93
|
+
for size in range(minDepth, maxDepth + 1):
|
|
94
|
+
for grp in combinations(sliders, size):
|
|
95
|
+
names = [i.name for i in grp]
|
|
96
|
+
ranges = [allRanges[s] for s in grp]
|
|
97
|
+
for vals in product(*ranges):
|
|
98
|
+
for dynIdx in range(len(grp)):
|
|
99
|
+
if not allDyn[grp[dynIdx]]:
|
|
100
|
+
continue
|
|
101
|
+
trng = list(zip(vals, vals))
|
|
102
|
+
trng[dynIdx] = (0, trng[dynIdx][0])
|
|
103
|
+
|
|
104
|
+
count = Traversal.getCount(grp, trng)
|
|
105
|
+
if count == 0:
|
|
106
|
+
continue
|
|
107
|
+
|
|
108
|
+
poss.append(frozenset(list(zip(names, trng))))
|
|
109
|
+
if len(poss) > maxPoss:
|
|
110
|
+
raise TooManyPossibilitiesError("Don't melt your computer")
|
|
111
|
+
except TooManyPossibilitiesError:
|
|
112
|
+
tooMany = True
|
|
113
|
+
|
|
114
|
+
# Build a dict of traversals that already exist
|
|
115
|
+
# but only if their sliders are in the list of sliders to check
|
|
116
|
+
onlys = {}
|
|
117
|
+
for trav in simplex.traversals:
|
|
118
|
+
sls = trav.allSliders()
|
|
119
|
+
if all(r in sliders for r in sls):
|
|
120
|
+
rngs = trav.ranges()
|
|
121
|
+
key = frozenset([(k.name, v) for k, v in rngs.items()])
|
|
122
|
+
onlys[key] = trav
|
|
123
|
+
|
|
124
|
+
toAdd = []
|
|
125
|
+
for p in poss:
|
|
126
|
+
truePairs = [(sliderDict[n], r) for n, r in p]
|
|
127
|
+
toAdd.append((truePairs, onlys.get(p)))
|
|
128
|
+
return tooMany, toAdd
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class TravCheckItem(QTreeWidgetItem):
|
|
132
|
+
def __init__(self, pairs, trav, *args, **kwargs) -> None:
|
|
133
|
+
super().__init__(*args, **kwargs)
|
|
134
|
+
self.pairs = pairs
|
|
135
|
+
self.trav = trav
|
|
136
|
+
|
|
137
|
+
exists = False
|
|
138
|
+
grayBrush = QBrush(QColor(128, 128, 128))
|
|
139
|
+
if self.trav is None:
|
|
140
|
+
ranges = dict(self.pairs)
|
|
141
|
+
newName = Traversal.buildTraversalName(ranges)
|
|
142
|
+
self.setText(0, newName)
|
|
143
|
+
else:
|
|
144
|
+
exists = True
|
|
145
|
+
self.setText(0, self.trav.name)
|
|
146
|
+
self.setForeground(0, grayBrush)
|
|
147
|
+
self.setForeground(1, grayBrush)
|
|
148
|
+
self.setForeground(2, grayBrush)
|
|
149
|
+
|
|
150
|
+
# create the slider sub-rows
|
|
151
|
+
for slider, rng in pairs:
|
|
152
|
+
item = QTreeWidgetItem(self)
|
|
153
|
+
|
|
154
|
+
item.setData(0, Qt.ItemDataRole.EditRole, slider.name)
|
|
155
|
+
item.setData(1, Qt.ItemDataRole.EditRole, rng[0])
|
|
156
|
+
item.setData(2, Qt.ItemDataRole.EditRole, rng[1])
|
|
157
|
+
if exists:
|
|
158
|
+
item.setForeground(0, grayBrush)
|
|
159
|
+
item.setForeground(1, grayBrush)
|
|
160
|
+
item.setForeground(2, grayBrush)
|
|
161
|
+
|
|
162
|
+
self.setExpanded(True)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
class TraversalCheckDialog(QDialog):
|
|
166
|
+
"""Dialog for checking what possible traversals exist, and picking new traversals
|
|
167
|
+
In 'Create' mode, it provides a quick way of choosing the one specific traversal
|
|
168
|
+
that the user is looking for
|
|
169
|
+
|
|
170
|
+
In 'Check' mode, it provides a convenient way to explore the possibilites
|
|
171
|
+
and create any missing traversals directly
|
|
172
|
+
|
|
173
|
+
Parameters
|
|
174
|
+
----------
|
|
175
|
+
sliders : [Slider, ...]
|
|
176
|
+
A list of sliders to check
|
|
177
|
+
values : {Slider: (float, ...), ...}
|
|
178
|
+
A dictionary of values to use per slider
|
|
179
|
+
mode : str
|
|
180
|
+
The mode to display the dialog. Defaults to 'create'
|
|
181
|
+
parent : QObject
|
|
182
|
+
The Parent of the dialog. Must be a SimplexDialog
|
|
183
|
+
|
|
184
|
+
Returns
|
|
185
|
+
-------
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
uiLimitGRP: QGroupBox
|
|
189
|
+
uiMinLimitSPIN: QSpinBox
|
|
190
|
+
uiMaxLimitSPIN: QSpinBox
|
|
191
|
+
uiAutoUpdateCHK: QCheckBox
|
|
192
|
+
uiManualUpdateBTN: QPushButton
|
|
193
|
+
uiEditTREE: QTreeWidget
|
|
194
|
+
uiTravCheckTREE: QTreeWidget
|
|
195
|
+
uiWarningLBL: QLabel
|
|
196
|
+
uiCancelBTN: QPushButton
|
|
197
|
+
uiCreateSelectedBTN: QPushButton
|
|
198
|
+
|
|
199
|
+
def __init__(
|
|
200
|
+
self,
|
|
201
|
+
sliders,
|
|
202
|
+
values=None,
|
|
203
|
+
dynamics=None,
|
|
204
|
+
mode: str = "create",
|
|
205
|
+
parent=None,
|
|
206
|
+
grandparent=None,
|
|
207
|
+
) -> None:
|
|
208
|
+
# Store the Parent UI rather than relying on Qt's .parent()
|
|
209
|
+
# Could cause crashes otherwise
|
|
210
|
+
if parent is None or grandparent is None:
|
|
211
|
+
raise ValueError("The parent and grandparent must be provided")
|
|
212
|
+
|
|
213
|
+
super().__init__(parent)
|
|
214
|
+
|
|
215
|
+
uiPath = getUiFile(__file__)
|
|
216
|
+
QtCompat.loadUi(uiPath, self)
|
|
217
|
+
self.mode = mode.lower()
|
|
218
|
+
|
|
219
|
+
self.parUI = parent
|
|
220
|
+
self.gparUI = grandparent
|
|
221
|
+
self.maxPoss = 100
|
|
222
|
+
self.colCheckRoles = [
|
|
223
|
+
Qt.ItemDataRole.UserRole,
|
|
224
|
+
Qt.ItemDataRole.UserRole,
|
|
225
|
+
Qt.ItemDataRole.UserRole,
|
|
226
|
+
Qt.ItemDataRole.EditRole,
|
|
227
|
+
]
|
|
228
|
+
|
|
229
|
+
self.uiCreateSelectedBTN.clicked.connect(self.createMissing)
|
|
230
|
+
self.uiMinLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
|
|
231
|
+
self.uiMaxLimitSPIN.valueChanged.connect(self.populateWithoutUpdate)
|
|
232
|
+
self.uiCancelBTN.clicked.connect(self.close)
|
|
233
|
+
self.uiManualUpdateBTN.clicked.connect(self.populateWithUpdate)
|
|
234
|
+
self.uiEditTREE.itemChanged.connect(self.populateWithoutUpdate)
|
|
235
|
+
|
|
236
|
+
self.dragFilter = DragFilter(self)
|
|
237
|
+
self.uiEditTREE.viewport().installEventFilter(self.dragFilter)
|
|
238
|
+
self.dragFilter.dragTick.connect(self.dragTick)
|
|
239
|
+
|
|
240
|
+
self.gparUI.uiSliderTREE.selectionModel().selectionChanged.connect(
|
|
241
|
+
self.populateWithCheck
|
|
242
|
+
)
|
|
243
|
+
|
|
244
|
+
self.valueDict = values or {}
|
|
245
|
+
self.dynDict = dynamics or {}
|
|
246
|
+
self.setSliders(sliders)
|
|
247
|
+
if self.mode == "create":
|
|
248
|
+
self.uiAutoUpdateCHK.setCheckState(Qt.CheckState.Unchecked)
|
|
249
|
+
self.uiAutoUpdateCHK.hide()
|
|
250
|
+
self.uiManualUpdateBTN.hide()
|
|
251
|
+
|
|
252
|
+
self.uiMaxLimitSPIN.setValue(max(len(sliders), 2))
|
|
253
|
+
self.uiMinLimitSPIN.setValue(max(len(sliders) - 2, 2))
|
|
254
|
+
|
|
255
|
+
if sliders is None:
|
|
256
|
+
self.populateWithUpdate()
|
|
257
|
+
else:
|
|
258
|
+
self._populate()
|
|
259
|
+
|
|
260
|
+
def dragTick(self, ticks, mul) -> None:
|
|
261
|
+
"""Deal with the ticks coming from the drag handler
|
|
262
|
+
|
|
263
|
+
Parameters
|
|
264
|
+
----------
|
|
265
|
+
ticks : int
|
|
266
|
+
The number of ticks since the last update
|
|
267
|
+
mul : float
|
|
268
|
+
The multiplier value from the drag handler
|
|
269
|
+
|
|
270
|
+
Returns
|
|
271
|
+
-------
|
|
272
|
+
|
|
273
|
+
"""
|
|
274
|
+
items = self.uiEditTREE.selectedItems()
|
|
275
|
+
for item in items:
|
|
276
|
+
val = item.data(3, Qt.ItemDataRole.EditRole)
|
|
277
|
+
val += (0.05) * ticks * mul
|
|
278
|
+
if abs(val) < 1.0e-5:
|
|
279
|
+
val = 0.0
|
|
280
|
+
val = max(min(val, 1.0), -1.0)
|
|
281
|
+
item.setData(3, Qt.ItemDataRole.EditRole, val)
|
|
282
|
+
self.uiEditTREE.viewport().update()
|
|
283
|
+
|
|
284
|
+
def setSliders(self, val) -> None:
|
|
285
|
+
"""Set the sliders displayed in this UI
|
|
286
|
+
|
|
287
|
+
Parameters
|
|
288
|
+
----------
|
|
289
|
+
val : [Slider, ...]
|
|
290
|
+
The sliders to be displayed
|
|
291
|
+
|
|
292
|
+
Returns
|
|
293
|
+
-------
|
|
294
|
+
|
|
295
|
+
"""
|
|
296
|
+
self.uiEditTREE.clear()
|
|
297
|
+
dvs = [None, -1.0, 1.0, 0.5]
|
|
298
|
+
val = val or []
|
|
299
|
+
for slider in val:
|
|
300
|
+
item = QTreeWidgetItem(self.uiEditTREE, [slider.name])
|
|
301
|
+
item.setFlags(item.flags() | Qt.ItemFlag.ItemIsEditable)
|
|
302
|
+
rangeVals = self.valueDict.get(slider, [-1.0, 1.0])
|
|
303
|
+
|
|
304
|
+
item.setData(0, Qt.ItemDataRole.UserRole, slider)
|
|
305
|
+
for col in range(1, 3):
|
|
306
|
+
val = dvs[col]
|
|
307
|
+
item.setData(col, self.colCheckRoles[col], val)
|
|
308
|
+
rng = slider.prog.getRange()
|
|
309
|
+
if val in rng:
|
|
310
|
+
chk = (
|
|
311
|
+
Qt.CheckState.Checked
|
|
312
|
+
if val in rangeVals
|
|
313
|
+
else Qt.CheckState.Unchecked
|
|
314
|
+
)
|
|
315
|
+
item.setCheckState(col, chk)
|
|
316
|
+
item.setCheckState(3, self.dynDict.get(slider, Qt.CheckState.Checked))
|
|
317
|
+
|
|
318
|
+
for col in reversed(list(range(4))):
|
|
319
|
+
self.uiEditTREE.resizeColumnToContents(col)
|
|
320
|
+
|
|
321
|
+
def closeEvent(self, event) -> None:
|
|
322
|
+
"""Override the Qt close event"""
|
|
323
|
+
self.gparUI.uiSliderTREE.selectionModel().selectionChanged.disconnect(
|
|
324
|
+
self.populateWithCheck
|
|
325
|
+
)
|
|
326
|
+
super().closeEvent(event)
|
|
327
|
+
|
|
328
|
+
def populateWithUpdate(self) -> None:
|
|
329
|
+
"""Populate the list from the main dialog selection"""
|
|
330
|
+
self.setSliders(self.gparUI.uiSliderTREE.getSelectedItems(typ=Slider))
|
|
331
|
+
self._populate()
|
|
332
|
+
|
|
333
|
+
def populateWithoutUpdate(self) -> None:
|
|
334
|
+
"""Populate the list and but don't look at the main dialog"""
|
|
335
|
+
self._populate()
|
|
336
|
+
|
|
337
|
+
def populateWithCheck(self) -> None:
|
|
338
|
+
"""Populate the list from the main dialog selection, only if the AutoUpdate checkbox is checked"""
|
|
339
|
+
if self.uiAutoUpdateCHK.isChecked():
|
|
340
|
+
self.setSliders(self.gparUI.uiSliderTREE.getSelectedItems(typ=Slider))
|
|
341
|
+
self._populate()
|
|
342
|
+
|
|
343
|
+
def _populate(self) -> None:
|
|
344
|
+
"""Populate the list widgets in the UI"""
|
|
345
|
+
minDepth = self.uiMinLimitSPIN.value()
|
|
346
|
+
maxDepth = self.uiMaxLimitSPIN.value()
|
|
347
|
+
|
|
348
|
+
root = self.uiEditTREE.invisibleRootItem()
|
|
349
|
+
lockDict = {}
|
|
350
|
+
sliderList = []
|
|
351
|
+
|
|
352
|
+
for row in range(root.childCount()):
|
|
353
|
+
item = root.child(row)
|
|
354
|
+
slider = item.data(0, Qt.ItemDataRole.UserRole)
|
|
355
|
+
if slider is not None:
|
|
356
|
+
sliderList.append(slider)
|
|
357
|
+
lv = [
|
|
358
|
+
item.data(col, self.colCheckRoles[col])
|
|
359
|
+
for col in range(1, 3)
|
|
360
|
+
if item.checkState(col) == Qt.CheckState.Checked
|
|
361
|
+
]
|
|
362
|
+
dyn = item.checkState(3) == Qt.CheckState.Checked
|
|
363
|
+
lockDict[slider] = (lv, dyn)
|
|
364
|
+
|
|
365
|
+
tooMany, toAdd = buildPossibleTraversals(
|
|
366
|
+
self.parUI.simplex,
|
|
367
|
+
sliderList,
|
|
368
|
+
minDepth,
|
|
369
|
+
maxDepth,
|
|
370
|
+
lockDict=lockDict,
|
|
371
|
+
maxPoss=self.maxPoss,
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
lbl = f"Too many possibilities. Limiting to {self.maxPoss}" if tooMany else ""
|
|
375
|
+
self.uiWarningLBL.setText(lbl)
|
|
376
|
+
|
|
377
|
+
self.uiTravCheckTREE.clear()
|
|
378
|
+
for pairs, trav in reversed(toAdd):
|
|
379
|
+
TravCheckItem(pairs, trav, self.uiTravCheckTREE)
|
|
380
|
+
|
|
381
|
+
for i in reversed(list(range(self.uiTravCheckTREE.columnCount()))):
|
|
382
|
+
self.uiTravCheckTREE.resizeColumnToContents(i)
|
|
383
|
+
|
|
384
|
+
if self.mode == "create":
|
|
385
|
+
if self.uiTravCheckTREE.topLevelItemCount() > 0:
|
|
386
|
+
self.uiTravCheckTREE.topLevelItem(0).setSelected(True)
|
|
387
|
+
|
|
388
|
+
def createMissing(self) -> None:
|
|
389
|
+
"""Create selected traversals if they don't already exist"""
|
|
390
|
+
simplex = self.parUI.simplex
|
|
391
|
+
created = []
|
|
392
|
+
|
|
393
|
+
tops = []
|
|
394
|
+
for item in self.uiTravCheckTREE.selectedItems():
|
|
395
|
+
par = item.parent()
|
|
396
|
+
if par is not None:
|
|
397
|
+
item = par
|
|
398
|
+
if item not in tops:
|
|
399
|
+
tops.append(item)
|
|
400
|
+
|
|
401
|
+
for item in tops:
|
|
402
|
+
name = item.text(0)
|
|
403
|
+
sliders, ranges = list(zip(*item.pairs))
|
|
404
|
+
# Double check that the user didn't create any extra sliders
|
|
405
|
+
if Traversal.traversalAlreadyExists(simplex, sliders, ranges) is None:
|
|
406
|
+
count = Traversal.getCount(sliders, ranges)
|
|
407
|
+
startPairs, endPairs = list(
|
|
408
|
+
zip(*[((s, a), (s, b)) for s, (a, b) in item.pairs])
|
|
409
|
+
)
|
|
410
|
+
t = Traversal.createTraversal(
|
|
411
|
+
name, simplex, startPairs, endPairs, count=count
|
|
412
|
+
)
|
|
413
|
+
created.append(t)
|
|
414
|
+
|
|
415
|
+
self.parUI.uiTraversalTREE.setItemSelection(created)
|
|
416
|
+
if self.mode == "create":
|
|
417
|
+
self.close()
|
|
418
|
+
else:
|
|
419
|
+
self.populateWithoutUpdate()
|