def read_settings(self):
settings = QtCore.QSettings(self._application, self._section)
for key in settings.allKeys():
value = settings.value(key)
try:
# This is required to skip the tab_position key/value
this = getattr(self.ui, key)
except:
continue
if isinstance(this, QW.QLineEdit):
this.setText(value)
elif isinstance(this, QW.QSpinBox):
this.setValue(int(value))
elif isinstance(this, QW.QCheckBox):
if value in ['false', False, "False"]:
this.setChecked(False)
else:
this.setChecked(True)
elif isinstance(this, FileBrowser):
this.set_filenames(value)
else:
print('could not handle : %s' % this)
# The last tab position
self._tab_pos = settings.value("tab_position", 0, type=int)
self.ui.tabs.setCurrentIndex(self._tab_pos)
评论列表
文章目录