def forgetDocumentInfo(self): """Called when the user saves a Document. 'Forgets' the basenames and job filename if set, but only if no job is currently running. """ if not jobmanager.isRunning(self.document()): self._jobfile = None self._basenames = None
def setDocumentStatus(self, doc): i = self._items[doc] # set properties according to document i.setText(0, doc.documentName()) if jobmanager.isRunning(doc): icon = 'lilypond-run' elif doc.isModified(): icon = 'document-save' else: icon = 'text-plain' i.setIcon(0, icons.get(icon)) i.setToolTip(0, path(doc.url())) # handle ordering in groups if desired if self._group: self.groupDocument(doc) else: self.sortItems(0, Qt.AscendingOrder)
def setDocumentStatus(self, doc): if doc in self.docs: index = self.docs.index(doc) self.setTabText(index, doc.documentName()) if doc.url().toLocalFile(): tooltip = util.homify(doc.url().toLocalFile()) elif not doc.url().isEmpty(): tooltip = doc.url().toString(QUrl.RemoveUserInfo) else: tooltip = None self.setTabToolTip(index, tooltip) # icon if jobmanager.isRunning(doc): icon = 'lilypond-run' elif doc.isModified(): icon = 'document-save' else: icon = 'text-plain' self.setTabIcon(index, icons.get(icon))
def setDocumentStatus(self, doc): # create accels accels = [self._accels[d] for d in self._accels if d is not doc] name = doc.documentName().replace('&', '&&') for index, char in enumerate(name): if char.isalnum() and char.lower() not in accels: name = name[:index] + '&' + name[index:] self._accels[doc] = char.lower() break else: self._accels[doc] = '' # add [sticky] mark if necessary if doc == engrave.engraver(self.mainwindow()).stickyDocument(): # L10N: 'always engraved': the document is marked as 'Always Engrave' in the LilyPond menu name += " " + _("[always engraved]") self._acts[doc].setText(name) # set the icon if jobmanager.isRunning(doc): icon = icons.get('lilypond-run') elif doc.isModified(): icon = icons.get('document-save') else: icon = QIcon() self._acts[doc].setIcon(icon)
def setDocument(self, doc): self.selectLilyPondInfo(command.info(doc)) if jobmanager.isRunning(doc): self._document = doc self.buttons.button(QDialogButtonBox.Ok).setEnabled(False)
def setDocument(self, doc): self.lilyChooser.setLilyPondInfo(command.info(doc)) if jobmanager.isRunning(doc): self._document = doc self.buttons.button(QDialogButtonBox.Ok).setEnabled(False)