summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornecoro <>2007-07-24 21:28:14 +0000
committernecoro <>2007-07-24 21:28:14 +0000
commit00af1784b1652f3bed04c63e2faaeb03ca185ed4 (patch)
treebb89a19705ef562734c9190d1dfd8577d45730f7
parent44a726cd69e3e0d5c50890946b366c441a575a37 (diff)
downloadportato-00af1784b1652f3bed04c63e2faaeb03ca185ed4.tar.gz
portato-00af1784b1652f3bed04c63e2faaeb03ca185ed4.tar.bz2
portato-00af1784b1652f3bed04c63e2faaeb03ca185ed4.zip
made the resume_loop-plugin change titles too
Diffstat (limited to '')
-rw-r--r--doc/Changelog1
-rw-r--r--doc/Hooks1
-rw-r--r--plugins/resume_loop.xml2
-rw-r--r--portato/gui/gui_helper.py2
-rw-r--r--portato/plugins/resume_loop.py23
5 files changed, 22 insertions, 7 deletions
diff --git a/doc/Changelog b/doc/Changelog
index 0eb8d51..1cf2be9 100644
--- a/doc/Changelog
+++ b/doc/Changelog
@@ -5,6 +5,7 @@ next:
- changed plugin-structures
- added ability of pausing the emerge process
- nicier log output
+- log viewers
0.7.5:
- new icon by p4r4d0x
diff --git a/doc/Hooks b/doc/Hooks
index 58dabd7..43dfe3b 100644
--- a/doc/Hooks
+++ b/doc/Hooks
@@ -15,6 +15,7 @@ Parameters:
- string[] packages: Packages to emerge (includes "world", "system").
- string[] command: The exact command to execute.
- portato.gui.wrapper.Console console: The console the output will be written to.
+ - function(string) -> None title_update: Function which updates the console title in the GUIs.
Return if override: Nothing
diff --git a/plugins/resume_loop.xml b/plugins/resume_loop.xml
index 14575cd..01dca78 100644
--- a/plugins/resume_loop.xml
+++ b/plugins/resume_loop.xml
@@ -5,7 +5,7 @@
<import>portato.plugins.resume_loop</import>
<hooks>
- <hook type="emerge" call="set_console">
+ <hook type="emerge" call="set_data">
<connect />
</hook>
diff --git a/portato/gui/gui_helper.py b/portato/gui/gui_helper.py
index f9dd3fe..1c8c411 100644
--- a/portato/gui/gui_helper.py
+++ b/portato/gui/gui_helper.py
@@ -491,7 +491,7 @@ class EmergeQueue:
@param command: the command to execute - default is "/usr/bin/python /usr/bin/emerge"
@type command: string[]"""
- @plugin.hook("emerge", packages = packages, command = command, console = self.console)
+ @plugin.hook("emerge", packages = packages, command = command, console = self.console, title_update = self.title_update)
def sub_emerge(command):
if command is None:
command = system.get_merge_command()
diff --git a/portato/plugins/resume_loop.py b/portato/plugins/resume_loop.py
index 45c735a..b33f4c7 100644
--- a/portato/plugins/resume_loop.py
+++ b/portato/plugins/resume_loop.py
@@ -10,17 +10,19 @@
#
# Written by René 'Necoro' Neumann <necoro@necoro.net>
-import pty
-from subprocess import call, STDOUT
+import pty, time
+from subprocess import Popen, STDOUT
from portato.backend import system
from portato.helper import debug, warning
console = None
+title_update = None
command = "until emerge --resume --skipfirst; do : ; done"
-def set_console (*args, **kwargs):
- global console
+def set_data (*args, **kwargs):
+ global console, title_update
console = kwargs["console"]
+ title_update = kwargs["title_update"]
def resume_loop (retcode, *args, **kwargs):
if retcode is None:
@@ -36,4 +38,15 @@ def resume_loop (retcode, *args, **kwargs):
# open tty
(master, slave) = pty.openpty()
console.set_pty(master)
- call(command, stdout = slave, stderr = STDOUT, shell = True, env = system.get_environment())
+ p = Popen(command, stdout = slave, stderr = STDOUT, shell = True, env = system.get_environment())
+
+ # update titles
+ old_title = console.get_window_title()
+ while p and p.poll() is None:
+ if title_update :
+ title = console.get_window_title()
+ if title != old_title:
+ title_update(title)
+ time.sleep(0.5)
+
+ if title_update: title_update(None)