From 285ef518c9f99349153581d9addba665ba3944eb Mon Sep 17 00:00:00 2001 From: necoro <> Date: Sun, 3 Dec 2006 19:13:44 +0000 Subject: Added console-status --- portato/gui/gtk/glade/portato.glade | 383 ++++++++++++++++++------------------ portato/gui/gtk/windows.py | 18 +- portato/gui/gtk/wrapper.py | 3 + portato/gui/gui_helper.py | 16 +- portato/gui/wrapper.py | 6 + 5 files changed, 228 insertions(+), 198 deletions(-) (limited to 'portato/gui') diff --git a/portato/gui/gtk/glade/portato.glade b/portato/gui/gtk/glade/portato.glade index cf187c7..811dced 100644 --- a/portato/gui/gtk/glade/portato.glade +++ b/portato/gui/gtk/glade/portato.glade @@ -224,56 +224,79 @@ True - True True 4 2 - + True - 1 - True - - - True - True - Installed - True - - - - False - - + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC - + True - True - Masked - True - - - False - 1 - + + + 2 + 2 + 3 + 5 + 5 + + + + + True - - True - True - Testing - True - - - - False - 2 - + + + 1 + 2 + GTK_FILL + 5 + + + + + True + GTK_JUSTIFY_CENTER + True + + + 2 + GTK_FILL + + 10 + + + + + True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 1 + 2 + 1 + 2 + GTK_FILL + + + + + True + True + <b>Installed, but not in portage anymore</b> + True + 1 2 @@ -326,79 +349,55 @@ - - True - True - <b>Installed, but not in portage anymore</b> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - - - 1 - 2 - 1 - 2 - GTK_FILL - - - - - True - GTK_JUSTIFY_CENTER - True - - - 2 - GTK_FILL - - 10 - - - - + True + 1 + True - + + True + True + Installed + True + + + + False + - - - 1 - 2 - GTK_FILL - 5 - - - - - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - + True + True + Masked + True + + + False + 1 + + + + + True + True + Testing + True + + + + False + 2 + + 1 2 - 2 - 3 - 5 - 5 + 1 + 2 + GTK_FILL @@ -782,186 +781,186 @@ - + True + 0 + 5 + <u><i>Masking Keywords</i></u> + True + True - 1 - 2 - 3 - 4 + 7 + 8 + 5 - + True 0 - File name to use, if package.use is a directory: + 5 + <u><i>Testing Keywords</i></u> + True True - 3 - 4 + 4 + 5 + 5 - + True - Add only exact version to package.use - True + 0 + 5 + <u><i>Use-Flags</i></u> + True + True + + + 1 + 2 + 6 + + + + + True + + + True + 0 + GTK_SHADOW_OUT + + + True + 0 + <u>You may use the following placeholders:</u> + +<i>$(cat)</i>: category +<i>$(pkg)</i>: package name +<i>$(cat-1)/$(cat-2)</i>: first/second part of the category + True + + + + + + label_item + + + + 2 - 2 - 3 - + True - Add only exact version to package.keywords + Add only exact version to package.mask/package.unmask True 2 - 5 - 6 + 8 + 9 - + True 0 - File name to use, if package.keywords is a directory: + File name to use, if package.mask/package.unmask is a directory: True - 6 - 7 + 9 + 10 - + True 1 2 - 6 - 7 + 9 + 10 - + True 1 2 - 9 - 10 + 6 + 7 - + True 0 - File name to use, if package.mask/package.unmask is a directory: + File name to use, if package.keywords is a directory: True - 9 - 10 + 6 + 7 - + True - Add only exact version to package.mask/package.unmask + Add only exact version to package.keywords True 2 - 8 - 9 + 5 + 6 - + True - - - True - 0 - GTK_SHADOW_OUT - - - True - 0 - <u>You may use the following placeholders:</u> - -<i>$(cat)</i>: category -<i>$(pkg)</i>: package name -<i>$(cat-1)/$(cat-2)</i>: first/second part of the category - True - - - - - - label_item - - - - + Add only exact version to package.use + True 2 + 2 + 3 - - True - 0 - 5 - <u><i>Use-Flags</i></u> - True - True - - - 1 - 2 - 6 - - - - + True 0 - 5 - <u><i>Testing Keywords</i></u> - True + File name to use, if package.use is a directory: True - 4 - 5 - 5 + 3 + 4 - + True - 0 - 5 - <u><i>Masking Keywords</i></u> - True - True - 7 - 8 - 5 + 1 + 2 + 3 + 4 diff --git a/portato/gui/gtk/windows.py b/portato/gui/gtk/windows.py index f4a37fe..7e8e247 100644 --- a/portato/gui/gtk/windows.py +++ b/portato/gui/gtk/windows.py @@ -605,10 +605,10 @@ class MainWindow (Window): # XXX why is this not working with the colors term.set_color_background(gtk.gdk.color_parse("white")) term.set_color_foreground(gtk.gdk.color_parse("black")) - termHB = self.tree.get_widget("termHB") + self.termHB = self.tree.get_widget("termHB") termScroll = gtk.VScrollbar(term.get_adjustment()) - termHB.pack_start(term, True, True) - termHB.pack_start(termScroll, False) + self.termHB.pack_start(term, True, True) + self.termHB.pack_start(termScroll, False) # notebook self.notebook = self.tree.get_widget("notebook") @@ -625,7 +625,7 @@ class MainWindow (Window): # set emerge queue self.queueTree = GtkTree(self.queueList.get_model()) - self.queue = EmergeQueue(console = GtkConsole(term), tree = self.queueTree, db = self.db) + self.queue = EmergeQueue(console = GtkConsole(term), tree = self.queueTree, db = self.db, title_update = self.title_update) def show_package (self, *args, **kwargs): self.packageTable.update(*args, **kwargs) @@ -695,6 +695,16 @@ class MainWindow (Window): """Is called when we want to jump to a specific package.""" self.show_package(cp, self.queue) + def title_update (self, title): + def caller(self, t): + self.notebook.set_tab_label_text(self.termHB, t) + + if title == None: title = "Console" + else: title = ("Console (%s)" % title) + + gobject.idle_add(caller, self, title) + + def cb_cat_list_selection (self, view): """Callback for a category-list selection. Updates the package list with the packages in the category.""" # get the selected category diff --git a/portato/gui/gtk/wrapper.py b/portato/gui/gtk/wrapper.py index 7066acb..95d8afa 100644 --- a/portato/gui/gtk/wrapper.py +++ b/portato/gui/gtk/wrapper.py @@ -98,6 +98,9 @@ class GtkConsole (Console): self.console = console + def get_window_title(self): + return self.console.get_window_title() + def set_pty (self, pty): self.console.set_pty(pty) diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 6cc09a3..0529767 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -25,6 +25,7 @@ from wrapper import Console, Tree from subprocess import Popen, PIPE, STDOUT from threading import Thread import pty +import time class Config: """Wrapper around a ConfigParser and for additional local configurations.""" @@ -242,7 +243,7 @@ class Database: class EmergeQueue: """This class manages the emerge queue.""" - def __init__ (self, tree = None, console = None, db = None): + def __init__ (self, tree = None, console = None, db = None, title_update = None): """Constructor. @param tree: Tree to append all the items to. @@ -269,6 +270,7 @@ class EmergeQueue: if self.console and not isinstance(self.console, Console): raise TypeError, "console passed is not a Console-object" self.db = db + self.title_update = title_update # our iterators pointing at the toplevels; they are set to None if we do not have a tree if self.tree: @@ -432,8 +434,18 @@ class EmergeQueue: @type packages: list of cpvs @param process: The process we have to wait for before we can do our work. @type process: subprocess.Popen""" + + old_title = self.console.get_window_title() + if process: + while process.poll() == None: + if self.title_update : + title = self.console.get_window_title() + if title != old_title: + self.title_update(title) + time.sleep(0.5) + + if self.title_update: self.title_update(None) - if process: process.wait() for p in packages: if p in ["world", "system"]: continue cat = backend.split_package_name(p)[0] # get category diff --git a/portato/gui/wrapper.py b/portato/gui/wrapper.py index def5c50..86f4efe 100644 --- a/portato/gui/wrapper.py +++ b/portato/gui/wrapper.py @@ -176,6 +176,12 @@ class Console: @type pty: file-descriptor""" raise NotImplementedError + def get_window_title (self): + """This should return the current title of the console. If this is not possible, it must return None. + + @returns: title of the console or None""" + raise NotImplementedError + def get_original(self): """Returns the original console-object. -- cgit v1.2.3-54-g00ecf