def loadSetting(self, key, default): settings = Qt.QSettings() settings.beginGroup(self.SETTING_GROUP_NAME) val = settings.value(key) settings.endGroup() if (val == None) or (str(val) == ""): val = default self.saveSetting(key, val) return str(val)
def saveConfig(self): settings = Qt.QSettings() settings.beginGroup(self.pluginConf) for (widget,key,default) in self.settings: if type(default)==type("a"): val_str = str(widget.text) elif type(default)==type(True): val_str = str(int(widget.isChecked())) settings.setValue(key,val_str) settings.endGroup() return
def loadConfig(self): settings = Qt.QSettings() settings.beginGroup(self.pluginConf) for (widget,key,default) in self.settings: val = settings.value(key) if (val == None) or (str(val)==""): val_str = default else: val_str = str(val) if type(default)==type("a"): widget.text = val_str elif type(default)==type(True): widget.setChecked(bool(int(val_str))) settings.endGroup() return
def saveSetting(self, key, val): settings = Qt.QSettings() settings.beginGroup(self.SETTING_GROUP_NAME) settings.setValue(key, str(val)) settings.endGroup() return