From 00af1784b1652f3bed04c63e2faaeb03ca185ed4 Mon Sep 17 00:00:00 2001 From: necoro <> Date: Tue, 24 Jul 2007 21:28:14 +0000 Subject: made the resume_loop-plugin change titles too --- portato/plugins/resume_loop.py | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'portato/plugins/resume_loop.py') 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 -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) -- cgit v1.2.3-54-g00ecf