Adds: plot model, not fully functionnal

This commit is contained in:
Olivier Keshavjee 2015-06-21 18:13:14 +02:00
parent 28f6acb30b
commit c7d59cdf90
7 changed files with 460 additions and 245 deletions

View file

@ -24,6 +24,14 @@ class Perso(Enum):
summaryFull = 9
notes = 10
class Plot(Enum):
name = 0
ID = 1
importance = 2
persos = 3
description = 4
result = 5
subplots = 6
class Outline(Enum):
title = 0

View file

@ -53,19 +53,7 @@ def saveStandardItemModelXML(mdl, xml=None):
# Data
data = ET.SubElement(root, "data")
for x in range(mdl.rowCount()):
row = ET.SubElement(data, "row")
row.attrib["row"] = str(x)
for y in range(mdl.columnCount()):
col = ET.SubElement(row, "col")
col.attrib["col"] = str(y)
if mdl.data(mdl.index(x, y), Qt.DecorationRole) != None:
color = iconColor(mdl.data(mdl.index(x, y), Qt.DecorationRole)).name(QColor.HexArgb)
col.attrib["color"] = color if color != "#ff000000" else "#00000000"
if mdl.data(mdl.index(x, y)) != "":
col.text = mdl.data(mdl.index(x, y))
saveItem(data, mdl)
#print(qApp.tr("Saving to {}.").format(xml))
if xml:
@ -73,6 +61,21 @@ def saveStandardItemModelXML(mdl, xml=None):
else:
return ET.tostring(root, encoding="UTF-8", xml_declaration=True, pretty_print=True)
def saveItem(root, mdl, parent=QModelIndex()):
for x in range(mdl.rowCount(parent)):
row = ET.SubElement(root, "row")
row.attrib["row"] = str(x)
for y in range(mdl.columnCount(parent)):
col = ET.SubElement(row, "col")
col.attrib["col"] = str(y)
if mdl.data(mdl.index(x, y, parent), Qt.DecorationRole) != None:
color = iconColor(mdl.data(mdl.index(x, y, parent), Qt.DecorationRole)).name(QColor.HexArgb)
col.attrib["color"] = color if color != "#ff000000" else "#00000000"
if mdl.data(mdl.index(x, y, parent)) != "":
col.text = mdl.data(mdl.index(x, y, parent))
if mdl.hasChildren(mdl.index(x, y, parent)):
saveItem(col, mdl, mdl.index(x, y, parent))
def loadStandardItemModelXML(mdl, xml, fromString=False):
"""Load data to a QStandardItemModel mdl from xml.
@ -105,13 +108,29 @@ def loadStandardItemModelXML(mdl, xml, fromString=False):
mdl.setHorizontalHeaderLabels(hLabels)
#Data
for row in root.find("data").iter("row"):
r = int(row.attrib["row"])
for col in row.iter("col"):
c = int(col.attrib["col"])
if col.text:
mdl.setData(mdl.index(r, c), col.text)
if "color" in col.attrib:
mdl.item(r, c).setIcon(iconFromColorString(col.attrib["color"]))
data = root.find("data")
loadItem(data, mdl)
#print("OK")
#print("OK")
def loadItem(root, mdl, parent=QModelIndex()):
for row in root:
r = int(row.attrib["row"])
for col in row:
c = int(col.attrib["col"])
item = mdl.itemFromIndex(mdl.index(r, c, parent))
if not item:
item = QStandardItem()
mdl.itemFromIndex(parent).setChild(r, c, item)
if col.text:
#mdl.setData(mdl.index(r, c, parent), col.text)
item.setText(col.text)
if "color" in col.attrib:
#mdl.itemFromIndex(mdl.index(r, c, parent)).setIcon(iconFromColorString(col.attrib["color"]))
item.setIcon(iconFromColorString(col.attrib["color"]))
if len(col) != 0:
#loadItem(col, mdl, mdl.index(r, c, parent))
loadItem(col, mdl, mdl.indexFromItem(item))

View file

@ -8,6 +8,7 @@ from ui.helpLabel import helpLabel
from loadSave import *
from enums import *
from models.outlineModel import *
from models.plotModel import *
from models.persosProxyModel import *
from functions import *
from settingsWindow import *
@ -67,20 +68,40 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.mdlFlatData = QStandardItemModel(2, 8)
self.tblDebugFlatData.setModel(self.mdlFlatData)
self.mprSummary = QDataWidgetMapper()
self.mprSummary.setModel(self.mdlFlatData)
self.mprSummary.addMapping(self.txtSummarySituation, 0)
self.mprSummary.addMapping(self.txtSummarySentance, 1)
self.mprSummary.addMapping(self.txtSummarySentance_2, 1)
self.mprSummary.addMapping(self.txtSummaryPara, 2)
self.mprSummary.addMapping(self.txtSummaryPara_2, 2)
self.mprSummary.addMapping(self.txtPlotSummaryPara, 2)
self.mprSummary.addMapping(self.txtSummaryPage, 3)
self.mprSummary.addMapping(self.txtSummaryPage_2, 3)
self.mprSummary.addMapping(self.txtPlotSummaryPage, 3)
self.mprSummary.addMapping(self.txtSummaryFull, 4)
self.mprSummary.addMapping(self.txtPlotSummaryFull, 4)
self.mprSummary.setCurrentIndex(1)
#self.mprSummary = QDataWidgetMapper()
#self.mprSummary.setModel(self.mdlFlatData)
#self.mprSummary.addMapping(self.txtSummarySituation, 0)
#self.mprSummary.addMapping(self.txtSummarySentance, 1)
#self.mprSummary.addMapping(self.txtSummarySentance_2, 1)
#self.mprSummary.addMapping(self.txtSummaryPara, 2)
#self.mprSummary.addMapping(self.txtSummaryPara_2, 2)
#self.mprSummary.addMapping(self.txtPlotSummaryPara, 2)
#self.mprSummary.addMapping(self.txtSummaryPage, 3)
#self.mprSummary.addMapping(self.txtSummaryPage_2, 3)
#self.mprSummary.addMapping(self.txtPlotSummaryPage, 3)
#self.mprSummary.addMapping(self.txtSummaryFull, 4)
#self.mprSummary.addMapping(self.txtPlotSummaryFull, 4)
#self.mprSummary.setCurrentIndex(1)
for widget, col in [
(self.txtSummarySituation, 0),
(self.txtSummarySentance, 1),
(self.txtSummarySentance_2, 1),
(self.txtSummaryPara, 2),
(self.txtSummaryPara_2, 2),
(self.txtPlotSummaryPara, 2),
(self.txtSummaryPage, 3),
(self.txtSummaryPage_2, 3),
(self.txtPlotSummaryPage, 3),
(self.txtSummaryFull, 4),
(self.txtPlotSummaryFull, 4),
]:
widget.setModel(self.mdlFlatData)
widget.setColumn(col)
widget.setCurrentModelIndex(self.mdlFlatData.index(1, col))
self.mprInfos = QDataWidgetMapper()
self.mprInfos.setModel(self.mdlFlatData)
@ -163,6 +184,50 @@ class MainWindow(QMainWindow, Ui_MainWindow):
]:
self.mdlStatus.appendRow(QStandardItem(text))
# Plot
self.mdlPlots = plotModel()
self.lstPlots.setModel(self.mdlPlots.viewModel())
self.lstPlotPerso.setModel(self.mdlPlots.viewModel())
self.lstSubPlots.setModel(self.mdlPlots.viewModel())
self.btnAddPlot.clicked.connect(self.mdlPlots.addPlot)
self.btnRmPlot.clicked.connect(lambda: self.mdlPlots.removePlot(self.lstPlots.currentIndex()))
self.btnAddSubPlot.clicked.connect(self.mdlPlots.addSubPlot)
self.btnRmSubPlot.clicked.connect(self.mdlPlots.removeSubPlot)
self.btnRmPlotPerso.clicked.connect(self.mdlPlots.removePlotPerso)
self.mprPlots = QDataWidgetMapper()
self.mprPlots.setModel(self.mdlPlots)
mapping = [
(self.txtPlotName, Plot.name.value),
(self.txtPlotDescription, Plot.description.value),
(self.txtPlotResult, Plot.result.value),
]
for w, i in mapping:
self.mprPlots.addMapping(w, i)
self.mprPlots.addMapping(self.sldPlotImportance, Plot.importance.value, "importance")
self.sldPlotImportance.importanceChanged.connect(self.mprPlots.submit)
self.tabMain.currentChanged.connect(self.mprPlots.submit)
self.mprPlots.setCurrentIndex(0)
self.lstPlots.selectionModel().currentChanged.connect(self.mprPlots.setCurrentModelIndex)
self.tabPlot.setEnabled(False)
self.lstPlots.selectionModel().currentChanged.connect(lambda: self.tabPlot.setEnabled(self.lstPlots.selectionModel().currentIndex().isValid()))
# sets persos view
self.lstPlots.selectionModel().currentChanged.connect(
lambda: self.lstPlotPerso.setRootIndex(self.mdlPlots.index(
self.lstPlots.selectionModel().currentIndex().row(),
Plot.persos.value)))
# sets subplots view
self.lstPlots.selectionModel().currentChanged.connect(
lambda: self.lstSubPlots.setRootIndex(self.mdlPlots.index(
self.lstPlots.selectionModel().currentIndex().row(),
Plot.subplots.value)))
# Subplot mapper
self.mprSubPlots = QDataWidgetMapper()
self.mprSubPlots.setModel(self.mdlPlots)
self.mprSubPlots.addMapping(self.txtSubPlotSummary, 2)
self.lstPlots.selectionModel().currentChanged.connect(self.mprSubPlots.setRootIndex)
self.lstSubPlots.selectionModel().currentChanged.connect(self.mprSubPlots.setCurrentModelIndex)
# Outline
self.mdlOutline = outlineModel()
self.treeRedacOutline.setModel(self.mdlOutline)
@ -225,6 +290,17 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.tblDebugFlatData.setModel(self.mdlFlatData)
self.tblDebugPersos.setModel(self.mdlPersos)
self.tblDebugPersosInfos.setModel(self.mdlPersosInfos)
self.tblDebugPlots.setModel(self.mdlPlots)
self.tblDebugPlotsPersos.setModel(self.mdlPlots)
self.tblDebugSubPlots.setModel(self.mdlPlots)
self.tblDebugPlots.selectionModel().currentChanged.connect(
lambda: self.tblDebugPlotsPersos.setRootIndex(self.mdlPlots.index(
self.tblDebugPlots.selectionModel().currentIndex().row(),
Plot.persos.value)))
self.tblDebugPlots.selectionModel().currentChanged.connect(
lambda: self.tblDebugSubPlots.setRootIndex(self.mdlPlots.index(
self.tblDebugPlots.selectionModel().currentIndex().row(),
Plot.subplots.value)))
self.treeDebugOutline.setModel(self.mdlOutline)
self.lstDebugLabels.setModel(self.mdlLabels)
self.lstDebugStatus.setModel(self.mdlStatus)
@ -482,6 +558,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
files.append((saveStandardItemModelXML(self.mdlPersosInfos), "persoInfos.xml"))
files.append((saveStandardItemModelXML(self.mdlLabels), "labels.xml"))
files.append((saveStandardItemModelXML(self.mdlStatus), "status.xml"))
files.append((saveStandardItemModelXML(self.mdlPlots), "plots.xml"))
files.append((self.mdlOutline.saveToXML(), "outline.xml"))
files.append((settings.save(),"settings.pickle"))
@ -505,6 +582,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
loadStandardItemModelXML(self.mdlLabels, files["labels.xml"], fromString=True)
if "status.xml" in files:
loadStandardItemModelXML(self.mdlStatus, files["status.xml"], fromString=True)
if "plots.xml" in files:
loadStandardItemModelXML(self.mdlPlots, files["plots.xml"], fromString=True)
if "outline.xml" in files:
self.mdlOutline.loadFromXML(files["outline.xml"], fromString=True)
if "settings.pickle" in files:
@ -669,6 +748,11 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.redacMetadata.toggleSpellcheck(val)
self.outlineItemEditor.toggleSpellcheck(val)
# Find all textEditView from self, and toggle spellcheck
for w in self.findChildren(textEditView, QRegExp(".*"), Qt.FindChildrenRecursively):
w.toggleSpellcheck(val)
####################################################################################################
# SETTINGS #
####################################################################################################

124
src/models/plotModel.py Normal file
View file

@ -0,0 +1,124 @@
#!/usr/bin/env python
#--!-- coding: utf8 --!--
from qt import *
from enums import *
from functions import *
class plotModel(QStandardItemModel):
def __init__(self):
QStandardItemModel.__init__(self, 0, 3)
self.setHorizontalHeaderLabels([i.name for i in Plot])
self.mw = mainWindow()
self.updatePlotPersoButton()
self.mw.mdlPersos.dataChanged.connect(self.updatePlotPersoButton)
def addPlot(self):
p = QStandardItem(self.tr("New plot"))
_id = QStandardItem(self.getUniqueID())
importance = QStandardItem(str(0))
self.appendRow([p, _id, importance])
def getUniqueID(self, parent=QModelIndex()):
"Returns an unused ID"
parentItem = self.itemFromIndex(parent)
vals = []
for i in range(self.rowCount(parent)):
index = self.index(i, Plot.ID.value, parent)
#item = self.item(i, Plot.ID.value)
if index.isValid() and index.data():
vals.append(int(index.data()))
k = 0
while k in vals: k += 1
return str(k)
def removePlot(self, index):
self.takeRow(index.row())
def currentIndex(self):
i = self.mw.lstPlots.selectionModel().currentIndex()
if i .isValid():
return i
else:
return None
def addSubPlot(self):
index = self.currentIndex()
if not index:
return
parent = index.sibling(index.row(), Plot.subplots.value)
parentItem = self.itemFromIndex(parent)
p = QStandardItem(self.tr("New subplot"))
_id = QStandardItem(self.getUniqueID(parent))
summary = QStandardItem()
parentItem.appendRow([p, _id, summary])
def removeSubPlot(self):
index = self.mw.lstSubPlots.currentIndex()
if not index.isValid():
return
parent = index.parent()
parentItem = self.itemFromIndex(parent)
parentItem.takeRow(index.row())
def addPlotPerso(self, v):
if self.currentIndex():
if not self.item(self.currentIndex().row(), Plot.persos.value):
self.setItem(self.currentIndex().row(), Plot.persos.value, QStandardItem())
item = self.item(self.currentIndex().row(), Plot.persos.value)
# We check that the PersoID is not in the list yet
for i in range(item.rowCount()):
if item.child(i).text() == str(v):
return
item.appendRow(QStandardItem(str(v)))
def removePlotPerso(self):
index = self.mw.lstPlotPerso.currentIndex()
if not index.isValid():
return
parent = index.parent()
parentItem = self.itemFromIndex(parent)
parentItem.takeRow(index.row())
def updatePlotPersoButton(self):
menu = QMenu()
menus = []
for i in [self.tr("Main"), self.tr("Secondary"), self.tr("Minor")]:
m = QMenu(i, menu)
menus.append(m)
menu.addMenu(m)
mpr = QSignalMapper(menu)
for i in range(self.mw.mdlPersos.rowCount()):
if self.mw.mdlPersos.item(i, Perso.ID.value):
a = QAction(self.mw.mdlPersos.item(i, Perso.name.value).text(), menu)
a.triggered.connect(mpr.map)
mpr.setMapping(a, int(self.mw.mdlPersos.item(i, Perso.ID.value).text()))
imp = self.mw.mdlPersos.item(i, Perso.importance.value)
if imp:
imp = toInt(imp.text())
else:
imp = 0
menus[2-imp].addAction(a)
mpr.mapped.connect(self.addPlotPerso)
self.mw.btnAddPlotPerso.setMenu(menu)
def viewModel(self):
"Returns proxy model if any, else self"
return self
def flags(self, index):
parent = index.parent()
if parent.isValid(): # this is a subitem
return Qt.ItemIsEnabled | Qt.ItemIsEditable | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled
else:
return QStandardItemModel.flags(self, index)

View file

@ -286,7 +286,7 @@ class Ui_MainWindow(object):
self.formLayout_5.setLayout(3, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout_5)
self.lytSituation = QtWidgets.QVBoxLayout()
self.lytSituation.setObjectName("lytSituation")
self.txtSummarySituation = QtWidgets.QLineEdit(self.lytTabSummary)
self.txtSummarySituation = lineEditView(self.lytTabSummary)
self.txtSummarySituation.setObjectName("txtSummarySituation")
self.lytSituation.addWidget(self.txtSummarySituation)
self.formLayout_5.setLayout(0, QtWidgets.QFormLayout.FieldRole, self.lytSituation)
@ -487,36 +487,30 @@ class Ui_MainWindow(object):
self.groupBox_2.setObjectName("groupBox_2")
self.verticalLayout_10 = QtWidgets.QVBoxLayout(self.groupBox_2)
self.verticalLayout_10.setObjectName("verticalLayout_10")
self.listWidget_3 = QtWidgets.QListWidget(self.groupBox_2)
self.lstPlots = QtWidgets.QListView(self.groupBox_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.listWidget_3.sizePolicy().hasHeightForWidth())
self.listWidget_3.setSizePolicy(sizePolicy)
self.listWidget_3.setDragEnabled(True)
self.listWidget_3.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
self.listWidget_3.setObjectName("listWidget_3")
item = QtWidgets.QListWidgetItem()
self.listWidget_3.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_3.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_3.addItem(item)
self.verticalLayout_10.addWidget(self.listWidget_3)
sizePolicy.setHeightForWidth(self.lstPlots.sizePolicy().hasHeightForWidth())
self.lstPlots.setSizePolicy(sizePolicy)
self.lstPlots.setDragEnabled(True)
self.lstPlots.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
self.lstPlots.setObjectName("lstPlots")
self.verticalLayout_10.addWidget(self.lstPlots)
self.horizontalLayout_15 = QtWidgets.QHBoxLayout()
self.horizontalLayout_15.setObjectName("horizontalLayout_15")
self.pushButton_8 = QtWidgets.QPushButton(self.groupBox_2)
self.pushButton_8.setText("")
self.btnAddPlot = QtWidgets.QPushButton(self.groupBox_2)
self.btnAddPlot.setText("")
icon = QtGui.QIcon.fromTheme("list-add")
self.pushButton_8.setIcon(icon)
self.pushButton_8.setObjectName("pushButton_8")
self.horizontalLayout_15.addWidget(self.pushButton_8)
self.pushButton_11 = QtWidgets.QPushButton(self.groupBox_2)
self.pushButton_11.setText("")
self.btnAddPlot.setIcon(icon)
self.btnAddPlot.setObjectName("btnAddPlot")
self.horizontalLayout_15.addWidget(self.btnAddPlot)
self.btnRmPlot = QtWidgets.QPushButton(self.groupBox_2)
self.btnRmPlot.setText("")
icon = QtGui.QIcon.fromTheme("list-remove")
self.pushButton_11.setIcon(icon)
self.pushButton_11.setObjectName("pushButton_11")
self.horizontalLayout_15.addWidget(self.pushButton_11)
self.btnRmPlot.setIcon(icon)
self.btnRmPlot.setObjectName("btnRmPlot")
self.horizontalLayout_15.addWidget(self.btnRmPlot)
self.lineEdit_7 = QtWidgets.QLineEdit(self.groupBox_2)
self.lineEdit_7.setProperty("clearButtonEnabled", True)
self.lineEdit_7.setObjectName("lineEdit_7")
@ -541,9 +535,9 @@ class Ui_MainWindow(object):
self.label_25 = QtWidgets.QLabel(self.infos_2)
self.label_25.setObjectName("label_25")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.label_25)
self.lineEdit_5 = QtWidgets.QLineEdit(self.infos_2)
self.lineEdit_5.setObjectName("lineEdit_5")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.lineEdit_5)
self.txtPlotName = QtWidgets.QLineEdit(self.infos_2)
self.txtPlotName.setObjectName("txtPlotName")
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.txtPlotName)
self.label_31 = QtWidgets.QLabel(self.infos_2)
self.label_31.setObjectName("label_31")
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.label_31)
@ -553,42 +547,43 @@ class Ui_MainWindow(object):
self.label_27 = QtWidgets.QLabel(self.infos_2)
self.label_27.setObjectName("label_27")
self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.LabelRole, self.label_27)
self.plainTextEdit_22 = QtWidgets.QPlainTextEdit(self.infos_2)
self.plainTextEdit_22.setObjectName("plainTextEdit_22")
self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.plainTextEdit_22)
self.txtPlotDescription = QtWidgets.QPlainTextEdit(self.infos_2)
self.txtPlotDescription.setObjectName("txtPlotDescription")
self.formLayout_2.setWidget(3, QtWidgets.QFormLayout.FieldRole, self.txtPlotDescription)
self.label_28 = QtWidgets.QLabel(self.infos_2)
self.label_28.setObjectName("label_28")
self.formLayout_2.setWidget(4, QtWidgets.QFormLayout.LabelRole, self.label_28)
self.plainTextEdit_23 = QtWidgets.QPlainTextEdit(self.infos_2)
self.plainTextEdit_23.setObjectName("plainTextEdit_23")
self.formLayout_2.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.plainTextEdit_23)
self.txtPlotResult = QtWidgets.QPlainTextEdit(self.infos_2)
self.txtPlotResult.setObjectName("txtPlotResult")
self.formLayout_2.setWidget(4, QtWidgets.QFormLayout.FieldRole, self.txtPlotResult)
self.verticalLayout_12 = QtWidgets.QVBoxLayout()
self.verticalLayout_12.setObjectName("verticalLayout_12")
self.listWidget_4 = QtWidgets.QListWidget(self.infos_2)
self.listWidget_4.setFlow(QtWidgets.QListView.LeftToRight)
self.listWidget_4.setProperty("isWrapping", True)
self.listWidget_4.setObjectName("listWidget_4")
item = QtWidgets.QListWidgetItem()
self.listWidget_4.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_4.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_4.addItem(item)
self.verticalLayout_12.addWidget(self.listWidget_4)
self.lstPlotPerso = QtWidgets.QListView(self.infos_2)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.lstPlotPerso.sizePolicy().hasHeightForWidth())
self.lstPlotPerso.setSizePolicy(sizePolicy)
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()
self.horizontalLayout_16.setObjectName("horizontalLayout_16")
self.pushButton_10 = QtWidgets.QPushButton(self.infos_2)
self.pushButton_10.setText("")
spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_16.addItem(spacerItem9)
self.btnAddPlotPerso = QtWidgets.QPushButton(self.infos_2)
self.btnAddPlotPerso.setText("")
icon = QtGui.QIcon.fromTheme("list-add")
self.pushButton_10.setIcon(icon)
self.pushButton_10.setObjectName("pushButton_10")
self.horizontalLayout_16.addWidget(self.pushButton_10)
self.pushButton_12 = QtWidgets.QPushButton(self.infos_2)
self.pushButton_12.setText("")
self.btnAddPlotPerso.setIcon(icon)
self.btnAddPlotPerso.setObjectName("btnAddPlotPerso")
self.horizontalLayout_16.addWidget(self.btnAddPlotPerso)
self.btnRmPlotPerso = QtWidgets.QPushButton(self.infos_2)
self.btnRmPlotPerso.setText("")
icon = QtGui.QIcon.fromTheme("list-remove")
self.pushButton_12.setIcon(icon)
self.pushButton_12.setObjectName("pushButton_12")
self.horizontalLayout_16.addWidget(self.pushButton_12)
self.btnRmPlotPerso.setIcon(icon)
self.btnRmPlotPerso.setObjectName("btnRmPlotPerso")
self.horizontalLayout_16.addWidget(self.btnRmPlotPerso)
self.verticalLayout_12.addLayout(self.horizontalLayout_16)
self.formLayout_2.setLayout(2, QtWidgets.QFormLayout.FieldRole, self.verticalLayout_12)
self.sldPlotImportance = sldImportance(self.infos_2)
@ -604,32 +599,28 @@ class Ui_MainWindow(object):
self.tab_15.setObjectName("tab_15")
self.verticalLayout_11 = QtWidgets.QVBoxLayout(self.tab_15)
self.verticalLayout_11.setObjectName("verticalLayout_11")
self.listWidget_2 = QtWidgets.QListWidget(self.tab_15)
self.listWidget_2.setObjectName("listWidget_2")
item = QtWidgets.QListWidgetItem()
self.listWidget_2.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_2.addItem(item)
item = QtWidgets.QListWidgetItem()
self.listWidget_2.addItem(item)
self.verticalLayout_11.addWidget(self.listWidget_2)
self.plainTextEdit_7 = QtWidgets.QPlainTextEdit(self.tab_15)
self.plainTextEdit_7.setObjectName("plainTextEdit_7")
self.verticalLayout_11.addWidget(self.plainTextEdit_7)
self.lstSubPlots = QtWidgets.QListView(self.tab_15)
self.lstSubPlots.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove)
self.lstSubPlots.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
self.lstSubPlots.setObjectName("lstSubPlots")
self.verticalLayout_11.addWidget(self.lstSubPlots)
self.txtSubPlotSummary = textEditView(self.tab_15)
self.txtSubPlotSummary.setObjectName("txtSubPlotSummary")
self.verticalLayout_11.addWidget(self.txtSubPlotSummary)
self.horizontalLayout_17 = QtWidgets.QHBoxLayout()
self.horizontalLayout_17.setObjectName("horizontalLayout_17")
self.pushButton_13 = QtWidgets.QPushButton(self.tab_15)
self.pushButton_13.setText("")
self.btnAddSubPlot = QtWidgets.QPushButton(self.tab_15)
self.btnAddSubPlot.setText("")
icon = QtGui.QIcon.fromTheme("list-add")
self.pushButton_13.setIcon(icon)
self.pushButton_13.setObjectName("pushButton_13")
self.horizontalLayout_17.addWidget(self.pushButton_13)
self.pushButton_14 = QtWidgets.QPushButton(self.tab_15)
self.pushButton_14.setText("")
self.btnAddSubPlot.setIcon(icon)
self.btnAddSubPlot.setObjectName("btnAddSubPlot")
self.horizontalLayout_17.addWidget(self.btnAddSubPlot)
self.btnRmSubPlot = QtWidgets.QPushButton(self.tab_15)
self.btnRmSubPlot.setText("")
icon = QtGui.QIcon.fromTheme("list-remove")
self.pushButton_14.setIcon(icon)
self.pushButton_14.setObjectName("pushButton_14")
self.horizontalLayout_17.addWidget(self.pushButton_14)
self.btnRmSubPlot.setIcon(icon)
self.btnRmSubPlot.setObjectName("btnRmSubPlot")
self.horizontalLayout_17.addWidget(self.btnRmSubPlot)
self.line_4 = QtWidgets.QFrame(self.tab_15)
self.line_4.setFrameShape(QtWidgets.QFrame.VLine)
self.line_4.setFrameShadow(QtWidgets.QFrame.Sunken)
@ -664,14 +655,16 @@ class Ui_MainWindow(object):
self.line_5.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line_5.setObjectName("line_5")
self.horizontalLayout_17.addWidget(self.line_5)
self.pushButton_16 = QtWidgets.QPushButton(self.tab_15)
self.pushButton_16.setText("")
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_17.addItem(spacerItem10)
self.btnShowSubPlotSummary = QtWidgets.QPushButton(self.tab_15)
self.btnShowSubPlotSummary.setText("")
icon = QtGui.QIcon.fromTheme("text-x-generic")
self.pushButton_16.setIcon(icon)
self.pushButton_16.setCheckable(True)
self.pushButton_16.setChecked(True)
self.pushButton_16.setObjectName("pushButton_16")
self.horizontalLayout_17.addWidget(self.pushButton_16)
self.btnShowSubPlotSummary.setIcon(icon)
self.btnShowSubPlotSummary.setCheckable(True)
self.btnShowSubPlotSummary.setChecked(True)
self.btnShowSubPlotSummary.setObjectName("btnShowSubPlotSummary")
self.horizontalLayout_17.addWidget(self.btnShowSubPlotSummary)
self.verticalLayout_11.addLayout(self.horizontalLayout_17)
self.tabPlot.addTab(self.tab_15, "")
self.grpPlotSummary = QtWidgets.QGroupBox(self.splitterPlot)
@ -779,8 +772,8 @@ class Ui_MainWindow(object):
self.btnPlanRemoveItem.setIcon(icon)
self.btnPlanRemoveItem.setObjectName("btnPlanRemoveItem")
self.horizontalLayout_18.addWidget(self.btnPlanRemoveItem)
spacerItem9 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_18.addItem(spacerItem9)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_18.addItem(spacerItem11)
self.btnPlanShowDetails = QtWidgets.QPushButton(self.layoutWidget)
self.btnPlanShowDetails.setText("")
icon = QtGui.QIcon.fromTheme("text-x-generic")
@ -827,8 +820,8 @@ class Ui_MainWindow(object):
self.btnRedacRemoveItem.setIcon(icon)
self.btnRedacRemoveItem.setObjectName("btnRedacRemoveItem")
self.horizontalLayout_31.addWidget(self.btnRedacRemoveItem)
spacerItem10 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_31.addItem(spacerItem10)
spacerItem12 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_31.addItem(spacerItem12)
self.verticalLayout_30.addLayout(self.horizontalLayout_31)
self.layoutWidget1 = QtWidgets.QWidget(self.splitterRedac)
self.layoutWidget1.setObjectName("layoutWidget1")
@ -875,8 +868,8 @@ class Ui_MainWindow(object):
self.sldCorkSizeFactor.setOrientation(QtCore.Qt.Horizontal)
self.sldCorkSizeFactor.setObjectName("sldCorkSizeFactor")
self.horizontalLayout_19.addWidget(self.sldCorkSizeFactor)
spacerItem11 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_19.addItem(spacerItem11)
spacerItem13 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_19.addItem(spacerItem13)
self.lblRedacWC = QtWidgets.QLabel(self.layoutWidget1)
self.lblRedacWC.setMinimumSize(QtCore.QSize(10, 0))
self.lblRedacWC.setText("")
@ -981,6 +974,23 @@ class Ui_MainWindow(object):
self.tblDebugPersosInfos.setObjectName("tblDebugPersosInfos")
self.horizontalLayout_28.addWidget(self.tblDebugPersosInfos)
self.tabWidget.addTab(self.tab_16, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.horizontalLayout_11 = QtWidgets.QHBoxLayout(self.tab_2)
self.horizontalLayout_11.setObjectName("horizontalLayout_11")
self.tblDebugPlots = QtWidgets.QTableView(self.tab_2)
self.tblDebugPlots.setObjectName("tblDebugPlots")
self.horizontalLayout_11.addWidget(self.tblDebugPlots)
self.verticalLayout_22 = QtWidgets.QVBoxLayout()
self.verticalLayout_22.setObjectName("verticalLayout_22")
self.tblDebugPlotsPersos = QtWidgets.QTableView(self.tab_2)
self.tblDebugPlotsPersos.setObjectName("tblDebugPlotsPersos")
self.verticalLayout_22.addWidget(self.tblDebugPlotsPersos)
self.tblDebugSubPlots = QtWidgets.QTableView(self.tab_2)
self.tblDebugSubPlots.setObjectName("tblDebugSubPlots")
self.verticalLayout_22.addWidget(self.tblDebugSubPlots)
self.horizontalLayout_11.addLayout(self.verticalLayout_22)
self.tabWidget.addTab(self.tab_2, "")
self.tab_20 = QtWidgets.QWidget()
self.tab_20.setObjectName("tab_20")
self.horizontalLayout_32 = QtWidgets.QHBoxLayout(self.tab_20)
@ -1110,12 +1120,11 @@ class Ui_MainWindow(object):
self.tabMain.setCurrentIndex(1)
self.tabSummary.setCurrentIndex(0)
self.tabPersos.setCurrentIndex(0)
self.tabPlot.setCurrentIndex(0)
self.tabPlot.setCurrentIndex(1)
self.comboBox_2.setCurrentIndex(0)
self.stkPlotSummary.setCurrentIndex(0)
self.tabRedacInfos.setCurrentIndex(0)
self.tabWidget.setCurrentIndex(4)
self.pushButton_16.toggled['bool'].connect(self.plainTextEdit_7.setVisible)
self.tabWidget.setCurrentIndex(3)
self.btnPlotShowSummary.toggled['bool'].connect(self.grpPlotSummary.setVisible)
self.comboBox_2.currentIndexChanged['int'].connect(self.stkPlotSummary.setCurrentIndex)
self.btnPlanShowDetails.toggled['bool'].connect(self.frame.setVisible)
@ -1178,40 +1187,13 @@ class Ui_MainWindow(object):
self.tabPersos.setTabText(self.tabPersos.indexOf(self.tab_12), _translate("MainWindow", "Detailed infos"))
self.tabMain.setTabText(self.tabMain.indexOf(self.lytTabPersos), _translate("MainWindow", "Characters"))
self.groupBox_2.setTitle(_translate("MainWindow", "Plots"))
__sortingEnabled = self.listWidget_3.isSortingEnabled()
self.listWidget_3.setSortingEnabled(False)
item = self.listWidget_3.item(0)
item.setText(_translate("MainWindow", "Principale"))
item = self.listWidget_3.item(1)
item.setText(_translate("MainWindow", "Autre intrigue"))
item = self.listWidget_3.item(2)
item.setText(_translate("MainWindow", "Autre intrigue"))
self.listWidget_3.setSortingEnabled(__sortingEnabled)
self.lineEdit_7.setPlaceholderText(_translate("MainWindow", "Filter"))
self.label_25.setText(_translate("MainWindow", "Plot"))
self.label_31.setText(_translate("MainWindow", "Importance"))
self.label_26.setText(_translate("MainWindow", "Character(s)"))
self.label_27.setText(_translate("MainWindow", "Description"))
self.label_28.setText(_translate("MainWindow", "Result"))
__sortingEnabled = self.listWidget_4.isSortingEnabled()
self.listWidget_4.setSortingEnabled(False)
item = self.listWidget_4.item(0)
item.setText(_translate("MainWindow", "Albert"))
item = self.listWidget_4.item(1)
item.setText(_translate("MainWindow", "Sylvestre"))
item = self.listWidget_4.item(2)
item.setText(_translate("MainWindow", "Gentiana"))
self.listWidget_4.setSortingEnabled(__sortingEnabled)
self.tabPlot.setTabText(self.tabPlot.indexOf(self.infos_2), _translate("MainWindow", "Basic infos"))
__sortingEnabled = self.listWidget_2.isSortingEnabled()
self.listWidget_2.setSortingEnabled(False)
item = self.listWidget_2.item(0)
item.setText(_translate("MainWindow", "Un bâteau arrive au port et personne ne sait pourquoi"))
item = self.listWidget_2.item(1)
item.setText(_translate("MainWindow", "Le roi envoie des émissaires à bord. Ils ne reviennent jamais."))
item = self.listWidget_2.item(2)
item.setText(_translate("MainWindow", "Le roi envoie son armée."))
self.listWidget_2.setSortingEnabled(__sortingEnabled)
self.tabPlot.setTabText(self.tabPlot.indexOf(self.tab_15), _translate("MainWindow", "Resolution steps"))
self.grpPlotSummary.setTitle(_translate("MainWindow", "Summary"))
self.comboBox_2.setItemText(0, _translate("MainWindow", "One paragraph"))
@ -1253,6 +1235,7 @@ class Ui_MainWindow(object):
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_9), _translate("MainWindow", "FlatData"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_10), _translate("MainWindow", "Persos"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_16), _translate("MainWindow", "Perso Infos"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("MainWindow", "Plots"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_20), _translate("MainWindow", "Outline"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("MainWindow", "Labels"))
self.tabMain.setTabText(self.tabMain.indexOf(self.lytTabDebug), _translate("MainWindow", "Debug"))
@ -1289,11 +1272,11 @@ class Ui_MainWindow(object):
self.actSettings.setText(_translate("MainWindow", "Settings"))
self.actSettings.setShortcut(_translate("MainWindow", "F8"))
from ui.views.lineEditView import lineEditView
from ui.views.metadataView import metadataView
from ui.views.basicItemView import basicItemView
from ui.editors.editorWidget import editorWidget
from ui.sldImportance import sldImportance
from ui.views.treeView import treeView
from ui.views.outlineView import outlineView
from ui.editors.editorWidget import editorWidget
from ui.views.lineEditView import lineEditView
from ui.views.basicItemView import basicItemView
from ui.views.metadataView import metadataView
from ui.views.textEditView import textEditView
from ui.views.outlineView import outlineView
from ui.sldImportance import sldImportance

View file

@ -545,7 +545,7 @@
<item row="0" column="1">
<layout class="QVBoxLayout" name="lytSituation">
<item>
<widget class="QLineEdit" name="txtSummarySituation">
<widget class="lineEditView" name="txtSummarySituation">
<property name="placeholderText">
<string>What if...?</string>
</property>
@ -928,7 +928,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
<widget class="QListWidget" name="listWidget_3">
<widget class="QListView" name="lstPlots">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
@ -941,27 +941,12 @@
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<item>
<property name="text">
<string>Principale</string>
</property>
</item>
<item>
<property name="text">
<string>Autre intrigue</string>
</property>
</item>
<item>
<property name="text">
<string>Autre intrigue</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_15">
<item>
<widget class="QPushButton" name="pushButton_8">
<widget class="QPushButton" name="btnAddPlot">
<property name="text">
<string/>
</property>
@ -973,7 +958,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_11">
<widget class="QPushButton" name="btnRmPlot">
<property name="text">
<string/>
</property>
@ -1018,7 +1003,7 @@
</widget>
<widget class="QTabWidget" name="tabPlot">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<property name="documentMode">
<bool>true</bool>
@ -1039,7 +1024,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="lineEdit_5"/>
<widget class="QLineEdit" name="txtPlotName"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_31">
@ -1063,7 +1048,7 @@
</widget>
</item>
<item row="3" column="1">
<widget class="QPlainTextEdit" name="plainTextEdit_22"/>
<widget class="QPlainTextEdit" name="txtPlotDescription"/>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_28">
@ -1073,39 +1058,43 @@
</widget>
</item>
<item row="4" column="1">
<widget class="QPlainTextEdit" name="plainTextEdit_23"/>
<widget class="QPlainTextEdit" name="txtPlotResult"/>
</item>
<item row="2" column="1">
<layout class="QVBoxLayout" name="verticalLayout_12">
<item>
<widget class="QListWidget" name="listWidget_4">
<property name="flow">
<enum>QListView::LeftToRight</enum>
<widget class="QListView" name="lstPlotPerso">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="isWrapping" stdset="0">
<bool>true</bool>
<property name="movement">
<enum>QListView::Static</enum>
</property>
<property name="viewMode">
<enum>QListView::IconMode</enum>
</property>
<item>
<property name="text">
<string>Albert</string>
</property>
</item>
<item>
<property name="text">
<string>Sylvestre</string>
</property>
</item>
<item>
<property name="text">
<string>Gentiana</string>
</property>
</item>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_16">
<item>
<widget class="QPushButton" name="pushButton_10">
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnAddPlotPerso">
<property name="text">
<string/>
</property>
@ -1117,7 +1106,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_12">
<widget class="QPushButton" name="btnRmPlotPerso">
<property name="text">
<string/>
</property>
@ -1150,31 +1139,22 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_11">
<item>
<widget class="QListWidget" name="listWidget_2">
<item>
<property name="text">
<string>Un bâteau arrive au port et personne ne sait pourquoi</string>
</property>
</item>
<item>
<property name="text">
<string>Le roi envoie des émissaires à bord. Ils ne reviennent jamais.</string>
</property>
</item>
<item>
<property name="text">
<string>Le roi envoie son armée.</string>
</property>
</item>
<widget class="QListView" name="lstSubPlots">
<property name="dragDropMode">
<enum>QAbstractItemView::InternalMove</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="plainTextEdit_7"/>
<widget class="textEditView" name="txtSubPlotSummary"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_17">
<item>
<widget class="QPushButton" name="pushButton_13">
<widget class="QPushButton" name="btnAddSubPlot">
<property name="text">
<string/>
</property>
@ -1186,7 +1166,7 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_14">
<widget class="QPushButton" name="btnRmSubPlot">
<property name="text">
<string/>
</property>
@ -1260,7 +1240,20 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_16">
<spacer name="horizontalSpacer_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btnShowSubPlotSummary">
<property name="text">
<string/>
</property>
@ -1871,7 +1864,7 @@
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>4</number>
<number>3</number>
</property>
<widget class="QWidget" name="tab_9">
<attribute name="title">
@ -1907,6 +1900,26 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">
<attribute name="title">
<string>Plots</string>
</attribute>
<layout class="QHBoxLayout" name="horizontalLayout_11">
<item>
<widget class="QTableView" name="tblDebugPlots"/>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_22">
<item>
<widget class="QTableView" name="tblDebugPlotsPersos"/>
</item>
<item>
<widget class="QTableView" name="tblDebugSubPlots"/>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_20">
<attribute name="title">
<string>Outline</string>
@ -2234,22 +2247,6 @@
</customwidgets>
<resources/>
<connections>
<connection>
<sender>pushButton_16</sender>
<signal>toggled(bool)</signal>
<receiver>plainTextEdit_7</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>435</x>
<y>127</y>
</hint>
<hint type="destinationlabel">
<x>435</x>
<y>120</y>
</hint>
</hints>
</connection>
<connection>
<sender>btnPlotShowSummary</sender>
<signal>toggled(bool)</signal>

View file

@ -50,14 +50,14 @@ class lineEditView(QLineEdit):
def submit(self):
if self._index:
item = self._index.internalPointer()
if self.text() != item.data(self._column):
if self.text() != self._model.data(self._index):
self._model.setData(self._index, self.text())
elif self._indexes:
self._updating = True
for i in self._indexes:
item = i.internalPointer()
if self.text() != item.data(self._column):
if self.text() != self._model.data(i):
self._model.setData(i, self.text())
self._updating = False