mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 19:32:30 +12:00
Changes subplots to steps
This commit is contained in:
parent
599a60ecff
commit
8949d7b8e3
|
@ -29,10 +29,10 @@ class Plot(Enum):
|
|||
characters = 3
|
||||
description = 4
|
||||
result = 5
|
||||
subplots = 6
|
||||
steps = 6
|
||||
summary = 7
|
||||
|
||||
class Subplot(Enum):
|
||||
class PlotStep(Enum):
|
||||
name = 0
|
||||
ID = 1
|
||||
meta = 2
|
||||
|
|
|
@ -347,8 +347,8 @@ def addPlotItem(root, mdl, parent=QModelIndex()):
|
|||
else:
|
||||
outline.attrib.pop(Plot.characters.name)
|
||||
|
||||
elif y == Plot.subplots.value and mdl.hasChildren(index):
|
||||
outline.attrib.pop(Plot.subplots.name)
|
||||
elif y == Plot.steps.value and mdl.hasChildren(index):
|
||||
outline.attrib.pop(Plot.steps.name)
|
||||
|
||||
|
||||
# addWorldItem(outline, mdl, index)
|
||||
|
|
|
@ -9,7 +9,7 @@ from PyQt5.QtWidgets import QMainWindow, QHeaderView, qApp, QMenu, QActionGroup,
|
|||
QLabel
|
||||
|
||||
from manuskript import settings
|
||||
from manuskript.enums import Character, Subplot, Plot, World
|
||||
from manuskript.enums import Character, PlotStep, Plot, World
|
||||
from manuskript.functions import AUC, wordCount, appPath
|
||||
from manuskript.loadSave import saveProject, loadProject
|
||||
from manuskript.models.characterModel import characterModel
|
||||
|
@ -206,7 +206,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.sldPlotImportance.setCurrentModelIndex(index)
|
||||
self.lstPlotPerso.setRootIndex(index.sibling(index.row(),
|
||||
Plot.characters.value))
|
||||
subplotindex = index.sibling(index.row(), Plot.subplots.value)
|
||||
subplotindex = index.sibling(index.row(), Plot.steps.value)
|
||||
self.lstSubPlots.setRootIndex(subplotindex)
|
||||
if self.mdlPlots.rowCount(subplotindex):
|
||||
self.updateSubPlotView()
|
||||
|
@ -222,18 +222,18 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
# Hide columns
|
||||
for i in range(self.mdlPlots.columnCount()):
|
||||
self.lstSubPlots.hideColumn(i)
|
||||
self.lstSubPlots.showColumn(Subplot.name.value)
|
||||
self.lstSubPlots.showColumn(Subplot.meta.value)
|
||||
self.lstSubPlots.showColumn(PlotStep.name.value)
|
||||
self.lstSubPlots.showColumn(PlotStep.meta.value)
|
||||
|
||||
self.lstSubPlots.horizontalHeader().setSectionResizeMode(
|
||||
Subplot.name.value, QHeaderView.Stretch)
|
||||
PlotStep.name.value, QHeaderView.Stretch)
|
||||
self.lstSubPlots.horizontalHeader().setSectionResizeMode(
|
||||
Subplot.meta.value, QHeaderView.ResizeToContents)
|
||||
PlotStep.meta.value, QHeaderView.ResizeToContents)
|
||||
self.lstSubPlots.verticalHeader().hide()
|
||||
|
||||
def changeCurrentSubPlot(self, index):
|
||||
# Got segfaults when using textEditView model system, so ad hoc stuff.
|
||||
index = index.sibling(index.row(), Subplot.summary.value)
|
||||
index = index.sibling(index.row(), PlotStep.summary.value)
|
||||
item = self.mdlPlots.itemFromIndex(index)
|
||||
if not item:
|
||||
self.txtSubPlotSummary.setEnabled(False)
|
||||
|
@ -251,7 +251,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
index = self.lstSubPlots.currentIndex()
|
||||
if not index.isValid():
|
||||
return
|
||||
index = index.sibling(index.row(), Subplot.summary.value)
|
||||
index = index.sibling(index.row(), PlotStep.summary.value)
|
||||
item = self.mdlPlots.itemFromIndex(index)
|
||||
|
||||
self._updatingSubPlot = True
|
||||
|
@ -608,7 +608,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.plotCharacterDelegate = outlineCharacterDelegate(self.mdlCharacter, self)
|
||||
self.lstPlotPerso.setItemDelegate(self.plotCharacterDelegate)
|
||||
self.plotDelegate = plotDelegate(self)
|
||||
self.lstSubPlots.setItemDelegateForColumn(Subplot.meta.value, self.plotDelegate)
|
||||
self.lstSubPlots.setItemDelegateForColumn(PlotStep.meta.value, self.plotDelegate)
|
||||
|
||||
# World
|
||||
self.treeWorld.setModel(self.mdlWorld)
|
||||
|
@ -682,7 +682,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||
self.tblDebugPlots.selectionModel().currentChanged.connect(
|
||||
lambda: self.tblDebugSubPlots.setRootIndex(self.mdlPlots.index(
|
||||
self.tblDebugPlots.selectionModel().currentIndex().row(),
|
||||
Plot.subplots.value)), AUC)
|
||||
Plot.steps.value)), AUC)
|
||||
self.treeDebugWorld.setModel(self.mdlWorld)
|
||||
self.treeDebugOutline.setModel(self.mdlOutline)
|
||||
self.lstDebugLabels.setModel(self.mdlLabels)
|
||||
|
|
|
@ -9,7 +9,7 @@ from PyQt5.QtGui import QStandardItemModel
|
|||
from PyQt5.QtWidgets import QAction, QMenu
|
||||
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.enums import Subplot
|
||||
from manuskript.enums import PlotStep
|
||||
from manuskript.functions import toInt, mainWindow
|
||||
|
||||
|
||||
|
@ -37,7 +37,7 @@ class plotModel(QStandardItemModel):
|
|||
index = self.getIndexFromID(ID)
|
||||
if not index.isValid():
|
||||
return
|
||||
index = index.sibling(index.row(), Plot.subplots.value)
|
||||
index = index.sibling(index.row(), Plot.steps.value)
|
||||
item = self.itemFromIndex(index)
|
||||
lst = []
|
||||
for i in range(item.rowCount()):
|
||||
|
@ -86,8 +86,8 @@ class plotModel(QStandardItemModel):
|
|||
p = QStandardItem(self.tr("New plot"))
|
||||
_id = QStandardItem(self.getUniqueID())
|
||||
importance = QStandardItem(str(0))
|
||||
self.appendRow([p, _id, importance, QStandardItem("Persos"),
|
||||
QStandardItem(), QStandardItem(), QStandardItem("Subplots")])
|
||||
self.appendRow([p, _id, importance, QStandardItem("Characters"),
|
||||
QStandardItem(), QStandardItem(), QStandardItem("Resolution steps")])
|
||||
|
||||
def getUniqueID(self, parent=QModelIndex()):
|
||||
"""Returns an unused ID"""
|
||||
|
@ -114,9 +114,9 @@ class plotModel(QStandardItemModel):
|
|||
def headerData(self, section, orientation, role=Qt.DisplayRole):
|
||||
if role == Qt.DisplayRole:
|
||||
if orientation == Qt.Horizontal:
|
||||
if section == Subplot.name.value:
|
||||
if section == PlotStep.name.value:
|
||||
return self.tr("Name")
|
||||
elif section == Subplot.meta.value:
|
||||
elif section == PlotStep.meta.value:
|
||||
return self.tr("Meta")
|
||||
else:
|
||||
return ""
|
||||
|
@ -127,8 +127,8 @@ class plotModel(QStandardItemModel):
|
|||
|
||||
def data(self, index, role=Qt.DisplayRole):
|
||||
if index.parent().isValid() and \
|
||||
index.parent().column() == Plot.subplots.value and \
|
||||
index.column() == Subplot.meta.value:
|
||||
index.parent().column() == Plot.steps.value and \
|
||||
index.column() == PlotStep.meta.value:
|
||||
if role == Qt.TextAlignmentRole:
|
||||
return Qt.AlignRight | Qt.AlignVCenter
|
||||
elif role == Qt.ForegroundRole:
|
||||
|
@ -144,13 +144,13 @@ class plotModel(QStandardItemModel):
|
|||
if not index.isValid():
|
||||
return
|
||||
|
||||
parent = index.sibling(index.row(), Plot.subplots.value)
|
||||
parentItem = self.item(index.row(), Plot.subplots.value)
|
||||
parent = index.sibling(index.row(), Plot.steps.value)
|
||||
parentItem = self.item(index.row(), Plot.steps.value)
|
||||
|
||||
if not parentItem:
|
||||
return
|
||||
|
||||
p = QStandardItem(self.tr("New subplot"))
|
||||
p = QStandardItem(self.tr("New step"))
|
||||
_id = QStandardItem(self.getUniqueID(parent))
|
||||
summary = QStandardItem()
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ from PyQt5.QtWidgets import qApp
|
|||
from manuskript.enums import Outline
|
||||
from manuskript.enums import Character
|
||||
from manuskript.enums import Plot
|
||||
from manuskript.enums import Subplot
|
||||
from manuskript.enums import PlotStep
|
||||
from manuskript.functions import mainWindow
|
||||
|
||||
RegEx = r"{(\w):(\d+):?.*?}"
|
||||
|
@ -288,12 +288,12 @@ def infos(ref):
|
|||
|
||||
# Resolution steps
|
||||
steps = ""
|
||||
item = m.item(index.row(), Plot.subplots.value)
|
||||
item = m.item(index.row(), Plot.steps.value)
|
||||
if item:
|
||||
for r in range(item.rowCount()):
|
||||
title = item.child(r, Subplot.name.value).text()
|
||||
summary = item.child(r, Subplot.summary.value).text()
|
||||
meta = item.child(r, Subplot.meta.value).text()
|
||||
title = item.child(r, PlotStep.name.value).text()
|
||||
summary = item.child(r, PlotStep.summary.value).text()
|
||||
meta = item.child(r, PlotStep.meta.value).text()
|
||||
if meta:
|
||||
meta = " <span style='color:gray;'>({})</span>".format(meta)
|
||||
steps += "<li><b>{title}</b>{summary}{meta}</li>".format(
|
||||
|
|
Loading…
Reference in a new issue