Example #1
0
 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.PREVIOUS_VERSION,
                       version().major + "." + version().minor)
     settings.endGroup()
     self.store_facility(self.view.about_widget.cb_facility.currentText())
     self.action_instrument_changed(
         self.view.about_widget.cb_instrument.currentText())
     ConfigService.saveConfig(ConfigService.getUserFilename())
     self.parent.config_updated()
Example #2
0
    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 = settings.value(AboutPresenter.DO_NOT_SHOW,
                                                   0,
                                                   type=int)
        lastVersion = settings.value(AboutPresenter.PREVIOUS_VERSION,
                                     "",
                                     type=str)
        current_version = version().major + "." + version().minor
        settings.endGroup()

        if not doNotShowUntilNextRelease:
            return True

        # Now check if the version has changed since last time
        return current_version != lastVersion
Example #3
0
    def __init__(self,
                 parent,
                 view=None,
                 usage_reporting_verification_view=None):
        self.view = view if view else AboutView(parent, self, str(version()),
                                                release_date().strip())
        self.usage_reporting_verification_view = usage_reporting_verification_view \
            if usage_reporting_verification_view else UsageReportingVerificationView(parent, self)
        self.parent = parent

        about_widget = self.view.about_widget
        about_widget.clb_release_notes.clicked.connect(
            self.action_open_release_notes)
        about_widget.clb_sample_datasets.clicked.connect(
            self.action_open_download_website)
        about_widget.clb_mantid_introduction.clicked.connect(
            self.action_open_mantid_introduction)
        about_widget.clb_python_introduction.clicked.connect(
            self.action_open_python_introduction)
        about_widget.clb_python_in_mantid.clicked.connect(
            self.action_open_python_in_mantid)
        about_widget.clb_extending_mantid.clicked.connect(
            self.action_open_extending_mantid)
        about_widget.lbl_privacy_policy.linkActivated.connect(
            self.action_open_external_link)
        about_widget.pb_manage_user_directories.clicked.connect(
            self.action_manage_user_directories)
        about_widget.pb_close.clicked.connect(self.action_close)

        self.setup_facilities_group()

        # set chk_allow_usage_data
        isUsageReportEnabled = ConfigService.getString(self.USAGE_REPORTING,
                                                       True)
        if isUsageReportEnabled == "0":
            about_widget.chk_allow_usage_data.setChecked(False)
        about_widget.chk_allow_usage_data.stateChanged.connect(
            self.action_usage_data_changed)

        # set do not show
        qSettings = QSettings()
        qSettings.beginGroup(self.DO_NOT_SHOW_GROUP)
        doNotShowUntilNextRelease = qSettings.value(self.DO_NOT_SHOW,
                                                    0,
                                                    type=int)
        qSettings.endGroup()
        about_widget.chk_do_not_show_until_next_release.setChecked(
            doNotShowUntilNextRelease)
        about_widget.chk_do_not_show_until_next_release.stateChanged.connect(
            self.action_do_not_show_until_next_release)
Example #4
0
 def test_version_info_string(self):
     self.assertTrue("." in str(version))
     assertRaisesNothing(self, print, version())
Example #5
0
 def test_version_info_patch(self):
     self.assertTrue(version().patch)
Example #6
0
 def test_version_info_minor(self):
     assertRaisesNothing(self, int, version().minor)