def loadEmptyDatas(self): self.mdlFlatData = QStandardItemModel(self) self.mdlCharacter = characterModel(self) # self.mdlPersosProxy = persosProxyModel(self) # self.mdlPersosInfos = QStandardItemModel(self) self.mdlLabels = QStandardItemModel(self) self.mdlStatus = QStandardItemModel(self) self.mdlPlots = plotModel(self) self.mdlOutline = outlineModel(self) self.mdlWorld = worldModel(self)
def loadEmptyDatas(self): self.mdlFlatData = QStandardItemModel(self) self.mdlPersos = persosModel(self) # self.mdlPersosProxy = persosProxyModel(self) # self.mdlPersosInfos = QStandardItemModel(self) self.mdlLabels = QStandardItemModel(self) self.mdlStatus = QStandardItemModel(self) self.mdlPlots = plotModel(self) self.mdlOutline = outlineModel(self) self.mdlWorld = worldModel(self)
def loadDefaultDatas(self): # Empty settings imp.reload(settings) settings.initDefaultValues() if self.template: t = [i for i in self._templates if i[0] == self.template[0]] if t and t[0][2] == "Non-fiction": settings.viewMode = "simple" # Tasks self.mw.mdlFlatData = QStandardItemModel(2, 8, self.mw) # Persos # self.mw.mdlPersos = QStandardItemModel(0, 0, self.mw) self.mw.mdlCharacter = characterModel(self.mw) # self.mdlPersosProxy = None # persosProxyModel() # None # self.mw.mdlPersosProxy = persosProxyModel(self.mw) # self.mw.mdlPersosInfos = QStandardItemModel(1, 0, self.mw) # self.mw.mdlPersosInfos.insertColumn(0, [QStandardItem("ID")]) # self.mw.mdlPersosInfos.setHorizontalHeaderLabels(["Description"]) # Labels self.mw.mdlLabels = QStandardItemModel(self.mw) for color, text in [(Qt.transparent, ""), (Qt.yellow, self.tr("Idea")), (Qt.green, self.tr("Note")), (Qt.blue, self.tr("Chapter")), (Qt.red, self.tr("Scene")), (Qt.cyan, self.tr("Research"))]: self.mw.mdlLabels.appendRow( QStandardItem(iconFromColor(color), text)) # Status self.mw.mdlStatus = QStandardItemModel(self.mw) for text in [ "", self.tr("TODO"), self.tr("First draft"), self.tr("Second draft"), self.tr("Final") ]: self.mw.mdlStatus.appendRow(QStandardItem(text)) # Plot self.mw.mdlPlots = plotModel(self.mw) # Outline self.mw.mdlOutline = outlineModel(self.mw) # World self.mw.mdlWorld = worldModel(self.mw) root = self.mw.mdlOutline.rootItem _type = "md" def addElement(parent, datas): if len(datas) == 2 and datas[1][1] == None or \ len(datas) == 1: # Next item is word count n = 0 for i in range(datas[0][0]): n += 1 item = outlineItem(title="{} {}".format( datas[0][1], str(n)), _type=_type, parent=parent) if len(datas) == 2: item.setData(Outline.setGoal, datas[1][0]) # parent.appendChild(item) else: n = 0 for i in range(datas[0][0]): n += 1 item = outlineItem(title="{} {}".format( datas[0][1], str(n)), _type="folder", parent=parent) # parent.appendChild(item) addElement(item, datas[1:]) if self.template and self.template[1]: addElement(root, self.template[1])
def loadDefaultDatas(self): # Empty settings imp.reload(settings) settings.initDefaultValues() if self.template: t = [i for i in self._templates if i[0] == self.template[0]] if t and t[0][2] == "Non-fiction": settings.viewMode = "simple" # Tasks self.mw.mdlFlatData = QStandardItemModel(2, 8, self.mw) # Persos # self.mw.mdlPersos = QStandardItemModel(0, 0, self.mw) self.mw.mdlCharacter = characterModel(self.mw) # self.mdlPersosProxy = None # persosProxyModel() # None # self.mw.mdlPersosProxy = persosProxyModel(self.mw) # self.mw.mdlPersosInfos = QStandardItemModel(1, 0, self.mw) # self.mw.mdlPersosInfos.insertColumn(0, [QStandardItem("ID")]) # self.mw.mdlPersosInfos.setHorizontalHeaderLabels(["Description"]) # Labels self.mw.mdlLabels = QStandardItemModel(self.mw) for color, text in [ (Qt.transparent, ""), (Qt.yellow, self.tr("Idea")), (Qt.green, self.tr("Note")), (Qt.blue, self.tr("Chapter")), (Qt.red, self.tr("Scene")), (Qt.cyan, self.tr("Research")) ]: self.mw.mdlLabels.appendRow(QStandardItem(iconFromColor(color), text)) # Status self.mw.mdlStatus = QStandardItemModel(self.mw) for text in [ "", self.tr("TODO"), self.tr("First draft"), self.tr("Second draft"), self.tr("Final") ]: self.mw.mdlStatus.appendRow(QStandardItem(text)) # Plot self.mw.mdlPlots = plotModel(self.mw) # Outline self.mw.mdlOutline = outlineModel(self.mw) # World self.mw.mdlWorld = worldModel(self.mw) root = self.mw.mdlOutline.rootItem _type = "md" def addElement(parent, datas): if len(datas) == 2 and datas[1][1] == None or \ len(datas) == 1: # Next item is word count n = 0 for i in range(datas[0][0]): n += 1 item = outlineItem(title="{} {}".format( datas[0][1], str(n)), _type=_type, parent=parent) if len(datas) == 2: item.setData(Outline.setGoal, datas[1][0]) # parent.appendChild(item) else: n = 0 for i in range(datas[0][0]): n += 1 item = outlineItem(title="{} {}".format( datas[0][1], str(n)), _type="folder", parent=parent) # parent.appendChild(item) addElement(item, datas[1:]) if self.template and self.template[1]: addElement(root, self.template[1])