mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
fix issue #468 'unit' is reset
This commit is contained in:
parent
1711f8decf
commit
995eda101f
|
@ -286,18 +286,19 @@ class welcome(QWidget, Ui_welcome):
|
|||
|
||||
k = 0
|
||||
hasWC = False
|
||||
for d in self.template[1]:
|
||||
for templateIndex, d in enumerate(self.template[1]):
|
||||
spin = QSpinBox(self)
|
||||
spin.setRange(0, 999999)
|
||||
spin.setValue(d[0])
|
||||
# Storing the level of the template in that spinbox, so we can use
|
||||
# it to update the template when valueChanged on that spinbox
|
||||
# (we do that in self.updateWordCount for convenience).
|
||||
spin.setProperty("templateIndex", self.template[1].index(d))
|
||||
spin.setProperty("templateIndex", templateIndex)
|
||||
spin.valueChanged.connect(self.updateWordCount)
|
||||
|
||||
if d[1] != None:
|
||||
txt = QLineEdit(self)
|
||||
txt.setProperty("templateIndex", templateIndex)
|
||||
txt.textEdited.connect(self.updateWordCount)
|
||||
txt.setText(d[1])
|
||||
|
||||
else:
|
||||
|
@ -360,12 +361,21 @@ class welcome(QWidget, Ui_welcome):
|
|||
Qt.FindChildrenRecursively):
|
||||
total = total * s.value()
|
||||
|
||||
# Update self.template to reflect the changed values
|
||||
# Update self.template to reflect the changed count values
|
||||
templateIndex = s.property("templateIndex")
|
||||
self.template[1][templateIndex] = (
|
||||
s.value(),
|
||||
self.template[1][templateIndex][1])
|
||||
|
||||
for t in self.findChildren(QLineEdit, QRegExp(".*"),
|
||||
Qt.FindChildrenRecursively):
|
||||
# Update self.template to reflect the changed name values
|
||||
templateIndex = t.property("templateIndex")
|
||||
if templateIndex is not None :
|
||||
self.template[1][templateIndex] = (
|
||||
self.template[1][templateIndex][0],
|
||||
t.text())
|
||||
|
||||
if total == 1:
|
||||
total = 0
|
||||
|
||||
|
|
Loading…
Reference in a new issue