summaryrefslogtreecommitdiff
path: root/portato
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/templates/PluginWindow.glade172
-rw-r--r--portato/gui/windows/main.py2
-rw-r--r--portato/gui/windows/plugin.py47
3 files changed, 126 insertions, 95 deletions
diff --git a/portato/gui/templates/PluginWindow.glade b/portato/gui/templates/PluginWindow.glade
index 9e1fc43..f76193e 100644
--- a/portato/gui/templates/PluginWindow.glade
+++ b/portato/gui/templates/PluginWindow.glade
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
-<!--Generated with glade3 3.4.4 on Thu Jul 3 23:56:30 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Jul 4 15:24:27 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>
@@ -38,7 +38,6 @@
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
<property name="label_xalign">0</property>
- <property name="shadow_type">GTK_SHADOW_OUT</property>
<child>
<widget class="GtkTable" id="table1">
<property name="visible">True</property>
@@ -46,82 +45,62 @@
<property name="n_columns">2</property>
<property name="row_spacing">10</property>
<child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
+ <widget class="GtkButton" id="installBtn">
<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="enabledRB">
- <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>
- <signal name="toggled" handler="cb_state_toggled"/>
- </widget>
- </child>
- <child>
- <widget class="GtkRadioButton" id="tempEnabledRB">
- <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="group">enabledRB</property>
- </widget>
- <packing>
- <property name="position">1</property>
- </packing>
- </child>
+ <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>
+ <signal name="clicked" handler="cb_install_clicked"/>
+ </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="y_options"></property>
+ <property name="x_padding">10</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkExpander" id="depExpander">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
<child>
- <widget class="GtkRadioButton" id="tempDisabledRB">
+ <widget class="GtkTreeView" id="depList">
<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="group">enabledRB</property>
- <signal name="toggled" handler="cb_state_toggled"/>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">True</property>
</widget>
- <packing>
- <property name="position">2</property>
- </packing>
</child>
<child>
- <widget class="GtkRadioButton" id="disabledRB">
+ <widget class="GtkLabel" id="label4">
<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="group">enabledRB</property>
- <signal name="toggled" handler="cb_state_toggled"/>
+ <property name="label" translatable="yes">Needed dependencies</property>
+ <property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="type">label_item</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>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_padding">10</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="authorLabel">
+ <widget class="GtkLabel" id="descrLabel">
<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>
+ <property name="y_padding">10</property>
</packing>
</child>
<child>
@@ -138,61 +117,82 @@
</packing>
</child>
<child>
- <widget class="GtkLabel" id="descrLabel">
+ <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>
- <property name="y_padding">10</property>
</packing>
</child>
<child>
- <widget class="GtkExpander" id="depExpander">
+ <widget class="GtkHButtonBox" id="buttonBox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
+ <property name="spacing">5</property>
+ <property name="homogeneous">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_EDGE</property>
<child>
- <widget class="GtkTreeView" id="depList">
+ <widget class="GtkRadioButton" id="enabledRB">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">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>
</child>
<child>
- <widget class="GtkLabel" id="label4">
+ <widget class="GtkRadioButton" id="tempEnabledRB">
<property name="visible">True</property>
- <property name="label" translatable="yes">Needed dependencies</property>
- <property name="single_line_mode">True</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="type">label_item</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="tempDisabledRB">
+ <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="group">enabledRB</property>
+ <signal name="toggled" handler="cb_state_toggled"/>
+ </widget>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <widget class="GtkRadioButton" id="disabledRB">
+ <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="group">enabledRB</property>
+ <signal name="toggled" handler="cb_state_toggled"/>
+ </widget>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
</packing>
</child>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_padding">10</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>
- <property name="y_options"></property>
- <property name="x_padding">10</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="y_options">GTK_FILL</property>
</packing>
</child>
</widget>
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 479274d..265d4dd 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -1553,7 +1553,7 @@ class MainWindow (Window):
else:
plugins = list(queue.get_plugins())
- PluginWindow(self.window, plugins)
+ PluginWindow(self.window, plugins, self.queue)
return True
def cb_show_updates_clicked (self, *args):
diff --git a/portato/gui/windows/plugin.py b/portato/gui/windows/plugin.py
index 9760658..392654e 100644
--- a/portato/gui/windows/plugin.py
+++ b/portato/gui/windows/plugin.py
@@ -15,7 +15,9 @@ from __future__ import absolute_import
import gtk
from .basic import AbstractDialog
+from ..dialogs import blocked_dialog, unmask_dialog
from ...backend import system
+from ...backend.exceptions import PackageNotFoundException, BlockedException
from ...helper import debug
class PluginWindow (AbstractDialog):
@@ -25,7 +27,7 @@ class PluginWindow (AbstractDialog):
for s in (_("Disabled"), _("Temporarily enabled"), _("Enabled"), _("Temporarily disabled")):
statsStore.append([s])
- def __init__ (self, parent, plugins):
+ def __init__ (self, parent, plugins, queue = None):
"""Constructor.
@param parent: the parent window
@@ -33,7 +35,10 @@ class PluginWindow (AbstractDialog):
AbstractDialog.__init__(self, parent)
self.plugins = plugins
+ self.queue = queue
self.changedPlugins = {}
+ self.inst = []
+ self.ninst = []
self.buttons = map(self.tree.get_widget, ("disabledRB", "tempEnabledRB", "enabledRB", "tempDisabledRB"))
map(lambda b: b.set_mode(False), self.buttons)
@@ -46,6 +51,8 @@ class PluginWindow (AbstractDialog):
self.depList = self.tree.get_widget("depList")
self.build_dep_list()
+ self.buttonBox = self.tree.get_widget("buttonBox")
+
self.instIcon = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
self.view = self.tree.get_widget("pluginList")
@@ -109,6 +116,8 @@ class PluginWindow (AbstractDialog):
def cb_list_selection (self, selection):
plugin = self.get_actual()
+ self.inst = []
+ self.ninst = []
if plugin:
if not plugin.description:
@@ -123,23 +132,45 @@ class PluginWindow (AbstractDialog):
self.buttons[status].set_active(True)
if plugin.deps:
- inst = []
- ninst = []
for dep in plugin.deps:
- if system.find_packages(dep, pkgSet = "installed"):
- inst.append(dep)
+ if system.find_packages(dep, pkgSet = "installed", with_version = False):
+ self.inst.append(dep)
else:
- ninst.append(dep)
+ self.ninst.append(dep)
- self.fill_dep_list(inst, ninst)
+ self.fill_dep_list(self.inst, self.ninst)
self.depExpander.show()
self.installBtn.show()
- self.installBtn.set_sensitive(bool(ninst))
+ self.installBtn.set_sensitive(bool(self.ninst))
+
else:
self.installBtn.hide()
self.depExpander.hide()
+
+ self.buttonBox.set_sensitive(not plugin._unresolved_deps and plugin.status != plugin.STAT_HARD_DISABLED)
+
+ def cb_install_clicked (self, *args):
+ if not self.queue:
+ return False
+
+ for cpv in self.ninst:
+
+ pkg = system.find_best_match(cpv, masked = False, only_cpv = True)
+ if not pkg:
+ pkg = system.find_best_match(cpv, masked = True, only_cpv = True)
+
+ try:
+ try:
+ self.queue.append(pkg, type = "install")
+ except PackageNotFoundException, e:
+ if unmask_dialog(e[0]) == gtk.RESPONSE_YES:
+ self.queue.append(pkg, type = "install", unmask = True)
+ except BlockedException, e:
+ blocked_dialog(e[0], e[1])
+
+ return True
def get_actual (self):
store, it = self.view.get_selection().get_selected()