Python PyQt4.QtCore.QSettings() Examples
The following are 26
code examples of PyQt4.QtCore.QSettings().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt4.QtCore
, or try the search function
.
Example #1
Source File: ConnectionManager.py From qgis-cartodb with GNU General Public License v2.0 | 6 votes |
def __init__(self): QDialog.__init__(self) self.settings = QSettings() self.ui = Ui_ConnectionManager() self.ui.setupUi(self) self.populateConnectionList() self.ui.newConnectionBT.clicked.connect(self.openNewConnectionDialog) self.ui.editConnectionBT.clicked.connect(self.editConnectionDialog) self.ui.deleteConnectionBT.clicked.connect(self.deleteConnectionDialog) self.ui.connectBT.clicked.connect(self.connect) self.currentUser = None self.currentApiKey = None self.currentMultiuser = None
Example #2
Source File: RoadNetworkCleanerTool.py From qgisSpaceSyntaxToolkit with GNU General Public License v3.0 | 6 votes |
def getQGISDbs(self): """Return all PostGIS connection settings stored in QGIS :return: connection dict() with name and other settings """ con_settings = [] settings = QSettings() settings.beginGroup('/PostgreSQL/connections') for item in settings.childGroups(): con = dict() con['name'] = unicode(item) con['host'] = unicode(settings.value(u'%s/host' % unicode(item))) con['port'] = unicode(settings.value(u'%s/port' % unicode(item))) con['database'] = unicode(settings.value(u'%s/database' % unicode(item))) con['username'] = unicode(settings.value(u'%s/username' % unicode(item))) con['password'] = unicode(settings.value(u'%s/password' % unicode(item))) con_settings.append(con) settings.endGroup() dbs = {} if len(con_settings) > 0: for conn in con_settings: dbs[conn['name']]= conn return dbs
Example #3
Source File: setting.py From mishkal with GNU General Public License v3.0 | 6 votes |
def readSettings(self): settings = QtCore.QSettings("Arabeyes.org", "Qutrub") try: family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString() size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt(); bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool() dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt(); except TypeError: family=settings.value("font_base_family", "Traditional Arabic") size=settings.value("font_base_size", "12") size= int(size) ok = bool(size) bold=settings.value("font_base_bold", True) bold = bool(bold) dictsetting =settings.value("DictSetting", "1") dictsetting = int(dictsetting) if not ok:size=12; self.font_result.setFamily(family) self.font_result.setPointSize(size) self.font_result.setBold(bold) #read of dictsetting options if not ok:dictsetting=1; ## self.BDictSetting.setCheckState(dictsetting);
Example #4
Source File: settings.py From sparta with GNU General Public License v3.0 | 6 votes |
def __init__(self): # check if settings file exists and creates it if it doesn't if not os.path.exists('./sparta.conf'): print '[+] Creating settings file..' self.createDefaultSettings() else: print '[+] Loading settings file..' self.actions = QtCore.QSettings('./sparta.conf', QtCore.QSettings.NativeFormat) # This function creates the default settings file. Note that, in general, everything is case sensitive. # Each action should be in the following format: # # (key, [label, command, service]) # key - must be unique within the group and is used to retrieve each action. is used to create the tab titles and also to recognise nmap commands so we can parse the output (case sensitive) # label - is what appears in the context menu in the gui # command - command that will be run. These placeholders will be replaced on-the-fly: [IP] [PORT] [OUTPUT] # service - service(s) to which the tool applies (comma-separated). Leave empty if valid for all services.
Example #5
Source File: registryconfig.py From stdm with GNU General Public License v2.0 | 6 votes |
def read(self, items): """ Get the value of the user defined items from the STDM registry tree param items: List of registry keys to fetch. type items: list """ userKeys = {} settings = QSettings() settings.beginGroup("/") groups = settings.childGroups() for group in groups: if str(group) == self._base_group(): for t in items: tKey = self.groupPath + "/" + t if settings.contains(tKey): tValue = settings.value(tKey) userKeys[t] = tValue break return userKeys
Example #6
Source File: driverWindow.py From crazyflieROS with GNU General Public License v2.0 | 6 votes |
def readSettings(self): """ Load settings from previous session """ rospy.logdebug("Loading previous session settings") settings = QSettings("omwdunkley", "reset" if self.options.reset else "flieROS"+str(self.options.radio) ) self.resize(settings.value("size", QVariant(QSize(300, 500))).toSize()) self.move(settings.value("pos", QVariant(QPoint(200, 200))).toPoint()) self.ui.checkBox_reconnect.setChecked(settings.value("autoReconnect", QVariant(self.ui.checkBox_reconnect.isChecked())).toBool()) self.ui.checkBox_beep.setChecked(settings.value("beepOn", QVariant(self.ui.checkBox_beep.isChecked())).toBool()) self.ui.checkBox_xmode.setChecked(settings.value("xmodeOn", QVariant(self.ui.checkBox_xmode.isChecked())).toBool()) self.ui.checkBox_kill.setChecked(settings.value("killOn", QVariant(self.ui.checkBox_kill.isChecked())).toBool()) self.ui.checkBox_startupConnect.setChecked(settings.value("startConnect", QVariant(self.ui.checkBox_startupConnect)).toBool()) self.ui.checkBox_pktHZ.setChecked(settings.value("pktHzOn", QVariant(self.ui.checkBox_pktHZ.isChecked())).toBool()) self.ui.checkBox_logHZ.setChecked(settings.value("logHzOn", QVariant(self.ui.checkBox_logHZ.isChecked())).toBool()) self.ui.horizontalSlider_pktHZ.setValue(settings.value("pktHzVal", QVariant(self.ui.horizontalSlider_pktHZ.value())).toInt()[0]) self.ui.horizontalSlider_logHZ.setValue(settings.value("logHzVal", QVariant(self.ui.horizontalSlider_logHZ.value())).toInt()[0]) self.ui.horizontalSlider_guiHZ.setValue(settings.value("guiHzVal", QVariant(self.ui.horizontalSlider_guiHZ.value())).toInt()[0]) self.ui.horizontalSlider_AI.setValue(settings.value("aiHzVal", QVariant(self.ui.horizontalSlider_AI.value())).toInt()[0]) self.logManager.header().restoreState(settings.value("logTreeH", self.logManager.header().saveState()).toByteArray()) self.paramManager.header().restoreState(settings.value("paramTreeH", self.paramManager.header().saveState()).toByteArray())
Example #7
Source File: logManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def writeSettings(self): """ Save the HZ and selected group.names to log between sessions""" settings = QSettings("omwdunkley", "flieROS") # Save checked state settings.setValue("log_"+self.log.group+"."+self.log.name+"_on", self.data(0, Qt.CheckStateRole))
Example #8
Source File: GUIVersion.py From lknovel with MIT License | 5 votes |
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, parent) self.setupUi(self) self.setFixedSize(520, 250) self.installEventFilter(self) self.setWindowTitle('lknovel-轻之国度在线轻小说转epub') self.helpAction = QtGui.QAction('&Help', self) self.helpAction.setStatusTip('使用说明') self.aboutAction = QtGui.QAction('&About', self) self.aboutAction.setStatusTip('关于') self.menubar.addAction(self.helpAction) self.menubar.addAction(self.aboutAction) self.setting = QtCore.QSettings('kk', 'lknovel') if self.setting.value('savePath'): self.savePath = self.setting.value('savePath') else: self.savePath = os.path.join(os.path.expanduser('~'), 'Desktop') self.directoryLineEdit.setText(self.savePath) self.coverPath = '' self.startButton.clicked.connect(self.createEpub) self.sigInformationMessage.connect(self.showInformationMessage) self.sigWarningMessage.connect(self.showWarningMessage) self.directoryButton.clicked.connect(self.selectSaveDirectory) self.coverButton.clicked.connect(self.selectCover) lknovel.SENDER.sigChangeStatus.connect(self.changeStatus) lknovel.SENDER.sigWarningMessage.connect(self.showWarningMessage) lknovel.SENDER.sigInformationMessage.connect(self.showInformationMessage) lknovel.SENDER.sigButton.connect(lambda: self.startButton.setEnabled(True)) self.helpAction.triggered.connect(self.openHelpWidget) self.aboutAction.triggered.connect(self.openAboutWidget)
Example #9
Source File: vault.py From deosorg with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.dbFilename = None self.settings = QtCore.QSettings("ConstructibleUniverse", "TrezorPass") fname = self.settings.value("database/filename") if fname.isValid(): self.dbFilename = q2s(fname.toString())
Example #10
Source File: vault.py From deosorg with GNU General Public License v3.0 | 5 votes |
def __init__(self): self.dbFilename = None self.settings = QtCore.QSettings("ConstructibleUniverse", "TrezorPass") fname = self.settings.value("database/filename") if fname.isValid(): self.dbFilename = q2s(fname.toString())
Example #11
Source File: main_gui.py From pySecMaster with GNU Affero General Public License v3.0 | 5 votes |
def save_settings(self, ini_name): """ Technique structured from the code from: "https://stackoverflow.com /questions/23279125/python-pyqt4-functions-to-save-and-restore-ui- widget-values" :param ini_name: Name of the .ini file (Ex. pysecmaster.ini) :return: """ settings = QtCore.QSettings(ini_name, QtCore.QSettings.IniFormat) # For child in ui.children(): # works like getmembers, but because it # traverses the hierarchy, you would have to call the method recursively # to traverse down the tree. for name, obj in inspect.getmembers(self): if isinstance(obj, QtGui.QComboBox): name = obj.objectName() text = obj.currentText() settings.setValue(name, text) elif isinstance(obj, QtGui.QLineEdit): name = obj.objectName() value = obj.text() settings.setValue(name, value) elif isinstance(obj, QtGui.QSpinBox): name = obj.objectName() value = obj.value() settings.setValue(name, value) elif isinstance(obj, QtGui.QCheckBox): name = obj.objectName() state = obj.checkState() settings.setValue(name, state)
Example #12
Source File: test_plugin.py From plugin_build_tool with GNU General Public License v2.0 | 5 votes |
def __init__(self, iface): """Constructor. :param iface: An interface instance that will be passed to this class which provides the hook by which you can manipulate the QGIS application at run time. :type iface: QgsInterface """ # Save reference to the QGIS interface self.iface = iface # initialize plugin directory self.plugin_dir = os.path.dirname(__file__) # initialize locale locale = QSettings().value('locale/userLocale')[0:2] locale_path = os.path.join( self.plugin_dir, 'i18n', 'TestPlugin_{}.qm'.format(locale)) if os.path.exists(locale_path): self.translator = QTranslator() self.translator.load(locale_path) if qVersion() > '4.3.3': QCoreApplication.installTranslator(self.translator) # Create the dialog (after translation) and keep reference self.dlg = TestPluginDialog() # Declare instance attributes self.actions = [] self.menu = self.tr(u'&Test Plugin') # TODO: We are going to let the user set this up in a future iteration self.toolbar = self.iface.addToolBar(u'TestPlugin') self.toolbar.setObjectName(u'TestPlugin') # noinspection PyMethodMayBeStatic
Example #13
Source File: registryconfig.py From stdm with GNU General Public License v2.0 | 5 votes |
def write(self, settings): """ Write items in settings dictionary to the STDM registry """ uSettings = QSettings() stdmGroup = "/" + self.groupPath uSettings.beginGroup(stdmGroup) for k,v in settings.iteritems(): uSettings.setValue(k,v) uSettings.endGroup() uSettings.sync()
Example #14
Source File: registryconfig.py From stdm with GNU General Public License v2.0 | 5 votes |
def group_children(self): """ :return: Names of the child groups in the path specified in the constructor. :rtype: list """ settings = QSettings() settings.beginGroup(self.groupPath) group_children = settings.childGroups() settings.endGroup() return group_children
Example #15
Source File: Basic.py From qgis-cartodb with GNU General Public License v2.0 | 5 votes |
def __init__(self, toolbar, parent=None): QDialog.__init__(self, parent) self.toolbar = toolbar self.settings = QSettings() self.currentUser = self.toolbar.currentUser self.currentApiKey = self.toolbar.currentApiKey self.currentMultiuser = self.toolbar.currentMultiuser self.currentUserData = self.toolbar.currentUserData worker = CartoDBPluginWorker(self, 'connectUser') worker.start()
Example #16
Source File: logManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def readSettings(self): """ Read the HZ and selected things to log from previous session """ settings = QSettings("omwdunkley", "flieROS") # Read if checked onQv = settings.value("log_"+self.log.group+"."+self.log.name+"_on", QVariant(Qt.Unchecked)) QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onQv if onQv.toInt()[0]!=Qt.PartiallyChecked else Qt.Checked) #Default to checked
Example #17
Source File: logManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def writeSettings(self): """ Save the HZ and selected things to log between sessions""" settings = QSettings("omwdunkley", "flieROS") # Save target HZ settings.setValue("log_"+self.name+"_hz", self.data(2, Qt.DisplayRole)) # Save checked state settings.setValue("log_"+self.name+"_on", self.data(0, Qt.CheckStateRole)) #settings.setValue("ros_"+self.name+"_on", self.data(4, Qt.CheckStateRole)) # Save children state too for x in range(self.childCount()): self.child(x).writeSettings()
Example #18
Source File: logManager.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def readSettings(self): """ Read the HZ and selected things to log from previous session """ settings = QSettings("omwdunkley", "flieROS") # Read target HZ hzQv = settings.value("log_"+self.name+"_hz",QVariant(20)) QtGui.QTreeWidgetItem.setData(self, 2, Qt.DisplayRole, hzQv) self.hzTarget = self.getValidHZ(hzQv.toFloat()[0]) # Read if checked. If partially checked, uncheck onQv = settings.value("log_"+self.name+"_on", QVariant(Qt.Unchecked)) QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onQv if onQv.toInt()[0]!=Qt.PartiallyChecked else Qt.Unchecked) #onRos = settings.value("ros_"+self.name+"_on", QVariant(Qt.Unchecked)) #QtGui.QTreeWidgetItem.setData(self, 0, Qt.CheckStateRole, onRos)
Example #19
Source File: setting.py From mishkal with GNU General Public License v3.0 | 5 votes |
def writeSettings(self): settings = QtCore.QSettings("Arabeyes.org", "Qutrub") try: settings.setValue("font_base_family", QtCore.QVariant(self.font_result.family())) settings.setValue("font_base_size", QtCore.QVariant(self.font_result.pointSize())) settings.setValue("font_base_bold", QtCore.QVariant(self.font_result.bold())) except: settings.setValue("font_base_family", self.font_result.family()) settings.setValue("font_base_size", self.font_result.pointSize()) settings.setValue("font_base_bold", self.font_result.bold()) #write of dictsetting options ## settings.setValue("DictSetting", QtCore.QVariant(self.BDictSetting.checkState()));
Example #20
Source File: appgui.py From mishkal with GNU General Public License v3.0 | 5 votes |
def readSettings(self): settings = QtCore.QSettings("Arabeyes.org", "Qutrub") try: family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString() except TypeError: family = str(settings.value("font_base_family", "Traditional Arabic")) try: size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt(); except TypeError: size = settings.value("font_base_size", 12) size = int(size) ok = bool(size) if not ok:size=12; try: bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool() except TypeError: bold= bool(settings.value("font_base_bold", True)) self.font_result.setFamily(family) self.font_result.setPointSize(size) self.font_result.setBold(bold) #read of dictsetting options try: dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt(); except TypeError: dictsetting = settings.value("DictSetting", 1); ok = bool(dictsetting) if not ok:dictsetting=1; self.BDictOption=dictsetting;
Example #21
Source File: CartoDBToolbar.py From qgis-cartodb with GNU General Public License v2.0 | 5 votes |
def __init__(self, parent=None, flags=Qt.WindowFlags(0)): QWidget.__init__(self, parent, flags) self.settings = QSettings() self.setupUi() self.currentUser = self.settings.value('/CartoDBPlugin/selected') if self.currentUser: self.currentApiKey = self.settings.value('/CartoDBPlugin/%s/api' % self.currentUser) self.currentMultiuser = self.settings.value('/CartoDBPlugin/%s/multiuser' % self.currentUser, False) self.currentMultiuser = self.currentMultiuser in ['True', 'true', True] else: self.currentApiKey = None self.currentMultiuser = None self.click = None
Example #22
Source File: ConnectionManager.py From qgis-cartodb with GNU General Public License v2.0 | 5 votes |
def setConnectionListPosition(self): # Set the current index to the selected connection. toSelect = self.settings.value('/CartoDBPlugin/selected') conCount = self.ui.connectionList.count() self.setConnectionsFound(conCount > 0) exists = False for i in range(conCount): if self.ui.connectionList.itemText(i) == toSelect: self.ui.connectionList.setCurrentIndex(i) exists = True break # If we couldn't find the stored item, but there are some, default # to the last item (this makes some sense when deleting items as it # allows the user to repeatidly click on delete to remove a whole # lot of items) if not exists and conCount > 0: # If toSelect is null, then the selected connection wasn't found # by QSettings, which probably means that this is the first time # the user has used CartoDBPlugin, so default to the first in the list # of connetions. Otherwise default to the last. if not toSelect: currentIndex = 0 else: currentIndex = conCount - 1 self.ui.connectionList.setCurrentIndex(currentIndex) if conCount == 0: self.notfoundconnections.emit()
Example #23
Source File: NewConnection.py From qgis-cartodb with GNU General Public License v2.0 | 5 votes |
def __init__(self, user=None): QDialog.__init__(self) self.ui = Ui_NewConnection() self.ui.setupUi(self) self.settings = QSettings() self.user = None self.user_orig = user
Example #24
Source File: main.py From openairplay with MIT License | 4 votes |
def __init__(self): super(Window, self).__init__() self.settings = QSettings('open-airplay') # Establishes a hook on our system settings. # http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html # Place items in our window. self.createIconGroupBox() # Tray Icon Settings self.createMessageGroupBox() # Test notification group self.createDeviceListGroupBox() # Airplay server selection # Set the iconlabel to it's minimum width without scollbaring. self.iconLabel.setMinimumWidth(self.durationLabel.sizeHint().width()) # Create action groups to put actionable items into. self.createActions() self.createTrayIcon() # Attach clicks on things to actual functions self.showMessageButton.clicked.connect(self.showMessage) self.showIconCheckBox.toggled.connect(self.trayIconVisible) self.systrayClosePromptCheckBox.toggled.connect(self.setSystrayClosePrompt) self.iconComboBox.currentIndexChanged.connect(self.setIcon) self.trayIcon.messageClicked.connect(self.messageClicked) self.trayIcon.activated.connect(self.iconActivated) # Finally add the GUI item groupings we made to the layout and init it. mainLayout = QtGui.QVBoxLayout() mainLayout.addWidget(self.iconGroupBox) mainLayout.addWidget(self.deviceListGroupBox) mainLayout.addWidget(self.messageGroupBox) self.setLayout(mainLayout) # Set our System Tray Presence self.iconComboBox.setCurrentIndex(1) self.trayIcon.show() self.trayIcon.setToolTip("OpenAirplay") # Set our basic window things. self.setWindowTitle("OpenAirplay Settings") self.resize(400, 300) # If the user chose not to show the system tray icon: if self.settings.value('systrayicon', type=bool) is False: print("The user chose not to show the system tray icon.") self.trayIconVisible(False) # Setup stuff to poll available receivers every 3 seconds. self.oldReceiverList = [] self.timer=QtCore.QTimer() self.timer.start(3000) self.timer.timeout.connect(self.updateReceivers) # Start discovery of airplay receivers: if DEBUG: print("Starting discovery service...") discovery.start()
Example #25
Source File: settings.py From sparta with GNU General Public License v3.0 | 4 votes |
def backupAndSave(self, newSettings): # Backup and save print '[+] Backing up old settings and saving new settings..' os.rename('./sparta.conf', './'+getTimestamp()+'-sparta.conf') self.actions = QtCore.QSettings('./sparta.conf', QtCore.QSettings.NativeFormat) self.actions.beginGroup('GeneralSettings') self.actions.setValue('default-terminal',newSettings.general_default_terminal) self.actions.setValue('tool-output-black-background',newSettings.general_tool_output_black_background) self.actions.setValue('screenshooter-timeout',newSettings.general_screenshooter_timeout) self.actions.setValue('web-services',newSettings.general_web_services) self.actions.setValue('enable-scheduler',newSettings.general_enable_scheduler) self.actions.setValue('enable-scheduler-on-import',newSettings.general_enable_scheduler_on_import) self.actions.setValue('max-fast-processes', newSettings.general_max_fast_processes) self.actions.setValue('max-slow-processes', newSettings.general_max_slow_processes) self.actions.endGroup() self.actions.beginGroup('BruteSettings') self.actions.setValue('store-cleartext-passwords-on-exit',newSettings.brute_store_cleartext_passwords_on_exit) self.actions.setValue('username-wordlist-path',newSettings.brute_username_wordlist_path) self.actions.setValue('password-wordlist-path',newSettings.brute_password_wordlist_path) self.actions.setValue('default-username',newSettings.brute_default_username) self.actions.setValue('default-password',newSettings.brute_default_password) self.actions.setValue('services', newSettings.brute_services) self.actions.setValue('no-username-services', newSettings.brute_no_username_services) self.actions.setValue('no-password-services', newSettings.brute_no_password_services) self.actions.endGroup() self.actions.beginGroup('StagedNmapSettings') self.actions.setValue('stage1-ports',newSettings.tools_nmap_stage1_ports) self.actions.setValue('stage2-ports',newSettings.tools_nmap_stage2_ports) self.actions.setValue('stage3-ports',newSettings.tools_nmap_stage3_ports) self.actions.setValue('stage4-ports',newSettings.tools_nmap_stage4_ports) self.actions.setValue('stage5-ports',newSettings.tools_nmap_stage5_ports) self.actions.endGroup() self.actions.beginGroup('HostActions') for a in newSettings.hostActions: self.actions.setValue(a[1], [a[0], a[2]]) self.actions.endGroup() self.actions.beginGroup('PortActions') for a in newSettings.portActions: self.actions.setValue(a[1], [a[0], a[2], a[3]]) self.actions.endGroup() self.actions.beginGroup('PortTerminalActions') for a in newSettings.portTerminalActions: self.actions.setValue(a[1], [a[0], a[2], a[3]]) self.actions.endGroup() self.actions.beginGroup('SchedulerSettings') for tool in newSettings.automatedAttacks: self.actions.setValue(tool, newSettings.automatedAttacks[tool]) self.actions.endGroup() self.actions.sync() # This class first sets all the default settings and then overwrites them with the settings found in the configuration file
Example #26
Source File: main_gui.py From pySecMaster with GNU Affero General Public License v3.0 | 4 votes |
def restore_settings(self, ini_name): """ Technique structured from the code from: "https://stackoverflow.com /questions/23279125/python-pyqt4-functions-to-save-and-restore-ui- widget-values" :param ini_name: Name/path of the .ini file (Ex. pySecMaster_gui.ini) """ settings = QtCore.QSettings(ini_name, QtCore.QSettings.IniFormat) for name, obj in inspect.getmembers(self): if isinstance(obj, QtGui.QComboBox): name = obj.objectName() value = str(settings.value(name)) # .toString()) if value == "": continue # Get the corresponding index for specified string in combobox index = obj.findText(value) # Check if the value exists, otherwise add it to the combobox if index == -1: obj.insertItems(0, [value]) index = obj.findText(value) obj.setCurrentIndex(index) else: obj.setCurrentIndex(index) elif isinstance(obj, QtGui.QLineEdit): name = obj.objectName() value = str(settings.value(name)) obj.setText(value) elif isinstance(obj, QtGui.QSpinBox): name = obj.objectName() value = int(settings.value(name)) obj.setValue(value) elif isinstance(obj, QtGui.QCheckBox): name = obj.objectName() value = settings.value(name) if value: obj.setChecked(value) # setCheckState enables tristate