mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-14 18:02:23 +12:00
Fix plot importance changes if delete earlier plot and click other plots
The root cause was a mismatch between plot IDs and plot model rows.
This issue would appear when a plot was deleted such that the plot IDs
did not match the plot model row numbers and different plots had
different importance levels. The problem would not occur if the most
recently added plot was deleted.
The plot ID / plot model row mismatch was introduced with the
following commit:
Fixes: add plot then choose new plot does not set \
importance slider
3569f78928
Closes issue #404
This commit is contained in:
parent
729489a77e
commit
026861ee87
|
@ -417,8 +417,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
PlotStep.meta, QHeaderView.ResizeToContents)
|
||||
self.lstSubPlots.verticalHeader().hide()
|
||||
|
||||
def updatePlotImportance(self, ID):
|
||||
imp = self.mdlPlots.getPlotImportanceByID(ID)
|
||||
def updatePlotImportance(self, row):
|
||||
imp = self.mdlPlots.getPlotImportanceByRow(row)
|
||||
self.sldPlotImportance.setValue(int(imp))
|
||||
|
||||
def changeCurrentSubPlot(self, index):
|
||||
|
|
|
@ -68,10 +68,9 @@ class plotModel(QStandardItemModel):
|
|||
return name
|
||||
return None
|
||||
|
||||
def getPlotImportanceByID(self, ID):
|
||||
def getPlotImportanceByRow(self, row):
|
||||
for i in range(self.rowCount()):
|
||||
_ID = self.item(i, Plot.ID).text()
|
||||
if _ID == ID or toInt(_ID) == ID:
|
||||
if i == row:
|
||||
importance = self.item(i, Plot.importance).text()
|
||||
return importance
|
||||
return "0" # Default to "Minor"
|
||||
|
|
Loading…
Reference in a new issue