summaryrefslogtreecommitdiff
path: root/portato/gui
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
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 '')
-rw-r--r--portato/gui/qt/windows.py66
-rw-r--r--portato/gui/templates/ui/AboutDialog.ui144
-rw-r--r--portato/gui/templates/ui/MainWindow.ui18
3 files changed, 116 insertions, 112 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):
diff --git a/portato/gui/templates/ui/AboutDialog.ui b/portato/gui/templates/ui/AboutDialog.ui
index b4064dd..ce89b44 100644
--- a/portato/gui/templates/ui/AboutDialog.ui
+++ b/portato/gui/templates/ui/AboutDialog.ui
@@ -8,8 +8,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>369</width>
- <height>270</height>
+ <width>400</width>
+ <height>300</height>
</rect>
</property>
<property name="windowTitle" >
@@ -23,94 +23,42 @@
<number>6</number>
</property>
<item>
- <widget class="QTabWidget" name="tabWidget" >
- <property name="currentIndex" >
- <number>0</number>
+ <widget class="QLabel" name="imgLabel" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>TextLabel</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignCenter</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
</property>
- <widget class="QWidget" name="tab" >
- <attribute name="title" >
- <string>About</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string>TextLabel</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignCenter</set>
- </property>
- <property name="wordWrap" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>20</width>
- <height>40</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="tab_2" >
- <attribute name="title" >
- <string>Plugins</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>9</number>
- </property>
- <property name="spacing" >
- <number>6</number>
- </property>
- <item>
- <widget class="QTreeWidget" name="pluginList" >
- <property name="editTriggers" >
- <set>QAbstractItemView::NoEditTriggers</set>
- </property>
- <property name="showDropIndicator" stdset="0" >
- <bool>false</bool>
- </property>
- <property name="alternatingRowColors" >
- <bool>true</bool>
- </property>
- <property name="rootIsDecorated" >
- <bool>false</bool>
- </property>
- <property name="columnCount" >
- <number>2</number>
- </property>
- <column>
- <property name="text" >
- <string>1</string>
- </property>
- </column>
- <column>
- <property name="text" >
- <string>1</string>
- </property>
- </column>
- </widget>
- </item>
- </layout>
- </widget>
</widget>
</item>
<item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
@@ -134,12 +82,28 @@
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
- <x>174</x>
- <y>252</y>
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>AboutDialog</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
</hint>
<hint type="destinationlabel" >
- <x>176</x>
- <y>197</y>
+ <x>286</x>
+ <y>274</y>
</hint>
</hints>
</connection>
diff --git a/portato/gui/templates/ui/MainWindow.ui b/portato/gui/templates/ui/MainWindow.ui
index e2eb0dc..9a3e15e 100644
--- a/portato/gui/templates/ui/MainWindow.ui
+++ b/portato/gui/templates/ui/MainWindow.ui
@@ -428,12 +428,6 @@ p, li { white-space: pre-wrap; }
<addaction name="separator" />
<addaction name="quitAction" />
</widget>
- <widget class="QMenu" name="helpMenu" >
- <property name="title" >
- <string>&amp;?</string>
- </property>
- <addaction name="aboutAction" />
- </widget>
<widget class="QMenu" name="emergeMenu" >
<property name="title" >
<string>&amp;Emerge</string>
@@ -448,6 +442,13 @@ p, li { white-space: pre-wrap; }
<addaction name="separator" />
<addaction name="killAction" />
</widget>
+ <widget class="QMenu" name="helpMenu" >
+ <property name="title" >
+ <string>&amp;?</string>
+ </property>
+ <addaction name="aboutAction" />
+ <addaction name="pluginAction" />
+ </widget>
<addaction name="fileMenu" />
<addaction name="emergeMenu" />
<addaction name="helpMenu" />
@@ -540,6 +541,11 @@ p, li { white-space: pre-wrap; }
<string>Show &amp;new packages</string>
</property>
</action>
+ <action name="pluginAction" >
+ <property name="text" >
+ <string>Plugins</string>
+ </property>
+ </action>
</widget>
<customwidgets>
<customwidget>