Browse Source

Force sorting of parameter scalepoints

tags/1.9.4
falkTX 12 years ago
parent
commit
75a8019073
1 changed files with 23 additions and 1 deletions
  1. +23
    -1
      source/widgets/paramspinbox.py

+ 23
- 1
source/widgets/paramspinbox.py View File

@@ -289,8 +289,30 @@ class ParamSpinBox(QAbstractSpinBox):
self.fBox.show()
self.slot_updateProgressBarGeometry()

# Add items, sorted
boxItemValues = []

for scalePoint in scalePoints:
self.fBox.addItem("%f - %s" % (scalePoint['value'], scalePoint['label']))
value = scalePoint['value']
label = "%f - %s" % (value, scalePoint['label'])

if len(boxItemValues) == 0:
self.fBox.addItem(label)
boxItemValues.append(value)

else:
if value < boxItemValues[0]:
self.fBox.insertItem(0, label)
boxItemValues.insert(0, value)
elif value > boxItemValues[-1]:
self.fBox.addItem(label)
boxItemValues.append(value)
else:
for index in range(len(boxItemValues)):
if value >= boxItemValues[index]:
self.fBox.insertItem(index+1, label)
boxItemValues.insert(index+1, value)
break

if self.fValue != None:
self._setScalePointValue(self.fValue)


Loading…
Cancel
Save