def setDocumentStatus(self, doc): if doc in self.docs: index = self.docs.index(doc) text = doc.documentName().replace('&', '&&') if self.tabText(index) != text: self.setTabText(index, text) tooltip = util.path(doc.url()) self.setTabToolTip(index, tooltip) self.setTabIcon(index, documenticon.icon(doc, self.window()))
def setDocumentStatus(self, doc): if doc in self.docs: index = self.docs.index(doc) self.setTabText(index, doc.documentName().replace('&', '&&')) 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) self.setTabIcon(index, documenticon.icon(doc, self.window()))
def setDocumentStatus(self, doc): try: i = self._items[doc] except KeyError: # this fails when a document is closed that had a job running, # in that case setDocumentStatus is called twice (the second time # when the job quits, but then we already removed the document) return # set properties according to document i.setText(0, doc.documentName()) i.setIcon(0, documenticon.icon(doc, self.parentWidget().mainwindow())) 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): # 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) icon = documenticon.icon(doc, self.mainwindow()) if icon.name() == "text-plain": icon = QIcon() self._acts[doc].setIcon(icon)