mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-14 18:02:23 +12:00
Finalising plot tab
This commit is contained in:
parent
d7c6ab4b25
commit
029165fc6b
|
@ -11,6 +11,7 @@ from enums import *
|
|||
from models.outlineModel import *
|
||||
from models.persosModel import *
|
||||
from models.plotModel import *
|
||||
from ui.views.outlineDelegates import outlinePersoDelegate
|
||||
#from models.persosProxyModel import *
|
||||
from functions import *
|
||||
from settingsWindow import *
|
||||
|
@ -305,6 +306,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self._updatingSubPlot = True
|
||||
self.txtSubPlotSummary.setPlainText("")
|
||||
self._updatingSubPlot = False
|
||||
self.lstPlotPerso.selectionModel().clear()
|
||||
|
||||
def changeCurrentSubPlot(self, index):
|
||||
# Got segfaults when using textEditView model system, so ad hoc stuff.
|
||||
|
@ -332,6 +334,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self._updatingSubPlot = True
|
||||
item.setText(self.txtSubPlotSummary.toPlainText())
|
||||
self._updatingSubPlot = False
|
||||
|
||||
def plotPersoSelectionChanged(self):
|
||||
"Enables or disables remove plot perso button."
|
||||
self.btnRmPlotPerso.setEnabled(
|
||||
len(self.lstPlotPerso.selectedIndexes()) != 0)
|
||||
|
||||
###############################################################################
|
||||
# LOAD AND SAVE
|
||||
|
@ -743,6 +750,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.mdlPlots.removePlot(self.lstPlots.currentPlotIndex()), AUC)
|
||||
self.btnAddSubPlot.clicked.connect(self.mdlPlots.addSubPlot, AUC)
|
||||
self.btnRmSubPlot.clicked.connect(self.mdlPlots.removeSubPlot, AUC)
|
||||
self.lstPlotPerso.selectionModel().selectionChanged.connect(self.plotPersoSelectionChanged)
|
||||
self.btnRmPlotPerso.clicked.connect(self.mdlPlots.removePlotPerso, AUC)
|
||||
|
||||
for w, c in [
|
||||
|
@ -759,6 +767,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.mdlPersos.dataChanged.connect(self.mdlPlots.updatePlotPersoButton)
|
||||
self.lstOutlinePlots.setPlotModel(self.mdlPlots)
|
||||
self.lstOutlinePlots.setShowSubPlot(True)
|
||||
self.plotPersoDelegate = outlinePersoDelegate(self.mdlPersos, self)
|
||||
self.lstPlotPerso.setItemDelegate(self.plotPersoDelegate)
|
||||
|
||||
# Outline
|
||||
self.treeRedacOutline.setModel(self.mdlOutline)
|
||||
|
|
|
@ -582,8 +582,8 @@ class Ui_MainWindow(object):
|
|||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.lstPlotPerso.sizePolicy().hasHeightForWidth())
|
||||
self.lstPlotPerso.setSizePolicy(sizePolicy)
|
||||
self.lstPlotPerso.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.lstPlotPerso.setMovement(QtWidgets.QListView.Static)
|
||||
self.lstPlotPerso.setViewMode(QtWidgets.QListView.IconMode)
|
||||
self.lstPlotPerso.setObjectName("lstPlotPerso")
|
||||
self.verticalLayout_12.addWidget(self.lstPlotPerso)
|
||||
self.horizontalLayout_16 = QtWidgets.QHBoxLayout()
|
||||
|
@ -597,6 +597,7 @@ class Ui_MainWindow(object):
|
|||
self.btnAddPlotPerso.setObjectName("btnAddPlotPerso")
|
||||
self.horizontalLayout_16.addWidget(self.btnAddPlotPerso)
|
||||
self.btnRmPlotPerso = QtWidgets.QPushButton(self.infos_2)
|
||||
self.btnRmPlotPerso.setEnabled(False)
|
||||
self.btnRmPlotPerso.setText("")
|
||||
icon = QtGui.QIcon.fromTheme("list-remove")
|
||||
self.btnRmPlotPerso.setIcon(icon)
|
||||
|
@ -1047,7 +1048,7 @@ class Ui_MainWindow(object):
|
|||
|
||||
self.retranslateUi(MainWindow)
|
||||
self.stack.setCurrentIndex(1)
|
||||
self.tabMain.setCurrentIndex(6)
|
||||
self.tabMain.setCurrentIndex(3)
|
||||
self.tabSummary.setCurrentIndex(0)
|
||||
self.tabPersos.setCurrentIndex(0)
|
||||
self.tabPlot.setCurrentIndex(0)
|
||||
|
@ -1175,17 +1176,17 @@ class Ui_MainWindow(object):
|
|||
self.actCompile.setText(_translate("MainWindow", "Compile"))
|
||||
self.actCompile.setShortcut(_translate("MainWindow", "F6"))
|
||||
|
||||
from ui.editors.mainEditor import mainEditor
|
||||
from ui.cheatSheet import cheatSheet
|
||||
from ui.views.outlineView import outlineView
|
||||
from ui.views.treeView import treeView
|
||||
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||
from ui.views.textEditView import textEditView
|
||||
from ui.views.metadataView import metadataView
|
||||
from ui.search import search
|
||||
from ui.sldImportance import sldImportance
|
||||
from ui.editors.mainEditor import mainEditor
|
||||
from ui.collapsibleGroupBox2 import collapsibleGroupBox2
|
||||
from ui.views.plotTreeView import plotTreeView
|
||||
from ui.views.basicItemView import basicItemView
|
||||
from ui.views.textEditView import textEditView
|
||||
from ui.views.persoTreeView import persoTreeView
|
||||
from ui.search import search
|
||||
from ui.views.lineEditView import lineEditView
|
||||
from ui.views.treeView import treeView
|
||||
from ui.welcome import welcome
|
||||
from ui.views.outlineView import outlineView
|
||||
from ui.views.persoTreeView import persoTreeView
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
<item>
|
||||
<widget class="QTabWidget" name="tabMain">
|
||||
<property name="currentIndex">
|
||||
<number>6</number>
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="documentMode">
|
||||
<bool>true</bool>
|
||||
|
@ -1144,12 +1144,12 @@
|
|||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="movement">
|
||||
<enum>QListView::Static</enum>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::IconMode</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
@ -1180,6 +1180,9 @@
|
|||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btnRmPlotPerso">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
|
|
|
@ -164,7 +164,8 @@ class outlinePersoDelegate(QStyledItemDelegate):
|
|||
|
||||
qApp.style().drawControl(QStyle.CE_ItemViewItem, opt, painter)
|
||||
|
||||
if index.isValid() and index.internalPointer().data(Outline.POV.value) not in ["", None]:
|
||||
#if index.isValid() and index.internalPointer().data(Outline.POV.value) not in ["", None]:
|
||||
if index.isValid() and self.mdlPersos.data(index) not in ["", None]:
|
||||
opt = QStyleOptionComboBox()
|
||||
opt.rect = option.rect
|
||||
r = qApp.style().subControlRect(QStyle.CC_ComboBox, opt, QStyle.SC_ComboBoxArrow)
|
||||
|
|
|
@ -7,6 +7,9 @@ from functions import *
|
|||
import settings
|
||||
|
||||
class treeTitleDelegate(QStyledItemDelegate):
|
||||
"""The main purpose of ``treeTitleDelegate`` is to paint outline items
|
||||
in the treeview with propers colors according to settings.
|
||||
"""
|
||||
def __init__(self, parent=None):
|
||||
QStyledItemDelegate.__init__(self, parent)
|
||||
self._view = None
|
||||
|
|
Loading…
Reference in a new issue