summaryrefslogtreecommitdiff
path: root/winSettings.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-01-11 19:17:47 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-01-11 19:17:47 +0100
commite4ef5b936b714b6faafce4d06ddb34f6912e1aa7 (patch)
treeeaf4fdec7838ff382894975153f2ff0ed029e4b9 /winSettings.py
parent271e42d6a7f32d3cefb86736a2efd82ddad5c1a8 (diff)
Begin switch to QSettings.
Diffstat (limited to 'winSettings.py')
-rw-r--r--winSettings.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/winSettings.py b/winSettings.py
index e9723fd..e4efeb5 100644
--- a/winSettings.py
+++ b/winSettings.py
@@ -2,7 +2,6 @@ from PyQt4 import QtGui, QtCore
import sys
from misc import *
-from clSettings import settings
import plugins
@@ -12,10 +11,12 @@ class winSettings(QtGui.QWidget):
lstPlugins=None
winMain=None
+ settings = None
def __init__(self, winMain, parent=None):
QtGui.QWidget.__init__(self, parent)
+ self.settings = QtCore.QSettings(ORGNAME, APPNAME)
self.winMain=winMain
self.btnSave=Button('save all', self.onBtnSaveClick)
@@ -67,10 +68,10 @@ class winSettings(QtGui.QWidget):
else:
item.setCheckState(QtCore.Qt.Unchecked)
- if settings.get('%s.load'%(plugin.getName(True)),None)==None:
+ if self.settings.value(plugin.getName() + '/load') == None:
# load new plugins by default
item.setTextColor(QtCore.Qt.blue)
- settings.set('%s.load'%(plugin.getName(True)), 1)
+ self.settings.setValue(plugin.getName() + '/load', QVariant(True))
else:
item=QtGui.QListWidgetItem("%s\t%s"%(entry[plugins.PLUGIN_CLASS], entry[plugins.PLUGIN_MSG]))
@@ -91,7 +92,7 @@ class winSettings(QtGui.QWidget):
self.close()
def onlstPluginItemChanged(self, item):
# check here if we have to load or unload the plugin!
- toload=int(item.checkState()==QtCore.Qt.Checked)
+ toload = (item.checkState() == QtCore.Qt.Checked)
className=str(item.text()[0:str(item.text()).find('\t')])
if toload:
# refresh the plugin file
@@ -105,7 +106,7 @@ class winSettings(QtGui.QWidget):
if plugin:
plugin.unload()
if plugin:
- settings.set('%s.load'%(plugin.getName(True)), toload)
+ self.settings.setValue(plugin.getName() + '/load', QVariant(toload))
def closeEvent(self, event):
map(lambda entry: entry[plugins.PLUGIN_INSTANCE] and entry[plugins.PLUGIN_INSTANCE].resetSettingCache(), plugins.listPlugins().values())
self.winMain.wSettings=None