Пример #1
0
    def readConfig(self):
        """Read config file and updates internal config dict"""

        def sd(key, default):
            self.config[key] = val = unicode(self.settings.value(key, default).toString())
            if not self.settings.contains(key):
                self.settings.setValue(key, val)
            return val
        
        sd("themeName", "")
        sd("backgroundPath", "")
        ct = sd("clockType", "Auto")
        sd("themePath", get_default_theme_dir())
        et = sd("ecoTimeout", "15")
        sd("alarmBackend", "none")
        sd("uberclockHost", "localhost:1799")
        sd("uberclockUser", "user")
        sd("uberclockPassword", "user")
 
        rv = self.settings.value("zoom", None).toFloat()
        if rv[1]:
            self.config["zoom"] = rv[0]

        rv = self.settings.value("zoomFullscreen", None).toFloat()
        if rv[1]:
            self.config["zoomFullscreen"] = rv[0]


        if ct == "Quartz":
            self.quartzButton.setChecked(1)
        elif ct == "Eco":
            self.ecoButton.setChecked(1)
        else:
            # auto is default
            self.autoButton.setChecked(1)

        if et == "Quarter":
            self.quarterButton.setChecked(1)
        elif et == "Half":
            self.halfButton.setChecked(1)
        else:
            # auto is default
            self.selectedButton.setChecked(1)

        self.dirInput.setText(self.config["themePath"])
        self.bgInput.setText(self.config["backgroundPath"])

        # fill uberclock
        self.uberclockHost.setText(self.config["uberclockHost"])
        self.uberclockUser.setText(self.config["uberclockUser"])
        self.uberclockPassword.setText(self.config["uberclockPassword"])

        # set backend
        backend = self.config["alarmBackend"]
        for key, val in self.ALARM_BACKENDS.iteritems():
            if val == backend:
                self.alarmSelect.setCurrentIndex(key)
                self.changeBackend(key)
                break
        else:
            self.alarmSelect.setCurrentIndex(0)
            self.changeBackend(0)
Пример #2
0
 def on_dirButton_clicked(self):
      #sets the user theme
      self.fileDialog=QFileDialog(self)
      #self.fileDialog.setReadOnly(1)
      #self.setCursor(Qt.WaitCursor)
      self.dirButton.setText("Busy...")
      path=self.fileDialog.getExistingDirectory(self, "Open Directory",self.config.get("themePath", get_default_theme_dir()))
      self.dirButton.setText("Browse")
      #self.setCursor(Qt.ArrowCursor)
      self.dirInput.setText(path)
      self.config["themePath"] = path