summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.net>2008-06-30 21:06:17 +0200
committerRené 'Necoro' Neumann <necoro@necoro.net>2008-06-30 21:06:17 +0200
commit09e693a8061d0b96c3aac8aae6ae12d6272b2c3e (patch)
treeffb37ca20ae72b3b2db0183c8b288515fa3328a0
parent9b22030eda3b9af70ae052611cf485a0d7ae063b (diff)
downloadportato-09e693a8061d0b96c3aac8aae6ae12d6272b2c3e.tar.gz
portato-09e693a8061d0b96c3aac8aae6ae12d6272b2c3e.tar.bz2
portato-09e693a8061d0b96c3aac8aae6ae12d6272b2c3e.zip
Now the new design is able to do the same as the old one
-rw-r--r--portato/gui/templates/PluginWindow.glade265
-rw-r--r--portato/gui/windows/plugin.py84
-rw-r--r--portato/plugin.py1
3 files changed, 182 insertions, 168 deletions
diff --git a/portato/gui/templates/PluginWindow.glade b/portato/gui/templates/PluginWindow.glade
index 28b46e6..01db971 100644
--- a/portato/gui/templates/PluginWindow.glade
+++ b/portato/gui/templates/PluginWindow.glade
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Mon Jun 30 20:11:21 2008 -->
+<!--Generated with glade3 3.4.4 on Mon Jun 30 21:04:51 2008 -->
<glade-interface>
<widget class="GtkWindow" id="PluginWindow">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="border_width">5</property>
<property name="title" translatable="yes">Plugins</property>
+ <property name="resizable">False</property>
<property name="modal">True</property>
<property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
<property name="destroy_with_parent">True</property>
@@ -18,183 +19,177 @@
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">5</property>
<child>
- <widget class="GtkVPaned" id="vpaned1">
+ <widget class="GtkScrolledWindow" id="pluginListScroll">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="position">120</property>
- <property name="position_set">True</property>
+ <property name="can_focus">False</property>
+ <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
+ <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
<child>
- <widget class="GtkScrolledWindow" id="pluginListScroll">
+ <widget class="GtkTreeView" id="pluginList">
<property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
- <property name="vscrollbar_policy">GTK_POLICY_NEVER</property>
- <child>
- <widget class="GtkTreeView" id="pluginList">
- <property name="visible">True</property>
- <property name="rules_hint">True</property>
- <property name="enable_search">False</property>
- </widget>
- </child>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ <property name="enable_search">False</property>
</widget>
- <packing>
- <property name="resize">True</property>
- <property name="shrink">False</property>
- </packing>
</child>
+ </widget>
+ </child>
+ <child>
+ <widget class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="row_spacing">5</property>
<child>
- <widget class="GtkTable" id="table1">
+ <widget class="GtkHButtonBox" id="hbuttonbox1">
<property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
+ <property name="spacing">5</property>
+ <property name="homogeneous">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_EDGE</property>
<child>
- <widget class="GtkLabel" id="descrLabel">
+ <widget class="GtkRadioButton" id="enabledRB">
<property name="visible">True</property>
- <property name="label" translatable="yes">label</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Enabled</property>
+ <property name="response_id">0</property>
+ <property name="active">True</property>
+ <signal name="toggled" handler="cb_state_toggled"/>
</widget>
- <packing>
- <property name="right_attach">2</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
</child>
<child>
- <widget class="GtkLabel" id="label1">
+ <widget class="GtkRadioButton" id="tempEnabledRB">
<property name="visible">True</property>
- <property name="label" translatable="yes">label</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Temporarily enabled</property>
+ <property name="response_id">0</property>
+ <property name="group">enabledRB</property>
</widget>
<packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="position">1</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="label2">
+ <widget class="GtkRadioButton" id="tempDisabledRB">
<property name="visible">True</property>
- <property name="label" translatable="yes">label</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Temporarily disabled</property>
+ <property name="response_id">0</property>
+ <property name="group">enabledRB</property>
+ <signal name="toggled" handler="cb_state_toggled"/>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <widget class="GtkRadioButton" id="disabledRB">
<property name="visible">True</property>
- <property name="spacing">5</property>
- <property name="homogeneous">True</property>
- <property name="layout_style">GTK_BUTTONBOX_EDGE</property>
- <child>
- <widget class="GtkRadioButton" id="radiobutton1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Enabled</property>
- <property name="response_id">0</property>
- <property name="active">True</property>
- </widget>
- <packing>
- <property name="secondary">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Temporarily enabled</property>
- <property name="response_id">0</property>
- <property name="active">True</property>
- <property name="group">radiobutton1</property>
- </widget>
- <packing>
- <property name="position">1</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Temporarily disabled</property>
- <property name="response_id">0</property>
- <property name="active">True</property>
- <property name="group">radiobutton1</property>
- </widget>
- <packing>
- <property name="position">2</property>
- <property name="secondary">True</property>
- </packing>
- </child>
- <child>
- <widget class="GtkRadioButton" id="radiobutton4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Disabled</property>
- <property name="response_id">0</property>
- <property name="active">True</property>
- <property name="group">radiobutton1</property>
- </widget>
- <packing>
- <property name="position">3</property>
- <property name="secondary">True</property>
- </packing>
- </child>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Disabled</property>
+ <property name="response_id">0</property>
+ <property name="group">enabledRB</property>
+ <signal name="toggled" handler="cb_state_toggled"/>
</widget>
<packing>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">GTK_FILL</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
</packing>
</child>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="authorLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">label</property>
+ <property name="single_line_mode">True</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">&lt;b&gt;Author:&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="single_line_mode">True</property>
+ </widget>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkLabel" id="descrLabel">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">label</property>
+ </widget>
+ <packing>
+ <property name="right_attach">2</property>
+ <property name="y_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkExpander" id="depExpander">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<child>
- <widget class="GtkLabel" id="label3">
+ <widget class="GtkTreeView" id="treeview1">
<property name="visible">True</property>
- <property name="label" translatable="yes">label</property>
+ <property name="can_focus">True</property>
+ <property name="headers_clickable">True</property>
</widget>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">GTK_FILL</property>
- </packing>
</child>
<child>
- <widget class="GtkExpander" id="expander1">
+ <widget class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <child>
- <widget class="GtkTreeView" id="treeview1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_clickable">True</property>
- </widget>
- </child>
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes">expander</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
+ <property name="label" translatable="yes">Needed dependencies</property>
+ <property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="type">label_item</property>
</packing>
</child>
</widget>
<packing>
- <property name="resize">True</property>
- <property name="shrink">False</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkButton" id="installBtn">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">_Install dependencies</property>
+ <property name="use_underline">True</property>
+ <property name="response_id">0</property>
+ </widget>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
</packing>
</child>
</widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
<widget class="GtkHButtonBox" id="hbuttonbox2">
@@ -232,7 +227,7 @@
</widget>
<packing>
<property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
</widget>
diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py
index fb9446e..6e8fdab 100644
--- a/portato/gui/windows/plugin.py
+++ b/portato/gui/windows/plugin.py
@@ -34,48 +34,40 @@ class PluginWindow (AbstractDialog):
self.plugins = plugins
self.changedPlugins = {}
- view = self.tree.get_widget("pluginList")
- self.store = gtk.ListStore(str,str,str)
+ self.buttons = map(self.tree.get_widget, ("disabledRB", "tempEnabledRB", "enabledRB", "tempDisabledRB"))
+ map(lambda b: b.set_mode(False), self.buttons)
+
+ self.descrLabel = self.tree.get_widget("descrLabel")
+ self.authorLabel = self.tree.get_widget("authorLabel")
+
+ self.depExpander = self.tree.get_widget("depExpander")
+ self.installBtn = self.tree.get_widget("installBtn")
- view.set_model(self.store)
+ self.view = self.tree.get_widget("pluginList")
+ self.store = gtk.ListStore(str)
- cell = gtk.CellRendererText()
- col = gtk.TreeViewColumn(_("Plugin"), cell, markup = 0)
- view.append_column(col)
+ self.view.set_model(self.store)
- col = gtk.TreeViewColumn(_("Authors"), cell, text = 1)
- view.append_column(col)
-
- ccell = gtk.CellRendererCombo()
- ccell.set_property("model", self.statsStore)
- ccell.set_property("text-column", 0)
- ccell.set_property("has-entry", False)
- ccell.set_property("editable", True)
- ccell.connect("edited", self.cb_status_changed)
- col = gtk.TreeViewColumn(_("Status"), ccell, markup = 2)
- view.append_column(col)
+ cell = gtk.CellRendererText()
+ col = gtk.TreeViewColumn("Plugin", cell, markup = 0)
+ self.view.append_column(col)
- for p in (("<b>"+p.name+"</b>", p.author, _(self.statsStore[p.status][0])) for p in plugins):
- self.store.append(p)
+ for p in plugins:
+ self.store.append(["<b>%s</b>" % p.name])
- self.window.show_all()
+ self.view.get_selection().connect("changed", self.cb_list_selection)
- def cb_status_changed (self, cell, path, new_text):
- path = int(path)
-
- self.store[path][2] = "<b>%s</b>" % new_text
+ self.window.show_all()
- # convert string to constant
- const = None
- for num, val in enumerate(self.statsStore):
- if val[0] == new_text:
- const = num
- break
+ def cb_state_toggled (self, rb):
+
+ plugin = self.get_actual()
- assert (const is not None)
+ if plugin:
+ state = self.buttons.index(rb)
- self.changedPlugins.update({self.plugins[path] : const})
- debug("new changed plugins: %s => %d", self.plugins[path].name, const)
+ self.changedPlugins[plugin] = state
+ debug("new changed plugins: %s => %d", plugin.name, state)
def cb_ok_clicked (self, btn):
for plugin, val in self.changedPlugins.iteritems():
@@ -83,3 +75,29 @@ class PluginWindow (AbstractDialog):
self.close()
return True
+
+ def cb_list_selection (self, selection):
+ plugin = self.get_actual()
+
+ if plugin:
+ if not plugin.description:
+ self.descrLabel.hide()
+ else:
+ self.descrLabel.set_label(plugin.description)
+ self.descrLabel.show()
+
+ self.authorLabel.set_label(plugin.author)
+
+ status = self.changedPlugins.get(plugin, plugin.status)
+ self.buttons[status].set_active(True)
+
+ self.installBtn.hide()
+ self.depExpander.hide()
+
+ def get_actual (self):
+ store, it = self.view.get_selection().get_selected()
+
+ if it:
+ return self.plugins[int(store.get_path(it)[0])]
+ else:
+ return None
diff --git a/portato/plugin.py b/portato/plugin.py
index ae89a1c..cbadfd1 100644
--- a/portato/plugin.py
+++ b/portato/plugin.py
@@ -176,6 +176,7 @@ class Plugin:
self.file = file
self.name = name.firstChild.nodeValue.strip()
self.author = author.firstChild.nodeValue.strip()
+ self.description = ""
self._import = None
self.hooks = []
self.menus = []