예제 #1
0
    def quit_program(self, widget=None, event=None, bckp=True):
        try:
            database.session.optimize_database()
        except Exception as exc:
            logger.error("Database optimizing failed: %s", exc)
        database.session.close()

        x, y = self.get_position()
        w, h = self.get_size()
        config.set("interface.window-x", x)
        config.set("interface.window-y", y)
        config.set("interface.window-w", w)
        config.set("interface.window-h", h)

        if config.get("backup.automatic-backup") and bckp:
            daysInSeconds = config.get("backup.interval") * 24 * 60 * 60
            if time.time() - config.get("backup.last") >= daysInSeconds:
                if backup.make_backup(config.get("backup.location")):
                    InfoDialog(messages.MSG_BACKUP_SUCCES, self)
                else:
                    InfoDialog(messages.MSG_BACKUP_FAILED, self)
                config.set("backup.last", time.time())
        config.save()
        gtk.main_quit()
예제 #2
0
 def menustatusbar_toggled(self, widget):
     value = widget.get_active()
     utils.set_multiple_visible([self.widgets.statusbar], value)
     config.set("interface.statusbar", value)
예제 #3
0
 def menuarrows_toggled(self, widget):
     value = widget.get_active()
     utils.set_multiple_visible([self.widgets.vboxButtons], value)
     config.set("interface.arrows", value)
예제 #4
0
 def menushowall_toggled(self, widget):
     config.set("interface.show-all-pigeons", widget.get_active())
     self.widgets.treeview.fill_treeview()
예제 #5
0
    def on_buttonok_clicked(self, widget):
        restart = self.widgets.combolangs.get_active_text() != config.get(
            "options.language")

        if self.widgets.radioSexText.get_active():
            sexcoltype = 1
        elif self.widgets.radioSexImage.get_active():
            sexcoltype = 2
        elif self.widgets.radioSexTextImage.get_active():
            sexcoltype = 3

        settings = [
            ("options.check-for-updates", self.widgets.chkUpdate.get_active()),
            ("options.check-for-dev-updates",
             self.widgets.chkDevUpdate.get_active()),
            ("options.language", self.widgets.combolangs.get_active_text()),
            ("options.coef-multiplier",
             self.widgets.spincoef.get_value_as_int()),
            ("options.distance-unit", self.widgets.combodistance.get_active()),
            ("options.speed-unit", self.widgets.combospeed.get_active()),
            ##("options.format-date", self.entrydate.get_text()),
            ("interface.arrows", self.widgets.chkArrows.get_active()),
            ("interface.stats", self.widgets.chkStats.get_active()),
            ("interface.toolbar", self.widgets.chkToolbar.get_active()),
            ("interface.statusbar", self.widgets.chkStatusbar.get_active()),
            ("interface.results-mode",
             self.widgets.cbResultsMode.get_active()),
            ("interface.missing-pigeon-hide",
             self.widgets.chkShowHidden.get_active()),
            ("interface.missing-pigeon-color",
             self.widgets.chkColorHidden.get_active()),
            ("interface.missing-pigeon-color-value",
             self.widgets.chkColorHiddenValue.get_color().to_string()),
            ("backup.automatic-backup", self.widgets.checkbackup.get_active()),
            ("backup.interval", self.widgets.spinday.get_value_as_int()),
            ("backup.location", self.widgets.fcbutton.get_current_folder()),
            ("columns.pigeon-name", self.widgets.chkName.get_active()),
            ("columns.pigeon-colour", self.widgets.chkColour.get_active()),
            ("columns.pigeon-sex", self.widgets.chkSex.get_active()),
            ("columns.pigeon-sex-type", sexcoltype),
            ("columns.pigeon-strain", self.widgets.chkStrain.get_active()),
            ("columns.pigeon-status", self.widgets.chkStatus.get_active()),
            ("columns.pigeon-loft", self.widgets.chkLoft.get_active()),
            ("columns.result-coef", self.widgets.chkCoef.get_active()),
            ("columns.result-speed", self.widgets.chkSpeed.get_active()),
            ("columns.result-sector", self.widgets.chkSector.get_active()),
            ("columns.result-category", self.widgets.chkCategory.get_active()),
            ("columns.result-type", self.widgets.chkType.get_active()),
            ("columns.result-weather", self.widgets.chkWeather.get_active()),
            ("columns.result-temperature",
             self.widgets.chkTemperature.get_active()),
            ("columns.result-wind", self.widgets.chkWind.get_active()),
            ("columns.result-windspeed",
             self.widgets.chkWindspeed.get_active()),
            ("columns.result-comment", self.widgets.chkComment.get_active()),
            ("printing.general-paper", self.widgets.cbPaper.get_active()),
            ("printing.pedigree-layout", self.widgets.cbLayout.get_active()),
            ("printing.pedigree-box-colour",
             self.widgets.chkPigOptColour.get_active()),
            ("printing.pedigree-name", self.widgets.chkPigName.get_active()),
            ("printing.pedigree-colour",
             self.widgets.chkPigColour.get_active()),
            ("printing.pedigree-sex", self.widgets.chkPigSex.get_active()),
            ("printing.pedigree-extra", self.widgets.chkPigExtra.get_active()),
            ("printing.pedigree-image", self.widgets.chkPigImage.get_active()),
            ("printing.pigeon-colnames",
             self.widgets.chkPigColumnNames.get_active()),
            ("printing.pigeon-sex", self.widgets.chkPigOptSex.get_active()),
            ("printing.result-colnames",
             self.widgets.chkResColumnNames.get_active()),
            ("printing.result-date", self.widgets.chkResDate.get_active()),
            ("printing.user-name", self.widgets.chkPerName.get_active()),
            ("printing.user-address", self.widgets.chkPerAddress.get_active()),
            ("printing.user-phone", self.widgets.chkPerPhone.get_active()),
            ("printing.user-email", self.widgets.chkPerEmail.get_active()),
        ]

        for option, value in settings:
            config.set(option, value)
        config.save()
        self._finish_options(restart)