summaryrefslogtreecommitdiff
path: root/portato/gui/qt
diff options
context:
space:
mode:
authornecoro <>2007-07-05 02:40:39 +0000
committernecoro <>2007-07-05 02:40:39 +0000
commit7d757db73d862b368c57aed2da769a53b3e1e920 (patch)
treef1c6a464aaa8a6ee340e141652b152ff667b2813 /portato/gui/qt
parent1a3073d1e195118c636df983fcd647d7d028cd82 (diff)
downloadportato-7d757db73d862b368c57aed2da769a53b3e1e920.tar.gz
portato-7d757db73d862b368c57aed2da769a53b3e1e920.tar.bz2
portato-7d757db73d862b368c57aed2da769a53b3e1e920.zip
added ability to disable/enable plugins in qt too; added shutdown plugin
Diffstat (limited to 'portato/gui/qt')
-rw-r--r--portato/gui/qt/windows.py66
1 files changed, 50 insertions, 16 deletions
diff --git a/portato/gui/qt/windows.py b/portato/gui/qt/windows.py
index abb69ad..7c1726e 100644
--- a/portato/gui/qt/windows.py
+++ b/portato/gui/qt/windows.py
@@ -81,20 +81,60 @@ class Window (object):
return wrapper
+class PluginDialog (Window):
+ __metaclass__ = WindowMeta
+
+ def __init__ (self, parent, plugins):
+
+ Window.__init__(self, parent)
+
+ self.pluginList.setHeaderLabels(["Plugin", "Author"])
+ self.plugins = {}
+ self.changedPlugins = {}
+
+ for p in plugins:
+ item = Qt.QTreeWidgetItem(self.pluginList, [p.name,p.author])
+ item.setCheckState(0, qCheck(p.is_enabled()))
+ self.plugins.update({self.create_key(p.name,p.author) : p}) # create a list of plugins
+
+ self.pluginList.resizeColumnToContents(0)
+
+ Qt.QObject.connect(self.pluginList, Qt.SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.cb_plugin_toggled)
+
+ def create_key (self, name, author):
+ return str(name + "_" + author)
+
+ def cb_plugin_toggled (self, item, col):
+ if col != 0:
+ return
+
+ self.changedPlugins.update({ \
+ self.create_key(str(item.text(0)), str(item.text(1))) : \
+ qIsChecked(item.checkState(0))\
+ })
+
+ @Qt.pyqtSignature("")
+ def on_buttonBox_accepted(self):
+ for pluginKey, value in self.changedPlugins.iteritems():
+ self.plugins[pluginKey].set_enabled(value)
+
+ self.accept()
+
class AboutDialog (Window):
"""A window showing the "about"-informations."""
__metaclass__ = WindowMeta
- def __init__ (self, parent = None, plugins = []):
+ def __init__ (self, parent = None):
"""Constructor.
@param parent: the parent window
- @type parent: Qt.QWidget
- @param plugins: The list of plugins (author,name) to show in the "Plugins"-Tab.
- @type plugins: (string, string)[]"""
+ @type parent: Qt.QWidget"""
Window.__init__(self, parent)
+ self.pix = Qt.QPixmap(APP_ICON)
+ self.imgLabel.setPixmap(self.pix) # yes we have to use a label for the image ...
+
self.label.setText("""
<font size=5><b>Portato v.%s</b></font><br><br>
A Portage-GUI<br>
@@ -104,15 +144,7 @@ Copyright (C) 2006-2007 Ren&eacute; 'Necoro' Neumann &lt;necoro@necoro.net&gt;<b
<br>
Icon created by P4R4D0X""" % VERSION)
- self.pluginList.setHeaderLabels(["Plugin", "Author"])
- for p in plugins:
- Qt.QTreeWidgetItem(self.pluginList, list(p))
-
- self.pluginList.resizeColumnToContents(0)
-
- self.adjustSize()
-
class SearchDialog (Window):
"""A window showing the results of a search process."""
__metaclass__ = WindowMeta
@@ -805,13 +837,15 @@ class MainWindow (Window):
@Qt.pyqtSignature("")
def on_aboutAction_triggered (self):
- queue = plugin.get_plugin_queue()
+ AboutDialog(self).exec_()
+
+ @Qt.pyqtSignature("")
+ def on_pluginAction_triggered (self):
+ queue = plugin.get_plugin_queue().get_plugins()
if queue is None:
queue = []
- else:
- queue = queue.get_plugin_data()
- AboutDialog(self, queue).exec_()
+ PluginDialog(self, queue).exec_()
@Qt.pyqtSignature("")
def on_prefAction_triggered (self):