summaryrefslogtreecommitdiff
path: root/kberylsettings/contentframe.py
diff options
context:
space:
mode:
authornatural <natural>2006-12-20 13:04:14 +0000
committernatural <natural>2006-12-20 13:04:14 +0000
commita4fcfeb8b855e88d8e662c562dfbd6c9370793a1 (patch)
tree358a4613daa335395615c6e77bba5b85716f7f95 /kberylsettings/contentframe.py
parent9a71cc9d01fc4eb398aea5efdd1b9b7f85824898 (diff)
downloadkberylsettings-a4fcfeb8b855e88d8e662c562dfbd6c9370793a1.tar.gz
kberylsettings-a4fcfeb8b855e88d8e662c562dfbd6c9370793a1.tar.bz2
Reworked setting widgets.
Added depcheck script.
Diffstat (limited to 'kberylsettings/contentframe.py')
-rw-r--r--kberylsettings/contentframe.py41
1 files changed, 32 insertions, 9 deletions
diff --git a/kberylsettings/contentframe.py b/kberylsettings/contentframe.py
index 1ce0728..9880925 100644
--- a/kberylsettings/contentframe.py
+++ b/kberylsettings/contentframe.py
@@ -65,14 +65,12 @@ class ContentFrame(WidgetStack):
return button
self.helpButton = contentButton('help')
- self.helpButton.setEnabled(False)
self.defaultsButton = contentButton('defaults')
- self.defaultsButton.setEnabled(False)
layout.addStretch(100)
self.applyButton = contentButton('apply')
- #self.applyButton.setEnabled(False)
+ self.applyButton.setEnabled(False)
self.resetButton = contentButton('reset')
- self.resetButton.setEnabled(False)
+ self.resetButton.setEnabled(False)
self.addWidget(self.settingsPage, self.settingsPageId)
def buildConnections(self):
@@ -83,10 +81,17 @@ class ContentFrame(WidgetStack):
connect = self.connect
connect(self.helpButton, Signals.clicked, self.settingHelp)
connect(self.defaultsButton, Signals.clicked, self.settingDefaults)
+ connect(self.resetButton, Signals.clicked, self.settingsReset)
connect(self.applyButton, Signals.clicked, self.settingApply)
root = self.topLevelWidget()
- connect(self, Signals.berylSettingChanged, root.onSettingChanged)
+ connect(self, Signals.berylSettingChanged, root.onContextChanged)
connect(self, Signals.statusMessage, root.showMessage)
+ connect(self.settingsMain, Signals.somethingChanged,
+ self.onSomethingChanged)
+
+ def onSomethingChanged(self):
+ self.applyButton.setEnabled(True)
+ self.resetButton.setEnabled(True)
def showAbout(self, plugin):
""" displays the About Plugin page with information from the plugin
@@ -125,6 +130,8 @@ class ContentFrame(WidgetStack):
extra = ''
self.pluginNameLabel.setText('<b>%s%s</b>' % (plugin.ShortDesc, extra))
self.settingsMain.addSettings(plugin, settings)
+ self.applyButton.setEnabled(False)
+ self.resetButton.setEnabled(False)
self.raiseWidget(self.settingsPageId)
def settingHelp(self):
@@ -137,18 +144,30 @@ class ContentFrame(WidgetStack):
"""
+ def settingsReset(self):
+ frame = self.settingsPage
+ widgets = frame.queryList('SettingWidgetBase')
+ for widget in widgets:
+ try:
+ widget.reset()
+ except (Exception, ), exc:
+ print 'reset exception:', exc
+ self.applyButton.setEnabled(True)
+ self.resetButton.setEnabled(False)
+
def settingApply(self):
""" not implemented
"""
frame = self.settingsPage
- widgets = frame.queryList('BaseSettingWidget')
+ widgets = frame.queryList('SettingWidgetBase')
exceptions = []
for widget in widgets:
try:
- widget.setting.set(widget.value())
+ value = widget.value()
+ widget.setting.set(value)
+ widget.initial = value
print '****', widget.setting.ShortDesc, widget.setting.Value
-
except (Exception, ), exc:
exceptions.append((widget.plugin.Name, widget.setting.Name, exc))
if exceptions:
@@ -158,6 +177,8 @@ class ContentFrame(WidgetStack):
## KMessageBox.errorList isn't available!
KMessageBox.informationList(None, 'Exceptions Saving Settings',
exclist)
+ self.applyButton.setEnabled(False)
+ self.resetButton.setEnabled(False)
self.emit(Signals.statusMessage, ('Saving settings...', ))
self.emit(Signals.berylSettingChanged, ())
@@ -174,7 +195,9 @@ class SettingsMainFrame(QFrame):
frame = SettingFrame(self, plugin, setting)
self.settingFrames.append(frame)
layout.addWidget(frame, 0, Qt.AlignTop)
- frame.show()
+ frame.show()
+ self.connect(frame, Signals.somethingChanged,
+ self, Signals.somethingChanged)
layout.addStretch(100)
def clearFrames(self):