From a82504f1627ba80641ad4c3ea8721a2701c364a7 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Fri, 17 Aug 2007 03:54:39 +0000 Subject: improved terminal --- doc/Changelog | 1 + portato/gui/gtk/wrapper.py | 4 +- portato/gui/gui_helper.py | 20 +- portato/gui/templates/portato.glade | 422 ++++++++++++++++++------------------ portato/gui/wrapper.py | 5 + 5 files changed, 233 insertions(+), 219 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index 64ba911..4c7fd28 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -7,6 +7,7 @@ next: - added notifies - added listener / launch gksu/kdesu by ourselves - now showing differences between "installed" and "enabled" useflags +- improved terminal 0.8.1: - bugfixes diff --git a/portato/gui/gtk/wrapper.py b/portato/gui/gtk/wrapper.py index f085efa..7e67eb1 100644 --- a/portato/gui/gtk/wrapper.py +++ b/portato/gui/gtk/wrapper.py @@ -102,4 +102,6 @@ class GtkTree (Tree): class GtkConsole (vte.Terminal, Console): """The implementation of the abstract Console for GTK.""" - pass + + def reset (self): + vte.Terminal.reset(self, True, True) diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py index 87fcf69..3ed8152 100644 --- a/portato/gui/gui_helper.py +++ b/portato/gui/gui_helper.py @@ -272,6 +272,7 @@ class EmergeQueue: # the emerge process self.process = None self.threadQueue = WaitingQueue(threadClass = threadClass) + self.pty = None # dictionaries with data about the packages in the queue self.iters = {} # iterator in the tree @@ -497,11 +498,14 @@ class EmergeQueue: command = system.get_merge_command() # open tty - (master, slave) = pty.openpty() - self.console.set_pty(master) + if not self.pty: + self.pty = pty.openpty() + self.console.set_pty(self.pty[0]) + else: + self.console.reset() # start emerge - self.process = Popen(command+options+packages, stdout = slave, stderr = STDOUT, shell = False, env = system.get_environment(), preexec_fn = os.setsid) + self.process = Popen(command+options+packages, stdout = self.pty[1], stderr = STDOUT, shell = False, env = system.get_environment(), preexec_fn = os.setsid) # remove packages from queue for i in it: @@ -518,18 +522,22 @@ class EmergeQueue: if self.title_update: self.title_update(None) + if self.process is None: # someone resetted this + self.threadQueue.next() return + else: + ret = self.process.returncode + self.process = None + self.threadQueue.next() - @plugin.hook("after_emerge", packages = packages, retcode = self.process.returncode) + @plugin.hook("after_emerge", packages = packages, retcode = ret) def update_packages(): for cat in unique_array([system.split_cpv(p)[0] for p in packages if p not in ["world", "system"]]): self.db.reload(cat) debug("Category %s refreshed", cat) update_packages() - self.process = None - self.threadQueue.next() sub_emerge(command) diff --git a/portato/gui/templates/portato.glade b/portato/gui/templates/portato.glade index c7598b4..c0dee9b 100644 --- a/portato/gui/templates/portato.glade +++ b/portato/gui/templates/portato.glade @@ -452,107 +452,52 @@ 5 3 - + True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 1 + True - + + True + True + Installed + 0 + True + + + + False + - - - 3 - 1 - 2 - GTK_EXPAND - - - - - - True - True - <b>Installed, but not in portage anymore</b> - True - - - 3 - 2 - 3 - GTK_FILL - - - - - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - 5 - + True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - GTK_POLICY_NEVER - GTK_POLICY_AUTOMATIC - - - True - True - GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK - True - False - - - + True + Masked + 0 + True + - False + False + 1 - + True - False - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - - - True - - + True + Testing + 0 + True + - 1 + False + 2 - - 3 - 3 - 4 - 5 - 5 - - - - - True - GTK_JUSTIFY_CENTER - True - - - 3 - GTK_FILL - - 10 - - - - - True - True - <span foreground='red'><b>MISSING KEYWORD</b></span> - True - 3 2 @@ -619,51 +564,90 @@ - + True - 1 - True + True + <span foreground='red'><b>MISSING KEYWORD</b></span> + True + + + 3 + 2 + 3 + GTK_FILL + + + + + True + GTK_JUSTIFY_CENTER + True + + + 3 + GTK_FILL + + 10 + + + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + 5 - + True - True - Installed - 0 - True - + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + + + True + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + True + False + + + - False + False - + True - True - Masked - 0 - True - + False + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + + + True + + - False 1 - - - True - True - Testing - 0 - True - - - - False - 2 - - + + + 3 + 3 + 4 + 5 + 5 + + + + + True + True + <b>Installed, but not in portage anymore</b> + True 3 @@ -672,6 +656,22 @@ GTK_FILL + + + True + GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK + + + + + + 3 + 1 + 2 + GTK_EXPAND + + + False @@ -1149,189 +1149,189 @@ - + 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 - 0 - 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 0 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 0 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 + 0 + 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 @@ -1814,8 +1814,6 @@ Many thanks to the Porthole team which often inspired me or gave me hints. False GTK_WIN_POS_CENTER_ALWAYS GDK_WINDOW_TYPE_HINT_SPLASHSCREEN - True - True True False False diff --git a/portato/gui/wrapper.py b/portato/gui/wrapper.py index 1a9ef8f..c7a5916 100644 --- a/portato/gui/wrapper.py +++ b/portato/gui/wrapper.py @@ -175,3 +175,8 @@ class Console: @returns: title of the console or None""" raise NotImplementedError + + def reset (self): + """Resets the terminal.""" + + raise NotImplementedError -- cgit v1.2.3