summaryrefslogtreecommitdiff
path: root/kberylsettings/contentframe.py
diff options
context:
space:
mode:
authornatural <natural>2006-12-29 22:15:55 +0000
committernatural <natural>2006-12-29 22:15:55 +0000
commit0aec17325b9df32be8a46d09efea611eb12fd5ec (patch)
tree4a067fc106af227d552377dc11f615fcaac67e7d /kberylsettings/contentframe.py
parent83388f8fa04a23e09111d140f508d22667892202 (diff)
downloadkberylsettings-0aec17325b9df32be8a46d09efea611eb12fd5ec.tar.gz
kberylsettings-0aec17325b9df32be8a46d09efea611eb12fd5ec.tar.bz2
Now handles _ plugin and active_plugin setting with a group box and label.
Diffstat (limited to 'kberylsettings/contentframe.py')
-rw-r--r--kberylsettings/contentframe.py54
1 files changed, 21 insertions, 33 deletions
diff --git a/kberylsettings/contentframe.py b/kberylsettings/contentframe.py
index 6890fd5..e9b096a 100644
--- a/kberylsettings/contentframe.py
+++ b/kberylsettings/contentframe.py
@@ -201,12 +201,13 @@ class SettingPage:
@return None
"""
- widgets = self.queryList('SettingFrame')
- for widget in widgets:
+ excs = []
+ for w in self.queryList('SettingWidget'):
try:
- widget.setDefault()
+ w.setDefault()
except (Exception, ), exc:
- print 'reset exception:', exc
+ excs.append((w.plugin.Name, w.setting.Name, exc))
+ self.settingExcDialog(excs, 'Exceptions During Set Default')
self.enableApplyReset(True, True)
def settingsReset(self):
@@ -214,12 +215,13 @@ class SettingPage:
@return None
"""
- widgets = self.queryList('SettingWidget')
- for widget in widgets:
+ excs = []
+ for w in self.queryList('SettingWidget'):
try:
- widget.reset()
+ w.reset()
except (Exception, ), exc:
- print 'reset exception:', exc
+ excs.append((w.plugin.Name, w.setting.Name, exc))
+ self.settingExcDialog(excs, 'Exceptions During Reset')
self.enableApplyReset(False, False)
def settingApply(self):
@@ -229,21 +231,22 @@ class SettingPage:
excs = []
for w in self.queryList('SettingWidget'):
try:
- v = w.value()
- w.setting.set(v)
- w.initial = v
+ w.setFromValue()
except (Exception, ), exc:
excs.append((w.plugin.Name, w.setting.Name, exc))
- if excs:
- excstrs = QStringList()
- for exc in excs:
- excstrs.append('Plugin:%s Setting:%s Exception:%s' % exc)
- KMessageBox.errorList(None, 'Exceptions Saving Settings',
- excstrs)
+ self.settingExcDialog(excs, 'Exceptions During Apply')
self.enableApplyReset(False, False)
self.emit(Signals.statusMessage, ('Saving settings...', ))
self.emit(Signals.berylSettingChanged, ())
+ def settingExcDialog(self, exceptions, caption):
+ if not exceptions:
+ return
+ excstrs = QStringList()
+ for exc in exceptions:
+ excstrs.append('Plugin:%s Setting:%s Exception:%s' % exc)
+ KMessageBox.errorList(None, caption, excstrs)
+
class SinglePage(Frame, SettingPage):
""" SinglePage -> frame to display a single group of settings
@@ -407,24 +410,9 @@ class SettingFrame(QFrame):
connect = self.connect
connect(info, Signals.clicked, self.showTip)
- connect(reset, Signals.clicked, self.setDefault)
+ connect(reset, Signals.clicked, self.settingWidget.setDefault)
connect(widget, Signals.someChange, self, Signals.someChange)
- def setDefault(self):
- """ set the setting value to its default
-
- The berylsettings extension module performs the reset directly
- on the setting object. In this method, we save the current
- value as defined by the widget and set that value again after
- the reset.
- """
- widget = self.settingWidget
- current = widget.value()
- widget.initial = widget.setting.ResetToDefault()
- widget.setting.set(current)
- widget.reset()
- widget.initial = current
-
def showTip(self):
""" show a balloon tip with the setting description