def should_show_on_startup(): """ Determines if the first time dialog should be shown :return: True if the dialog should be shown """ # first check the facility and instrument facility = ConfigService.getString(AboutPresenter.FACILITY) instrument = ConfigService.getString(AboutPresenter.INSTRUMENT) if not facility: return True else: # check we can get the facility and instrument try: facilityInfo = ConfigService.getFacility(facility) instrumentInfo = ConfigService.getInstrument(instrument) logger.information("Default facility '{0}', instrument '{1}'\n".format(facilityInfo.name(), instrumentInfo.name())) except RuntimeError: # failed to find the facility or instrument logger.error("Could not find your default facility '{0}' or instrument '{1}' in facilities.xml, " + "showing please select again.\n".format(facility, instrument)) return True settings = QSettings() settings.beginGroup(AboutPresenter.DO_NOT_SHOW_GROUP) doNotShowUntilNextRelease =int(settings.value(AboutPresenter.DO_NOT_SHOW, '0')) lastVersion = settings.value(AboutPresenter.LAST_VERSION, "") settings.endGroup() if not doNotShowUntilNextRelease: return True # Now check if the version has changed since last time version = release_notes_url() return version != lastVersion
def save_on_closing(self): # make sure the Last Version is updated on closing settings = QSettings() settings.beginGroup(self.DO_NOT_SHOW_GROUP) settings.setValue(self.LAST_VERSION, release_notes_url()) settings.endGroup() self.store_facility(self.view.cb_facility.currentText()) self.action_instrument_changed(self.view.cb_instrument.currentText()) ConfigService.saveConfig(ConfigService.getUserFilename()) self.parent.config_updated()
def action_close(self): # make sure the Last Version is updated on closing settings = QSettings() settings.beginGroup(self.DO_NOT_SHOW_GROUP) settings.setValue(self.LAST_VERSION, release_notes_url()) settings.endGroup() ConfigService.saveConfig(ConfigService.getUserFilename()) self.parent.config_updated() self.view.close()
def action_open_release_notes(self): InterfaceManager().showHelpPage(release_notes_url())