From 22fd3d917d59515df4a6d95aef53586cedd61965 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 13 Jan 2009 16:59:02 +0100 Subject: More flexible settings widgets. should be backward compatible for now, converted Library to the new system. --- winSettings.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'winSettings.py') diff --git a/winSettings.py b/winSettings.py index e6f3f29..3f0231f 100644 --- a/winSettings.py +++ b/winSettings.py @@ -1,5 +1,4 @@ from PyQt4 import QtGui, QtCore -import sys from misc import * import plugins @@ -12,6 +11,7 @@ class winSettings(QtGui.QWidget): winMain=None settings = None + settings_wg = [] def __init__(self, winMain, parent=None): @@ -33,7 +33,10 @@ class winSettings(QtGui.QWidget): for k,entry in plugins.listPlugins().iteritems(): plugin=entry[plugins.PLUGIN_INSTANCE] if plugin: - tabWidget.addTab(plugin.getSettingsWidget(), plugin.getName()) + wg = plugin.getSettingsWidget() + if wg: + self.settings_wg.append(plugin.getSettingsWidget()) + tabWidget.addTab(self.settings_wg[-1], plugin.getName()) self.fillList() layoutWin.addWidget(tabWidget) @@ -79,17 +82,18 @@ class winSettings(QtGui.QWidget): item.setTextColor(QtCore.Qt.red) self.lstPlugins.addItem(item) - def center(self): screen = QtGui.QDesktopWidget().screenGeometry() size = self.geometry() self.move((screen.width()-size.width())/2, (screen.height()-size.height())/2+100) def onBtnSaveClick(self): - map(lambda entry: entry[plugins.PLUGIN_INSTANCE] and entry[plugins.PLUGIN_INSTANCE].saveSettings(), plugins.listPlugins().values()) + for wg in self.settings_wg: + wg.save_settings() def onBtnCloseClick(self): - self.close() + self.settings_wg = None + self.close() def onlstPluginItemChanged(self, item): # check here if we have to load or unload the plugin! toload = (item.checkState() == QtCore.Qt.Checked) -- cgit v1.2.3