def restoreNextSelect(self): """Go forward to the most recent saved selection""" self.validateHistory() if self.nextSelects: for item in self.nextSelects[-1]: item.openParents(False) globalref.updateViewItem(item) self.prevSelects.append(list(self)) self[:] = self.nextSelects.pop(-1) globalref.updateViewSelection() else: globalref.updateViewMenuStat()
def readChange(self): """Update doc from edit view contents""" textList = filter(None, [u' '.join(text.split()) for text in unicode(self.toPlainText()).split('\n')]) if self.showChildren and len(globalref.docRef.selection) == 1: globalref.docRef.selection[0].editChildList(textList) globalref.docRef.selection.validateHistory() elif not self.showChildren and \ len(globalref.docRef.selection) == len(textList): for item, text in zip(globalref.docRef.selection, textList): if item.title() != text and item.setTitle(text, True): globalref.updateViewItem(item) else: self.updateView() # remove illegal changes globalref.updateViewMenuStat()
def saveChanges(self): """Update option data with current dialog settings""" newLines = [unicode(editor.text()) for editor in self.textEdits] prevLines = self.fileInfoFormat.getLines() prevLines.extend([''] * (6 - len(prevLines))) self.fileInfoFormat.lineList = [] for num, (newLine, prevLine) in enumerate(zip(newLines, prevLines)): if newLine: self.fileInfoFormat.insertLine(newLine, num) if newLine != prevLine: self.fileInfoFormatModified = True if self.fileInfoFormatModified: globalref.docRef.undoStore.addFormatUndo(globalref.docRef. treeFormats, globalref.docRef. fileInfoFormat, {}, {}) globalref.docRef.treeFormats[self.fileInfoFormat.name] = \ self.fileInfoFormat globalref.docRef.fileInfoFormat = self.fileInfoFormat globalref.docRef.treeFormats.updateAllLineFields() globalref.docRef.modified = True globalref.updateViewMenuStat() self.fileInfoFormatModified = False
def checkTitleChange(self): """Update item title based on signal""" globalref.updateViewItem(self.item) self.setTitle(self.item.formatName) self.titleLabel.setText(self.item.title()) globalref.updateViewMenuStat()
def setDocModified(self, value): """A value of True sets the document status to modified, a value of False is unmodified""" globalref.docRef.modified = value globalref.updateViewMenuStat()