mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-15 10:22:26 +12:00
Fixes #240: Cannot write a summary on a plot resolution step
This commit is contained in:
parent
9c635301b5
commit
9cbd8887c7
|
@ -3,7 +3,8 @@
|
|||
import imp
|
||||
import os
|
||||
|
||||
from PyQt5.QtCore import pyqtSignal, QSignalMapper, QTimer, QSettings, Qt, QRegExp, QUrl, QSize
|
||||
from PyQt5.QtCore import (pyqtSignal, QSignalMapper, QTimer, QSettings, Qt,
|
||||
QRegExp, QUrl, QSize, QModelIndex)
|
||||
from PyQt5.QtGui import QStandardItemModel, QIcon, QColor
|
||||
from PyQt5.QtWidgets import QMainWindow, QHeaderView, qApp, QMenu, QActionGroup, QAction, QStyle, QListWidgetItem, \
|
||||
QLabel, QDockWidget
|
||||
|
@ -380,11 +381,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
if self.mdlPlots.rowCount(subplotindex):
|
||||
self.updateSubPlotView()
|
||||
|
||||
# self.txtSubPlotSummary.setCurrentModelIndex(QModelIndex())
|
||||
self.txtSubPlotSummary.setEnabled(False)
|
||||
self._updatingSubPlot = True
|
||||
self.txtSubPlotSummary.setPlainText("")
|
||||
self._updatingSubPlot = False
|
||||
self.txtSubPlotSummary.setCurrentModelIndex(QModelIndex())
|
||||
self.lstPlotPerso.selectionModel().clear()
|
||||
|
||||
def updateSubPlotView(self):
|
||||
|
@ -418,31 +415,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
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)
|
||||
item = self.mdlPlots.itemFromIndex(index)
|
||||
if not item:
|
||||
self.txtSubPlotSummary.setEnabled(False)
|
||||
return
|
||||
self.txtSubPlotSummary.setEnabled(True)
|
||||
txt = item.text()
|
||||
self._updatingSubPlot = True
|
||||
self.txtSubPlotSummary.setPlainText(txt)
|
||||
self._updatingSubPlot = False
|
||||
|
||||
def updateSubPlotSummary(self):
|
||||
if self._updatingSubPlot:
|
||||
return
|
||||
|
||||
index = self.lstSubPlots.currentIndex()
|
||||
if not index.isValid():
|
||||
return
|
||||
index = index.sibling(index.row(), PlotStep.summary)
|
||||
item = self.mdlPlots.itemFromIndex(index)
|
||||
|
||||
self._updatingSubPlot = True
|
||||
item.setText(self.txtSubPlotSummary.toPlainText())
|
||||
self._updatingSubPlot = False
|
||||
self.txtSubPlotSummary.setColumn(PlotStep.summary)
|
||||
self.txtSubPlotSummary.setCurrentModelIndex(index)
|
||||
|
||||
def plotPersoSelectionChanged(self):
|
||||
"Enables or disables remove plot perso button."
|
||||
|
@ -831,8 +806,6 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
|
||||
self.txtPlotFilter.textChanged.connect(self.lstPlots.setFilter, F.AUC)
|
||||
self.lstPlots.currentItemChanged.connect(self.changeCurrentPlot, F.AUC)
|
||||
self.txtSubPlotSummary.document().contentsChanged.connect(
|
||||
self.updateSubPlotSummary, F.AUC)
|
||||
self.lstSubPlots.clicked.connect(self.changeCurrentSubPlot, F.AUC)
|
||||
|
||||
self.btnRedacAddFolder.clicked.connect(self.treeRedacOutline.addFolder, F.AUC)
|
||||
|
|
|
@ -9,7 +9,7 @@ from PyQt5.QtWidgets import QWidget, QTextEdit, qApp, QAction, QMenu
|
|||
from manuskript import settings
|
||||
from manuskript.enums import Outline, World, Character, Plot
|
||||
from manuskript import functions as F
|
||||
from manuskript.models.outlineModel import outlineModel
|
||||
from manuskript.models import outlineModel, outlineItem
|
||||
from manuskript.ui.highlighters import BasicHighlighter
|
||||
from manuskript.ui import style as S
|
||||
|
||||
|
@ -303,6 +303,10 @@ class textEditView(QTextEdit):
|
|||
return
|
||||
# FIXME: self._indexes
|
||||
|
||||
if self._index.model() != outlineItem:
|
||||
# The next stuff is only for outlineItems
|
||||
return
|
||||
|
||||
# We check if item is a child of the row about to be removed
|
||||
child = False
|
||||
p = self._index.parent()
|
||||
|
|
Loading…
Reference in a new issue