Enabling/Disabling POV for a specific character

This commit is contained in:
TheJackiMonster 2020-03-31 05:55:30 +02:00
parent a43a4ccb40
commit 61734c1afa
No known key found for this signature in database
GPG key ID: D850A5F772E880F9
10 changed files with 255 additions and 120 deletions

View file

@ -16,6 +16,7 @@ class Character(IntEnum):
summaryPara = 8 summaryPara = 8
summaryFull = 9 summaryFull = 9
notes = 10 notes = 10
pov = 11
class Plot(IntEnum): class Plot(IntEnum):
name = 0 name = 0

View file

@ -40,6 +40,7 @@ characterMap = OrderedDict([
(Character.name, "Name"), (Character.name, "Name"),
(Character.ID, "ID"), (Character.ID, "ID"),
(Character.importance, "Importance"), (Character.importance, "Importance"),
(Character.pov, "POV"),
(Character.motivation, "Motivation"), (Character.motivation, "Motivation"),
(Character.goal, "Goal"), (Character.goal, "Goal"),
(Character.conflict, "Conflict"), (Character.conflict, "Conflict"),
@ -47,7 +48,7 @@ characterMap = OrderedDict([
(Character.summarySentence, "Phrase Summary"), (Character.summarySentence, "Phrase Summary"),
(Character.summaryPara, "Paragraph Summary"), (Character.summaryPara, "Paragraph Summary"),
(Character.summaryFull, "Full Summary"), (Character.summaryFull, "Full Summary"),
(Character.notes, "Notes"), (Character.notes, "Notes")
]) ])
# If true, logs infos while saving and loading. # If true, logs infos while saving and loading.

View file

@ -346,6 +346,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Slider importance # Slider importance
self.updateCharacterImportance(c.ID()) self.updateCharacterImportance(c.ID())
# POV state
self.updateCharacterPOVState(c.ID())
# Character Infos # Character Infos
self.tblPersoInfos.setRootIndex(index) self.tblPersoInfos.setRootIndex(index)
@ -366,6 +369,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
c = self.mdlCharacter.getCharacterByID(ID) c = self.mdlCharacter.getCharacterByID(ID)
self.sldPersoImportance.setValue(int(c.importance())) self.sldPersoImportance.setValue(int(c.importance()))
def updateCharacterPOVState(self, ID):
c = self.mdlCharacter.getCharacterByID(ID)
self.disconnectAll(self.chkPersoPOV.stateChanged, self.lstCharacters.changeCharacterPOVState)
if c.pov():
self.chkPersoPOV.setCheckState(Qt.Checked)
else:
self.chkPersoPOV.setCheckState(Qt.Unchecked)
self.chkPersoPOV.stateChanged.connect(self.lstCharacters.changeCharacterPOVState, F.AUC)
self.chkPersoPOV.setEnabled(len(self.mdlOutline.findItemsByPOV(ID)) == 0)
############################################################################### ###############################################################################
# PLOTS # PLOTS
############################################################################### ###############################################################################
@ -935,9 +950,13 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.tblPersoInfos.setModel(self.mdlCharacter) self.tblPersoInfos.setModel(self.mdlCharacter)
self.btnAddPerso.clicked.connect(self.mdlCharacter.addCharacter, F.AUC) self.btnAddPerso.clicked.connect(self.mdlCharacter.addCharacter, F.AUC)
try: try:
self.btnRmPerso.clicked.connect(self.lstCharacters.removeCharacter, F.AUC) self.btnRmPerso.clicked.connect(self.lstCharacters.removeCharacter, F.AUC)
self.btnPersoColor.clicked.connect(self.lstCharacters.choseCharacterColor, F.AUC) self.btnPersoColor.clicked.connect(self.lstCharacters.choseCharacterColor, F.AUC)
self.chkPersoPOV.stateChanged.connect(self.lstCharacters.changeCharacterPOVState, F.AUC)
self.btnPersoAddInfo.clicked.connect(self.lstCharacters.addCharacterInfo, F.AUC) self.btnPersoAddInfo.clicked.connect(self.lstCharacters.addCharacterInfo, F.AUC)
self.btnPersoRmInfo.clicked.connect(self.lstCharacters.removeCharacterInfo, F.AUC) self.btnPersoRmInfo.clicked.connect(self.lstCharacters.removeCharacterInfo, F.AUC)
except TypeError: except TypeError:
@ -1091,7 +1110,10 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Characters # Characters
self.disconnectAll(self.btnAddPerso.clicked, self.mdlCharacter.addCharacter) self.disconnectAll(self.btnAddPerso.clicked, self.mdlCharacter.addCharacter)
self.disconnectAll(self.btnRmPerso.clicked, self.lstCharacters.removeCharacter) self.disconnectAll(self.btnRmPerso.clicked, self.lstCharacters.removeCharacter)
self.disconnectAll(self.btnPersoColor.clicked, self.lstCharacters.choseCharacterColor) self.disconnectAll(self.btnPersoColor.clicked, self.lstCharacters.choseCharacterColor)
self.disconnectAll(self.chkPersoPOV.stateChanged, self.lstCharacters.changeCharacterPOVState)
self.disconnectAll(self.btnPersoAddInfo.clicked, self.lstCharacters.addCharacterInfo) self.disconnectAll(self.btnPersoAddInfo.clicked, self.lstCharacters.addCharacterInfo)
self.disconnectAll(self.btnPersoRmInfo.clicked, self.lstCharacters.removeCharacterInfo) self.disconnectAll(self.btnPersoRmInfo.clicked, self.lstCharacters.removeCharacterInfo)

View file

@ -132,6 +132,9 @@ class characterModel(QAbstractItemModel):
def importance(self, row): def importance(self, row):
return self.character(row).importance() return self.character(row).importance()
def pov(self, row):
return self.character(row).pov()
############################################################################### ###############################################################################
# MODEL QUERIES # MODEL QUERIES
############################################################################### ###############################################################################
@ -143,8 +146,10 @@ class characterModel(QAbstractItemModel):
@return: array of array of ´character´, by importance. @return: array of array of ´character´, by importance.
""" """
r = [[], [], []] r = [[], [], []]
for c in self.characters: for c in self.characters:
r[2-int(c.importance())].append(c) r[2-int(c.importance())].append(c)
return r return r
def getCharacterByID(self, ID): def getCharacterByID(self, ID):
@ -153,6 +158,7 @@ class characterModel(QAbstractItemModel):
for c in self.characters: for c in self.characters:
if c.ID() == ID: if c.ID() == ID:
return c return c
return None return None
############################################################################### ###############################################################################
@ -231,6 +237,7 @@ class Character():
self.assignUniqueID() self.assignUniqueID()
self.assignRandomColor() self.assignRandomColor()
self._data[C.importance.value] = "0" self._data[C.importance.value] = "0"
self._data[C.pov.value] = "True"
self.infos = [] self.infos = []
@ -274,6 +281,22 @@ class Character():
""" """
return iconColor(self.icon) return iconColor(self.icon)
def setPOVEnabled(self, enabled):
if enabled != self.pov():
if enabled:
self._data[C.pov.value] = 'True'
else:
self._data[C.pov.value] = 'False'
try:
self._model.dataChanged.emit(self.index(), self.index())
except:
# If it is the initialisation, won't be able to emit
pass
def pov(self):
return self._data[C.pov.value] == 'True'
def assignUniqueID(self, parent=QModelIndex()): def assignUniqueID(self, parent=QModelIndex()):
"""Assigns an unused character ID.""" """Assigns an unused character ID."""
vals = [] vals = []

View file

@ -0,0 +1,47 @@
#!/usr/bin/env python
# --!-- coding: utf8 --!--
from PyQt5.QtCore import QModelIndex, QSortFilterProxyModel
class characterPOVModel(QSortFilterProxyModel):
def __init__(self, sourceModel, parent=None):
QSortFilterProxyModel.__init__(self, parent)
self.setSourceModel(sourceModel)
if sourceModel:
sourceModel.dataChanged.connect(self.sourceDataChanged)
def filterAcceptsRow(self, sourceRow, sourceParent):
return self.sourceModel().pov(sourceRow)
def rowToSource(self, row):
index = self.index(row, 0)
sourceIndex = self.mapToSource(index)
return sourceIndex.row()
def sourceDataChanged(self, topLeft, bottomRight):
self.invalidateFilter()
###############################################################################
# CHARACTER QUERIES
###############################################################################
def character(self, row):
return self.sourceModel().character(self.rowToSource(row))
def name(self, row):
return self.sourceModel().name(self.rowToSource(row))
def icon(self, row):
return self.sourceModel().icon(self.rowToSource(row))
def ID(self, row):
return self.sourceModel().ID(self.rowToSource(row))
def importance(self, row):
return self.sourceModel().importance(self.rowToSource(row))
def pov(self, row):
return self.sourceModel().pov(self.rowToSource(row))

View file

@ -2,12 +2,14 @@
# Form implementation generated from reading ui file 'manuskript/ui/mainWindow.ui' # Form implementation generated from reading ui file 'manuskript/ui/mainWindow.ui'
# #
# Created by: PyQt5 UI code generator 5.5.1 # Created by: PyQt5 UI code generator 5.14.1
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow") MainWindow.setObjectName("MainWindow")
@ -378,69 +380,11 @@ class Ui_MainWindow(object):
self.scrollAreaPersoInfos.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.scrollAreaPersoInfos.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.scrollAreaPersoInfos.setObjectName("scrollAreaPersoInfos") self.scrollAreaPersoInfos.setObjectName("scrollAreaPersoInfos")
self.scrollAreaPersoInfosWidget = QtWidgets.QWidget() self.scrollAreaPersoInfosWidget = QtWidgets.QWidget()
self.scrollAreaPersoInfosWidget.setGeometry(QtCore.QRect(0, 0, 204, 606)) self.scrollAreaPersoInfosWidget.setGeometry(QtCore.QRect(0, 0, 453, 695))
self.scrollAreaPersoInfosWidget.setObjectName("scrollAreaPersoInfosWidget") self.scrollAreaPersoInfosWidget.setObjectName("scrollAreaPersoInfosWidget")
self.formLayout_8 = QtWidgets.QFormLayout(self.scrollAreaPersoInfosWidget) self.formLayout_8 = QtWidgets.QFormLayout(self.scrollAreaPersoInfosWidget)
self.formLayout_8.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) self.formLayout_8.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
self.formLayout_8.setObjectName("formLayout_8") self.formLayout_8.setObjectName("formLayout_8")
self.label_4 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_4.setObjectName("label_4")
self.formLayout_8.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.txtPersoMotivation = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoMotivation.setObjectName("txtPersoMotivation")
self.formLayout_8.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.txtPersoMotivation)
self.label_5 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_5.setObjectName("label_5")
self.formLayout_8.setWidget(5, QtWidgets.QFormLayout.LabelRole, self.label_5)
self.txtPersoGoal = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoGoal.setObjectName("txtPersoGoal")
self.formLayout_8.setWidget(5, QtWidgets.QFormLayout.FieldRole, self.txtPersoGoal)
self.label_6 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_6.setObjectName("label_6")
self.formLayout_8.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.label_6)
self.txtPersoConflict = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoConflict.setObjectName("txtPersoConflict")
self.formLayout_8.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.txtPersoConflict)
self.label_7 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_7.setObjectName("label_7")
self.formLayout_8.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_7)
self.txtPersoEpiphany = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoEpiphany.setObjectName("txtPersoEpiphany")
self.formLayout_8.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.txtPersoEpiphany)
self.label_24 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_24.setObjectName("label_24")
self.formLayout_8.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.label_24)
self.txtPersoSummarySentence = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoSummarySentence.setObjectName("txtPersoSummarySentence")
self.formLayout_8.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.txtPersoSummarySentence)
self.label_8 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_8.setObjectName("label_8")
self.formLayout_8.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.label_8)
self.txtPersoSummaryPara = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoSummaryPara.setObjectName("txtPersoSummaryPara")
self.formLayout_8.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.txtPersoSummaryPara)
self.horizontalLayout_21 = QtWidgets.QHBoxLayout()
self.horizontalLayout_21.setObjectName("horizontalLayout_21")
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_21.addItem(spacerItem10)
self.btnStepFour = QtWidgets.QPushButton(self.scrollAreaPersoInfosWidget)
icon = QtGui.QIcon.fromTheme("go-next")
self.btnStepFour.setIcon(icon)
self.btnStepFour.setFlat(True)
self.btnStepFour.setObjectName("btnStepFour")
self.horizontalLayout_21.addWidget(self.btnStepFour)
self.formLayout_8.setLayout(10, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_21)
self.label_18 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_18.setObjectName("label_18")
self.formLayout_8.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_18)
self.sldPersoImportance = sldImportance(self.scrollAreaPersoInfosWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.sldPersoImportance.sizePolicy().hasHeightForWidth())
self.sldPersoImportance.setSizePolicy(sizePolicy)
self.sldPersoImportance.setObjectName("sldPersoImportance")
self.formLayout_8.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.sldPersoImportance)
self.label_3 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget) self.label_3 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_3.setObjectName("label_3") self.label_3.setObjectName("label_3")
self.formLayout_8.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3) self.formLayout_8.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.label_3)
@ -454,6 +398,73 @@ class Ui_MainWindow(object):
self.btnPersoColor.setObjectName("btnPersoColor") self.btnPersoColor.setObjectName("btnPersoColor")
self.horizontalLayout_3.addWidget(self.btnPersoColor) self.horizontalLayout_3.addWidget(self.btnPersoColor)
self.formLayout_8.setLayout(2, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_3) self.formLayout_8.setLayout(2, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_3)
self.horizontalLayout_20 = QtWidgets.QHBoxLayout()
self.horizontalLayout_20.setObjectName("horizontalLayout_20")
self.sldPersoImportance = sldImportance(self.scrollAreaPersoInfosWidget)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.sldPersoImportance.sizePolicy().hasHeightForWidth())
self.sldPersoImportance.setSizePolicy(sizePolicy)
self.sldPersoImportance.setObjectName("sldPersoImportance")
self.horizontalLayout_20.addWidget(self.sldPersoImportance)
self.chkPersoPOV = QtWidgets.QCheckBox(self.scrollAreaPersoInfosWidget)
self.chkPersoPOV.setChecked(False)
self.chkPersoPOV.setAutoRepeat(False)
self.chkPersoPOV.setTristate(False)
self.chkPersoPOV.setObjectName("chkPersoPOV")
self.horizontalLayout_20.addWidget(self.chkPersoPOV)
self.formLayout_8.setLayout(4, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_20)
self.label_4 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_4.setObjectName("label_4")
self.formLayout_8.setWidget(6, QtWidgets.QFormLayout.LabelRole, self.label_4)
self.txtPersoMotivation = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoMotivation.setObjectName("txtPersoMotivation")
self.formLayout_8.setWidget(6, QtWidgets.QFormLayout.FieldRole, self.txtPersoMotivation)
self.label_5 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_5.setObjectName("label_5")
self.formLayout_8.setWidget(7, QtWidgets.QFormLayout.LabelRole, self.label_5)
self.txtPersoGoal = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoGoal.setObjectName("txtPersoGoal")
self.formLayout_8.setWidget(7, QtWidgets.QFormLayout.FieldRole, self.txtPersoGoal)
self.label_6 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_6.setObjectName("label_6")
self.formLayout_8.setWidget(8, QtWidgets.QFormLayout.LabelRole, self.label_6)
self.txtPersoConflict = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoConflict.setObjectName("txtPersoConflict")
self.formLayout_8.setWidget(8, QtWidgets.QFormLayout.FieldRole, self.txtPersoConflict)
self.label_7 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_7.setObjectName("label_7")
self.formLayout_8.setWidget(9, QtWidgets.QFormLayout.LabelRole, self.label_7)
self.txtPersoEpiphany = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoEpiphany.setObjectName("txtPersoEpiphany")
self.formLayout_8.setWidget(9, QtWidgets.QFormLayout.FieldRole, self.txtPersoEpiphany)
self.label_24 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_24.setObjectName("label_24")
self.formLayout_8.setWidget(10, QtWidgets.QFormLayout.LabelRole, self.label_24)
self.txtPersoSummarySentence = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoSummarySentence.setObjectName("txtPersoSummarySentence")
self.formLayout_8.setWidget(10, QtWidgets.QFormLayout.FieldRole, self.txtPersoSummarySentence)
self.label_8 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_8.setObjectName("label_8")
self.formLayout_8.setWidget(11, QtWidgets.QFormLayout.LabelRole, self.label_8)
self.txtPersoSummaryPara = MDEditCompleter(self.scrollAreaPersoInfosWidget)
self.txtPersoSummaryPara.setObjectName("txtPersoSummaryPara")
self.formLayout_8.setWidget(11, QtWidgets.QFormLayout.FieldRole, self.txtPersoSummaryPara)
self.horizontalLayout_21 = QtWidgets.QHBoxLayout()
self.horizontalLayout_21.setObjectName("horizontalLayout_21")
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_21.addItem(spacerItem10)
self.btnStepFour = QtWidgets.QPushButton(self.scrollAreaPersoInfosWidget)
icon = QtGui.QIcon.fromTheme("go-next")
self.btnStepFour.setIcon(icon)
self.btnStepFour.setFlat(True)
self.btnStepFour.setObjectName("btnStepFour")
self.horizontalLayout_21.addWidget(self.btnStepFour)
self.formLayout_8.setLayout(12, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_21)
self.label_18 = QtWidgets.QLabel(self.scrollAreaPersoInfosWidget)
self.label_18.setObjectName("label_18")
self.formLayout_8.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_18)
self.scrollAreaPersoInfos.setWidget(self.scrollAreaPersoInfosWidget) self.scrollAreaPersoInfos.setWidget(self.scrollAreaPersoInfosWidget)
self.verticalLayout_20.addWidget(self.scrollAreaPersoInfos) self.verticalLayout_20.addWidget(self.scrollAreaPersoInfos)
self.tabPersos.addTab(self.info, "") self.tabPersos.addTab(self.info, "")
@ -745,7 +756,7 @@ class Ui_MainWindow(object):
self.treeWorld.setRootIsDecorated(False) self.treeWorld.setRootIsDecorated(False)
self.treeWorld.setObjectName("treeWorld") self.treeWorld.setObjectName("treeWorld")
self.treeWorld.header().setVisible(False) self.treeWorld.header().setVisible(False)
self.treeWorld.header().setDefaultSectionSize(0) self.treeWorld.header().setDefaultSectionSize(25)
self.verticalLayout_32.addWidget(self.treeWorld) self.verticalLayout_32.addWidget(self.treeWorld)
self.horizontalLayout_19 = QtWidgets.QHBoxLayout() self.horizontalLayout_19 = QtWidgets.QHBoxLayout()
self.horizontalLayout_19.setObjectName("horizontalLayout_19") self.horizontalLayout_19.setObjectName("horizontalLayout_19")
@ -833,6 +844,7 @@ class Ui_MainWindow(object):
self.layoutWidget = QtWidgets.QWidget(self.splitterOutlineH) self.layoutWidget = QtWidgets.QWidget(self.splitterOutlineH)
self.layoutWidget.setObjectName("layoutWidget") self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout_14 = QtWidgets.QVBoxLayout(self.layoutWidget) self.verticalLayout_14 = QtWidgets.QVBoxLayout(self.layoutWidget)
self.verticalLayout_14.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_14.setObjectName("verticalLayout_14") self.verticalLayout_14.setObjectName("verticalLayout_14")
self.splitterOutlineV = QtWidgets.QSplitter(self.layoutWidget) self.splitterOutlineV = QtWidgets.QSplitter(self.layoutWidget)
self.splitterOutlineV.setOrientation(QtCore.Qt.Vertical) self.splitterOutlineV.setOrientation(QtCore.Qt.Vertical)
@ -1029,7 +1041,7 @@ class Ui_MainWindow(object):
self.horizontalLayout_2.addWidget(self.stack) self.horizontalLayout_2.addWidget(self.stack)
MainWindow.setCentralWidget(self.centralwidget) MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow) self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1112, 30)) self.menubar.setGeometry(QtCore.QRect(0, 0, 1112, 24))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
self.menuFile = QtWidgets.QMenu(self.menubar) self.menuFile = QtWidgets.QMenu(self.menubar)
self.menuFile.setObjectName("menuFile") self.menuFile.setObjectName("menuFile")
@ -1339,7 +1351,7 @@ class Ui_MainWindow(object):
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
self.stack.setCurrentIndex(1) self.stack.setCurrentIndex(1)
self.tabMain.setCurrentIndex(0) self.tabMain.setCurrentIndex(2)
self.tabSummary.setCurrentIndex(0) self.tabSummary.setCurrentIndex(0)
self.tabPersos.setCurrentIndex(0) self.tabPersos.setCurrentIndex(0)
self.tabPlot.setCurrentIndex(0) self.tabPlot.setCurrentIndex(0)
@ -1484,6 +1496,8 @@ class Ui_MainWindow(object):
self.tabMain.setTabText(self.tabMain.indexOf(self.lytTabSummary), _translate("MainWindow", "Summary")) self.tabMain.setTabText(self.tabMain.indexOf(self.lytTabSummary), _translate("MainWindow", "Summary"))
self.groupBox.setTitle(_translate("MainWindow", "Names")) self.groupBox.setTitle(_translate("MainWindow", "Names"))
self.txtPersosFilter.setPlaceholderText(_translate("MainWindow", "Filter")) self.txtPersosFilter.setPlaceholderText(_translate("MainWindow", "Filter"))
self.label_3.setText(_translate("MainWindow", "Name"))
self.chkPersoPOV.setText(_translate("MainWindow", "Allow POV"))
self.label_4.setText(_translate("MainWindow", "Motivation")) self.label_4.setText(_translate("MainWindow", "Motivation"))
self.label_5.setText(_translate("MainWindow", "Goal")) self.label_5.setText(_translate("MainWindow", "Goal"))
self.label_6.setText(_translate("MainWindow", "Conflict")) self.label_6.setText(_translate("MainWindow", "Conflict"))
@ -1492,7 +1506,6 @@ class Ui_MainWindow(object):
self.label_8.setText(_translate("MainWindow", "<html><head/><body><p align=\"right\">One paragraph<br/>summary</p></body></html>")) self.label_8.setText(_translate("MainWindow", "<html><head/><body><p align=\"right\">One paragraph<br/>summary</p></body></html>"))
self.btnStepFour.setText(_translate("MainWindow", "Next")) self.btnStepFour.setText(_translate("MainWindow", "Next"))
self.label_18.setText(_translate("MainWindow", "Importance")) self.label_18.setText(_translate("MainWindow", "Importance"))
self.label_3.setText(_translate("MainWindow", "Name"))
self.tabPersos.setTabText(self.tabPersos.indexOf(self.info), _translate("MainWindow", "Basic info")) self.tabPersos.setTabText(self.tabPersos.indexOf(self.info), _translate("MainWindow", "Basic info"))
self.btnStepSix.setText(_translate("MainWindow", "Next")) self.btnStepSix.setText(_translate("MainWindow", "Next"))
self.tabPersos.setTabText(self.tabPersos.indexOf(self.tab_11), _translate("MainWindow", "Summary")) self.tabPersos.setTabText(self.tabPersos.indexOf(self.tab_11), _translate("MainWindow", "Summary"))
@ -1635,7 +1648,6 @@ class Ui_MainWindow(object):
self.actFormatOrderedList.setText(_translate("MainWindow", "&Ordered list")) self.actFormatOrderedList.setText(_translate("MainWindow", "&Ordered list"))
self.actFormatList.setText(_translate("MainWindow", "&Unordered list")) self.actFormatList.setText(_translate("MainWindow", "&Unordered list"))
self.actFormatBlockquote.setText(_translate("MainWindow", "B&lockquote")) self.actFormatBlockquote.setText(_translate("MainWindow", "B&lockquote"))
from manuskript.ui.cheatSheet import cheatSheet from manuskript.ui.cheatSheet import cheatSheet
from manuskript.ui.editors.mainEditor import mainEditor from manuskript.ui.editors.mainEditor import mainEditor
from manuskript.ui.search import search from manuskript.ui.search import search

View file

@ -124,7 +124,7 @@
<enum>QTabWidget::Rounded</enum> <enum>QTabWidget::Rounded</enum>
</property> </property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>2</number>
</property> </property>
<property name="documentMode"> <property name="documentMode">
<bool>true</bool> <bool>true</bool>
@ -815,75 +815,126 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>204</width> <width>453</width>
<height>606</height> <height>695</height>
</rect> </rect>
</property> </property>
<layout class="QFormLayout" name="formLayout_8"> <layout class="QFormLayout" name="formLayout_8">
<property name="fieldGrowthPolicy"> <property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum> <enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property> </property>
<item row="4" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="lineEditView" name="txtPersoName"/>
</item>
<item>
<widget class="QPushButton" name="btnPersoColor">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_20">
<item>
<widget class="sldImportance" name="sldPersoImportance" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="chkPersoPOV">
<property name="text">
<string>Allow POV</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoRepeat">
<bool>false</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>Motivation</string> <string>Motivation</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="6" column="1">
<widget class="MDEditCompleter" name="txtPersoMotivation"/> <widget class="MDEditCompleter" name="txtPersoMotivation"/>
</item> </item>
<item row="5" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_5"> <widget class="QLabel" name="label_5">
<property name="text"> <property name="text">
<string>Goal</string> <string>Goal</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="7" column="1">
<widget class="MDEditCompleter" name="txtPersoGoal"/> <widget class="MDEditCompleter" name="txtPersoGoal"/>
</item> </item>
<item row="6" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_6"> <widget class="QLabel" name="label_6">
<property name="text"> <property name="text">
<string>Conflict</string> <string>Conflict</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="8" column="1">
<widget class="MDEditCompleter" name="txtPersoConflict"/> <widget class="MDEditCompleter" name="txtPersoConflict"/>
</item> </item>
<item row="7" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Epiphany</string> <string>Epiphany</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="9" column="1">
<widget class="MDEditCompleter" name="txtPersoEpiphany"/> <widget class="MDEditCompleter" name="txtPersoEpiphany"/>
</item> </item>
<item row="8" column="0"> <item row="10" column="0">
<widget class="QLabel" name="label_24"> <widget class="QLabel" name="label_24">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;One sentence&lt;br/&gt;summary&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;One sentence&lt;br/&gt;summary&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="8" column="1"> <item row="10" column="1">
<widget class="MDEditCompleter" name="txtPersoSummarySentence"/> <widget class="MDEditCompleter" name="txtPersoSummarySentence"/>
</item> </item>
<item row="9" column="0"> <item row="11" column="0">
<widget class="QLabel" name="label_8"> <widget class="QLabel" name="label_8">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;One paragraph&lt;br/&gt;summary&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;right&quot;&gt;One paragraph&lt;br/&gt;summary&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="11" column="1">
<widget class="MDEditCompleter" name="txtPersoSummaryPara"/> <widget class="MDEditCompleter" name="txtPersoSummaryPara"/>
</item> </item>
<item row="10" column="1"> <item row="12" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_21"> <layout class="QHBoxLayout" name="horizontalLayout_21">
<item> <item>
<spacer name="horizontalSpacer_3"> <spacer name="horizontalSpacer_3">
@ -914,44 +965,13 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="3" column="0"> <item row="4" column="0">
<widget class="QLabel" name="label_18"> <widget class="QLabel" name="label_18">
<property name="text"> <property name="text">
<string>Importance</string> <string>Importance</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1">
<widget class="sldImportance" name="sldPersoImportance" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="lineEditView" name="txtPersoName"/>
</item>
<item>
<widget class="QPushButton" name="btnPersoColor">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>
@ -1547,7 +1567,7 @@
<bool>false</bool> <bool>false</bool>
</attribute> </attribute>
<attribute name="headerDefaultSectionSize"> <attribute name="headerDefaultSectionSize">
<number>0</number> <number>25</number>
</attribute> </attribute>
</widget> </widget>
</item> </item>
@ -2095,7 +2115,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1112</width> <width>1112</width>
<height>30</height> <height>24</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuFile"> <widget class="QMenu" name="menuFile">

View file

@ -2,7 +2,7 @@
# Form implementation generated from reading ui file 'manuskript/ui/settings_ui.ui' # Form implementation generated from reading ui file 'manuskript/ui/settings_ui.ui'
# #
# Created by: PyQt5 UI code generator 5.13.0 # Created by: PyQt5 UI code generator 5.14.1
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!

View file

@ -130,22 +130,30 @@ class characterTreeView(QTreeWidget):
def choseCharacterColor(self): def choseCharacterColor(self):
ID = self.currentCharacterID() ID = self.currentCharacterID()
c = self._model.getCharacterByID(ID) c = self._model.getCharacterByID(ID)
if c: if c:
color = iconColor(c.icon) color = iconColor(c.icon)
else: else:
color = Qt.white color = Qt.white
self.colorDialog = QColorDialog(color, mainWindow()) self.colorDialog = QColorDialog(color, mainWindow())
color = self.colorDialog.getColor(color) color = self.colorDialog.getColor(color)
if color.isValid(): if color.isValid():
c.setColor(color) c.setColor(color)
mainWindow().updateCharacterColor(ID) mainWindow().updateCharacterColor(ID)
def changeCharacterPOVState(self, state):
ID = self.currentCharacterID()
c = self._model.getCharacterByID(ID)
c.setPOVEnabled(state == Qt.Checked)
mainWindow().updateCharacterPOVState(ID)
def addCharacterInfo(self): def addCharacterInfo(self):
self._model.addCharacterInfo(self.currentCharacterID()) self._model.addCharacterInfo(self.currentCharacterID())
def removeCharacterInfo(self): def removeCharacterInfo(self):
self._model.removeCharacterInfo(self.currentCharacterID(), self._model.removeCharacterInfo(self.currentCharacterID())
)
def currentCharacterID(self): def currentCharacterID(self):
ID = None ID = None

View file

@ -5,6 +5,7 @@ from PyQt5.QtGui import QIntValidator
from manuskript.enums import Outline from manuskript.enums import Outline
from manuskript.ui.views.propertiesView_ui import Ui_propertiesView from manuskript.ui.views.propertiesView_ui import Ui_propertiesView
from manuskript.models.characterPOVModel import characterPOVModel
class propertiesView(QWidget, Ui_propertiesView): class propertiesView(QWidget, Ui_propertiesView):
@ -14,7 +15,7 @@ class propertiesView(QWidget, Ui_propertiesView):
self.txtGoal.setColumn(Outline.setGoal) self.txtGoal.setColumn(Outline.setGoal)
def setModels(self, mdlOutline, mdlCharacter, mdlLabels, mdlStatus): def setModels(self, mdlOutline, mdlCharacter, mdlLabels, mdlStatus):
self.cmbPOV.setModels(mdlCharacter, mdlOutline) self.cmbPOV.setModels(characterPOVModel(mdlCharacter), mdlOutline)
self.cmbLabel.setModels(mdlLabels, mdlOutline) self.cmbLabel.setModels(mdlLabels, mdlOutline)
self.cmbStatus.setModels(mdlStatus, mdlOutline) self.cmbStatus.setModels(mdlStatus, mdlOutline)
self.chkCompile.setModel(mdlOutline) self.chkCompile.setModel(mdlOutline)