mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-15 02:12:29 +12:00
Fixes: add plot then choose new plot does not set importance slider
By default when a plot is added to the plot model, the importance value is set to "0" (Minor). However when the new plot is selected, the importance slider remains set to the value of the previously selected plot. Steps to Reproduce: 1. Click add plot (plus sign) button. 2. Select this "New plot". 3. Select "Basic infos" tab and change Plot name to "My Plot". 4. Move Importance slider all the way to the right (Main). 5. Click add plot (plus sign) button. 6. Select this "New plot". Note that the "New plot" is shown in the plot list pane under "Minor", but the Importance slider is still all the way to the right (Main). This enhancement ensures that the corresponding plot UI importance slider is also set to the proper plot importance.
This commit is contained in:
parent
8fe282e484
commit
3569f78928
|
@ -220,6 +220,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.sldPlotImportance.setCurrentModelIndex(index)
|
||||
self.lstPlotPerso.setRootIndex(index.sibling(index.row(),
|
||||
Plot.characters.value))
|
||||
|
||||
# Slider importance
|
||||
self.updatePlotImportance(index.row())
|
||||
|
||||
subplotindex = index.sibling(index.row(), Plot.steps.value)
|
||||
self.lstSubPlots.setRootIndex(subplotindex)
|
||||
if self.mdlPlots.rowCount(subplotindex):
|
||||
|
@ -245,6 +249,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
PlotStep.meta.value, QHeaderView.ResizeToContents)
|
||||
self.lstSubPlots.verticalHeader().hide()
|
||||
|
||||
def updatePlotImportance(self, ID):
|
||||
imp = self.mdlPlots.getPlotImportanceByID(ID)
|
||||
self.sldPlotImportance.setValue(int(imp))
|
||||
|
||||
def changeCurrentSubPlot(self, index):
|
||||
# Got segfaults when using textEditView model system, so ad hoc stuff.
|
||||
index = index.sibling(index.row(), PlotStep.summary.value)
|
||||
|
|
|
@ -55,6 +55,14 @@ class plotModel(QStandardItemModel):
|
|||
return name
|
||||
return None
|
||||
|
||||
def getPlotImportanceByID(self, ID):
|
||||
for i in range(self.rowCount()):
|
||||
_ID = self.item(i, Plot.ID.value).text()
|
||||
if _ID == ID or toInt(_ID) == ID:
|
||||
importance = self.item(i, Plot.importance.value).text()
|
||||
return importance
|
||||
return "0" # Default to "Minor"
|
||||
|
||||
def getSubPlotTextsByID(self, plotID, subplotRaw):
|
||||
"""Returns a tuple (name, summary) for the suplot whose raw in the model
|
||||
is ``subplotRaw``, of plot whose ID is ``plotID``.
|
||||
|
|
Loading…
Reference in a new issue