def loadLilyPondVersions(self): infos = lilypondinfo.infos() or [lilypondinfo.default()] infos.sort(key = lambda i: i.version() or (999,)) self._infos = infos index = self.versionCombo.currentIndex() self.versionCombo.clear() for i in infos: icon = 'lilypond-run' if i.version() else 'dialog-error' self.versionCombo.addItem(icons.get(icon), i.prettyName()) self.versionCombo.setCurrentIndex(index)
def loadLilyPondVersions(self): infos = lilypondinfo.infos() or [lilypondinfo.default()] infos.sort(key = lambda i: i.version() or (999,)) self._infos = infos index = self.versionCombo.currentIndex() self.versionCombo.clear() for i in infos: icon = 'lilypond-run' if i.version() else 'dialog-error' text = _("LilyPond {version}").format(version=i.versionString()) self.versionCombo.addItem(icons.get(icon), text) self.versionCombo.setCurrentIndex(index)
def loadSettings(self): s = settings() default = lilypondinfo.default() self._defaultCommand = s.value("default", default.command, str) self.auto.setChecked(s.value("autoversion", False, bool)) infos = sorted(lilypondinfo.infos(), key=lambda i: i.version()) if not infos: infos = [default] items = [InfoItem(info) for info in infos] self.instances.setItems(items) for item in items: if item._info.command == self._defaultCommand: self.instances.setCurrentItem(item) break
def loadSettings(self): s = settings() default = lilypondinfo.default() self._defaultCommand = s.value("default", default.command, type("")) self.auto.setChecked(s.value("autoversion", False, bool)) infos = sorted(lilypondinfo.infos(), key=lambda i: i.version()) if not infos: infos = [default] items = [InfoItem(info) for info in infos] self.instances.setItems(items) for item in items: if item._info.command == self._defaultCommand: self.instances.setCurrentItem(item) break
def saveSettings(self): infos = [item._info for item in self.instances.items()] if infos: for info in infos: if info.command == self._defaultCommand: break else: self._defaultCommand = infos[0].command else: infos = [lilypondinfo.default()] self._defaultCommand = infos[0].command s = settings() s.setValue("default", self._defaultCommand) s.setValue("autoversion", self.auto.isChecked()) lilypondinfo.setinfos(infos) lilypondinfo.saveinfos()
def load(self): """Load the available LilyPond infos.""" infos = lilypondinfo.infos() or [lilypondinfo.default()] infos.sort(key = lambda i: i.version() or (999,)) cur = self._infos[self.currentIndex()] if self._infos else lilypondinfo.preferred() self._infos = infos block = self.blockSignals(True) try: self.clear() index = 0 for i, info in enumerate(infos): icon = 'lilypond-run' if info.version() else 'dialog-error' self.addItem(icons.get(icon), info.prettyName()) if info.abscommand() == cur.abscommand() or info.command == cur.command: index = i self.setCurrentIndex(index) finally: self.blockSignals(block)