summaryrefslogtreecommitdiff
path: root/portato/gui
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--portato/gui/templates/MainWindow.glade206
-rw-r--r--portato/gui/views.py14
-rw-r--r--portato/gui/windows/main.py215
3 files changed, 217 insertions, 218 deletions
diff --git a/portato/gui/templates/MainWindow.glade b/portato/gui/templates/MainWindow.glade
index f609344..50db1d8 100644
--- a/portato/gui/templates/MainWindow.glade
+++ b/portato/gui/templates/MainWindow.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.5 on Mon Jul 28 22:08:52 2008 -->
+<!--Generated with glade3 3.4.5 on Fri Dec 5 12:41:55 2008 -->
<glade-interface>
<widget class="GtkWindow" id="MainWindow">
<property name="border_width">2</property>
@@ -46,8 +46,8 @@
<property name="label" translatable="yes">Re_load Portage</property>
<property name="use_underline">True</property>
<signal name="activate" handler="cb_reload_clicked"/>
- <accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<accelerator key="F5" modifiers="" signal="activate"/>
+ <accelerator key="R" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="menu-item-image9">
<property name="visible">True</property>
@@ -424,7 +424,6 @@
<child>
<widget class="GtkTreeView" id="pkgList">
<property name="visible">True</property>
- <property name="headers_clickable">True</property>
<property name="search_column">0</property>
</widget>
</child>
@@ -442,7 +441,6 @@
<child>
<widget class="GtkTreeView" id="versionList">
<property name="visible">True</property>
- <property name="headers_clickable">True</property>
<property name="search_column">1</property>
</widget>
</child>
@@ -597,271 +595,271 @@
<placeholder/>
</child>
<child>
- <widget class="GtkLabel" id="useFlagsLabel">
+ <widget class="GtkLabel" id="licenseLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label">use flags</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_END</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">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="useFlagsLabelLabel">
+ <widget class="GtkLabel" id="licenseLabelLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Use Flags:&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;License:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="testingCheck">
+ <widget class="GtkLabel" id="notInSysLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
- <property name="label" translatable="yes">Testing</property>
- <property name="xalign">0</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="cb_testing_toggled"/>
+ <property name="label" translatable="yes">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="top_attach">7</property>
- <property name="bottom_attach">8</property>
- <property name="x_options">GTK_FILL</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="maskedLabel">
+ <widget class="GtkLabel" id="missingLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="xalign">0</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</property>
+ <property name="use_markup">True</property>
</widget>
<packing>
- <property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
+ <property name="top_attach">5</property>
+ <property name="bottom_attach">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="maskedCheck">
+ <widget class="GtkHBox" id="linkBox">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">Masked</property>
- <property name="xalign">0</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <signal name="toggled" handler="cb_masked_toggled"/>
+ <property name="spacing">5</property>
+ <child>
+ <placeholder/>
+ </child>
</widget>
<packing>
- <property name="top_attach">8</property>
- <property name="bottom_attach">9</property>
- <property name="x_options">GTK_FILL</property>
+ <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>
</packing>
</child>
<child>
- <widget class="GtkCheckButton" id="installedCheck">
+ <widget class="GtkLabel" id="descLabelLabel">
<property name="visible">True</property>
- <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">Installed</property>
<property name="xalign">0</property>
- <property name="response_id">0</property>
- <property name="draw_indicator">True</property>
- <signal name="button_press_event" handler="cb_button_pressed"/>
+ <property name="label" translatable="yes">&lt;b&gt;Description:&lt;/b&gt;</property>
+ <property name="use_markup">True</property>
+ <property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="top_attach">6</property>
- <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
+ <property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="homepageLinkLabel">
+ <widget class="GtkLabel" id="overlayLabelLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Homepage:&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Overlay:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="overlayLabel">
+ <widget class="GtkLabel" id="descLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">label</property>
- <property name="single_line_mode">True</property>
+ <property name="wrap">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"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="descLabel">
+ <widget class="GtkLabel" id="overlayLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">label</property>
- <property name="wrap">True</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"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="overlayLabelLabel">
+ <widget class="GtkLabel" id="homepageLinkLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Overlay:&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Homepage:&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="top_attach">2</property>
+ <property name="bottom_attach">3</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="descLabelLabel">
+ <widget class="GtkCheckButton" id="installedCheck">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Installed</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;Description:&lt;/b&gt;</property>
- <property name="use_markup">True</property>
- <property name="single_line_mode">True</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="button_press_event" handler="cb_button_pressed"/>
</widget>
<packing>
+ <property name="top_attach">6</property>
+ <property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
- <property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkHBox" id="linkBox">
+ <widget class="GtkCheckButton" id="maskedCheck">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<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>
- <placeholder/>
- </child>
+ <property name="no_show_all">True</property>
+ <property name="label" translatable="yes">Masked</property>
+ <property name="xalign">0</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="cb_masked_toggled"/>
</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="top_attach">8</property>
+ <property name="bottom_attach">9</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="missingLabel">
+ <widget class="GtkLabel" id="maskedLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="no_show_all">True</property>
- <property name="label" translatable="yes">&lt;span foreground='red'&gt;&lt;b&gt;MISSING KEYWORD&lt;/b&gt;&lt;/span&gt;</property>
- <property name="use_markup">True</property>
+ <property name="xalign">0</property>
</widget>
<packing>
+ <property name="left_attach">1</property>
<property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">8</property>
+ <property name="bottom_attach">9</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="notInSysLabel">
+ <widget class="GtkCheckButton" id="testingCheck">
<property name="visible">True</property>
+ <property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
- <property name="label" translatable="yes">&lt;b&gt;Installed, but not in portage anymore&lt;/b&gt;</property>
- <property name="use_markup">True</property>
+ <property name="label" translatable="yes">Testing</property>
+ <property name="xalign">0</property>
+ <property name="response_id">0</property>
+ <property name="draw_indicator">True</property>
+ <signal name="toggled" handler="cb_testing_toggled"/>
</widget>
<packing>
- <property name="right_attach">2</property>
- <property name="top_attach">5</property>
- <property name="bottom_attach">6</property>
+ <property name="top_attach">7</property>
+ <property name="bottom_attach">8</property>
+ <property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="licenseLabelLabel">
+ <widget class="GtkLabel" id="useFlagsLabelLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">&lt;b&gt;License:&lt;/b&gt;</property>
+ <property name="label" translatable="yes">&lt;b&gt;Use Flags:&lt;/b&gt;</property>
<property name="use_markup">True</property>
<property name="single_line_mode">True</property>
</widget>
<packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options"></property>
<property name="y_padding">5</property>
</packing>
</child>
<child>
- <widget class="GtkLabel" id="licenseLabel">
+ <widget class="GtkLabel" id="useFlagsLabel">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="no_show_all">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">label</property>
+ <property name="label">use flags</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_END</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">3</property>
- <property name="bottom_attach">4</property>
+ <property name="top_attach">4</property>
+ <property name="bottom_attach">5</property>
<property name="y_options"></property>
</packing>
</child>
@@ -893,7 +891,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="headers_clickable">True</property>
</widget>
</child>
</widget>
@@ -921,14 +918,7 @@
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
<child>
- <widget class="GtkTreeView" id="dependencyList">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
- <property name="headers_visible">False</property>
- <property name="headers_clickable">True</property>
- <property name="enable_search">False</property>
- </widget>
+ <placeholder/>
</child>
</widget>
<packing>
diff --git a/portato/gui/views.py b/portato/gui/views.py
index 85a06c8..26a8a89 100644
--- a/portato/gui/views.py
+++ b/portato/gui/views.py
@@ -46,6 +46,20 @@ class LazyView (object):
def _get_content (self):
raise NotImplementedError
+class LazyStoreView (gtk.TreeView, LazyView):
+ def __init__ (self, update_fn):
+ gtk.TreeView.__init__(self)
+ LazyView.__init__(self)
+
+ self.update_fn = update_fn
+
+ def cb_mapped (self, *args):
+ if self.updated and self.pkg:
+ self.set_model(self.update_fn(self.pkg))
+ self.updated = False
+
+ return False
+
class ListView (gtk.TextView, LazyView):
def __init__ (self, content_fn):
diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py
index 5420b40..dd556bb 100644
--- a/portato/gui/windows/main.py
+++ b/portato/gui/windows/main.py
@@ -34,7 +34,7 @@ from ..utils import Database, Config, GtkThread, get_color
from ..queue import EmergeQueue
from ..session import SESSION_VERSION, SessionException, OldSessionException, NewSessionException
from ..wrapper import GtkTree, GtkConsole
-from ..views import LogView, HighlightView, InstalledOnlyView
+from ..views import LogView, HighlightView, InstalledOnlyView, LazyStoreView
from ..dialogs import (blocked_dialog, changed_flags_dialog, io_ex_dialog,
nothing_found_dialog, queue_not_empty_dialog, remove_deps_dialog,
remove_queue_dialog, remove_updates_dialog, unmask_dialog)
@@ -97,21 +97,12 @@ class PackageTable:
self.useList = self.tree.get_widget("useList")
self.build_use_list()
- # depList
- self.depList = self.tree.get_widget("dependencyList")
- self.build_dep_list()
-
# views
self.ebuildView = self.tree.get_widget("ebuildScroll").get_child()
self.changelogView = self.tree.get_widget("changelogScroll").get_child()
self.filesView = self.tree.get_widget("filesScroll").get_child()
+ self.depView = self.tree.get_widget("dependencyScroll").get_child()
- # icons
- self.icons = {}
- self.icons["use"] = self.window.render_icon(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
- self.icons["installed"] = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
- self.icons["or"] = self.window.render_icon(gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_MENU)
- self.icons["block"] = self.window.render_icon(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
def update (self, pkg, queue = None, doEmerge = True, instantChange = False, type = None):
"""Updates the table to show the contents for the package.
@@ -205,78 +196,6 @@ class PackageTable:
self.useFlagsLL.hide()
self.useFlagsLabel.hide()
- def fill_dep_list(self):
-
- store = self.depList.get_model()
-
- def sort_key (x):
- split = system.split_cpv(x.dep)
-
- if split is None: # split_cpv returns None if this is only a CP; we assume there are only valid deps
- return x.dep
- else:
- return "/".join(split[0:2])
-
- def cmp_flag (x, y):
- # get strings - as tuples are passed
- x = x[0]
- y = y[0]
-
- # remove "!"
- ret = 0
- if x[0] == "!":
- ret = 1
- x = x[1:]
- if y[0] == "!":
- ret = ret - 1 # if it is already 1, it is 0 now :)
- y = y[1:]
-
- # cmp -- if two flags are equal, the negated one is greater
- return cmp(x,y) or ret
-
- def get_icon (dep):
- if dep.satisfied:
- return self.icons["installed"]
- elif dep.dep[0] == "!":
- return self.icons["block"]
- else:
- return None
-
- def add (tree, it):
- # useflags
- flags = sorted(tree.flags.iteritems(), cmp = cmp_flag)
- for use, usetree in flags:
- if use[0] == "!":
- usestring = _("If '%s' is disabled") % use[1:]
- else:
- usestring = _("If '%s' is enabled") % use
- useit = store.append(it, [self.icons["use"], usestring])
- add(usetree, useit)
-
- # ORs
- for ortree in tree.ors:
- orit = store.append(it, [self.icons["or"], _("One of the following")])
- add(ortree, orit)
-
- # Sub (all of)
- for subtree in tree.subs:
- allit = store.append(it, [None, _("All of the following")])
- add(subtree, allit)
-
- # normal
- ndeps = sorted(tree.deps, key = sort_key)
- for dep in ndeps:
- store.append(it, [get_icon(dep), dep.dep])
-
- try:
- deptree = self.pkg.get_dependencies()
- except AssertionError:
- w = _("Can't display dependencies: This package has an unsupported dependency string.")
- error(w)
- store.append(None, [None, w])
- else:
- add(deptree, None)
-
def fill_use_list(self):
pkg = self.pkg
@@ -305,23 +224,6 @@ class PackageTable:
installed = use in instuse
store.append(actual_exp_it, [enabled, installed, use, system.get_use_desc(use, self.pkg.get_cp())])
- def build_dep_list (self):
- store = gtk.TreeStore(gtk.gdk.Pixbuf, str)
-
- self.depList.set_model(store)
-
- col = gtk.TreeViewColumn()
-
- cell = gtk.CellRendererPixbuf()
- col.pack_start(cell, False)
- col.add_attribute(cell, "pixbuf", 0)
-
- cell = gtk.CellRendererText()
- col.pack_start(cell, True)
- col.add_attribute(cell, "text", 1)
-
- self.depList.append_column(col)
-
def build_use_list (self):
"""Builds the useList."""
store = gtk.TreeStore(bool, bool, str, str)
@@ -365,7 +267,7 @@ class PackageTable:
pkg = self.pkg
# set the views
- for v in (self.ebuildView, self.changelogView, self.filesView):
+ for v in (self.ebuildView, self.changelogView, self.filesView, self.depView):
v.update(pkg, force = self.notebook.get_nth_page(self.notebook.get_current_page()) == v.get_parent())
# set the labels
@@ -376,11 +278,6 @@ class PackageTable:
self.useList.columns_autosize()
self.fill_use_list()
- # set dep list
- self.depList.get_model().clear()
- self.useList.columns_autosize()
- self.fill_dep_list()
-
#
# rebuild the buttons and checkboxes in all the different manners which are possible
#
@@ -593,8 +490,12 @@ class MainWindow (Window):
self.showAll = True # show only installed or all packages?
self.__searchChanged = False
- # installed pixbuf
- self.instPixbuf = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
+ # icons
+ self.icons = {}
+ self.icons["use"] = self.window.render_icon(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
+ self.icons["installed"] = self.window.render_icon(gtk.STOCK_YES, gtk.ICON_SIZE_MENU)
+ self.icons["or"] = self.window.render_icon(gtk.STOCK_MEDIA_PAUSE, gtk.ICON_SIZE_MENU)
+ self.icons["block"] = self.window.render_icon(gtk.STOCK_NO, gtk.ICON_SIZE_MENU)
# get the logging window as soon as possible
self.logView = LogView(self.tree.get_widget("logView"))
@@ -683,6 +584,12 @@ class MainWindow (Window):
filesScroll = self.tree.get_widget("filesScroll")
filesScroll.add(InstalledOnlyView(show_files))
+
+ depScroll = self.tree.get_widget("dependencyScroll")
+ self.depList = LazyStoreView(self.fill_dep_list)
+ self.build_dep_list()
+ depScroll.add(self.depList)
+
# table
self.packageTable = PackageTable(self)
@@ -886,7 +793,7 @@ class MainWindow (Window):
if name:
for cat, pkg, is_inst in self.db.get_cat(name, self.sortPkgListByName):
if is_inst:
- icon = self.instPixbuf
+ icon = self.icons["installed"]
elif not self.showAll:
continue # ignore not installed packages
else:
@@ -949,7 +856,7 @@ class MainWindow (Window):
# append versions
for vers, inst, slot in ((x.get_version(), x.is_installed(), get_slot(x)) for x in packages):
if inst:
- icon = self.instPixbuf
+ icon = self.icons["installed"]
else:
icon = None
@@ -974,6 +881,94 @@ class MainWindow (Window):
self.versionList.get_selection().select_path(pos)
self.versionList.scroll_to_cell(pos)
+ def build_dep_list (self):
+
+ col = gtk.TreeViewColumn()
+
+ cell = gtk.CellRendererPixbuf()
+ col.pack_start(cell, False)
+ col.add_attribute(cell, "pixbuf", 0)
+
+ cell = gtk.CellRendererText()
+ col.pack_start(cell, True)
+ col.add_attribute(cell, "text", 1)
+
+ self.depList.append_column(col)
+
+ def fill_dep_list(self, pkg):
+
+ store = gtk.TreeStore(gtk.gdk.Pixbuf, str)
+
+ def sort_key (x):
+ split = system.split_cpv(x.dep)
+
+ if split is None: # split_cpv returns None if this is only a CP; we assume there are only valid deps
+ return x.dep
+ else:
+ return "/".join(split[0:2])
+
+ def cmp_flag (x, y):
+ # get strings - as tuples are passed
+ x = x[0]
+ y = y[0]
+
+ # remove "!"
+ ret = 0
+ if x[0] == "!":
+ ret = 1
+ x = x[1:]
+ if y[0] == "!":
+ ret = ret - 1 # if it is already 1, it is 0 now :)
+ y = y[1:]
+
+ # cmp -- if two flags are equal, the negated one is greater
+ return cmp(x,y) or ret
+
+ def get_icon (dep):
+ if dep.satisfied:
+ return self.icons["installed"]
+ elif dep.dep[0] == "!":
+ return self.icons["block"]
+ else:
+ return None
+
+ def add (tree, it):
+ # useflags
+ flags = sorted(tree.flags.iteritems(), cmp = cmp_flag)
+ for use, usetree in flags:
+ if use[0] == "!":
+ usestring = _("If '%s' is disabled") % use[1:]
+ else:
+ usestring = _("If '%s' is enabled") % use
+ useit = store.append(it, [self.icons["use"], usestring])
+ add(usetree, useit)
+
+ # ORs
+ for ortree in tree.ors:
+ orit = store.append(it, [self.icons["or"], _("One of the following")])
+ add(ortree, orit)
+
+ # Sub (all of)
+ for subtree in tree.subs:
+ allit = store.append(it, [None, _("All of the following")])
+ add(subtree, allit)
+
+ # normal
+ ndeps = sorted(tree.deps, key = sort_key)
+ for dep in ndeps:
+ store.append(it, [get_icon(dep), dep.dep])
+
+ try:
+ deptree = pkg.get_dependencies()
+ except AssertionError:
+ w = _("Can't display dependencies: This package has an unsupported dependency string.")
+ error(w)
+ store.append(None, [None, w])
+ else:
+ add(deptree, None)
+
+ return store
+
def refresh_stores (self):
"""
Refreshes the category and package stores.