summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeViewGtk.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-03-30 01:43:14 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-03-30 01:43:14 +0200
commitc4020d3179f287120da0c566cbae3a6034946637 (patch)
treed8c65e4d2d8074b1d90f4d12eee47741757e0b48 /DistUpgrade/DistUpgradeViewGtk.py
parentdd368277d12fef9b07cc75922ac33c85e8786b95 (diff)
downloadpython-apt-c4020d3179f287120da0c566cbae3a6034946637.tar.gz
* add a "no-pkg-state-changes" timeout/termianl expand into the code
Diffstat (limited to 'DistUpgrade/DistUpgradeViewGtk.py')
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index 4ce026c8..d8c55763 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -115,7 +115,10 @@ class GtkFetchProgressAdapter(apt.progress.FetchProgress):
return True
class GtkInstallProgressAdapter(InstallProgress):
-
+ # timeout with no status change when the terminal is expanded
+ # automatically
+ TIMEOUT_TERMINAL_ACTIVITY = 120
+
def __init__(self,parent):
InstallProgress.__init__(self)
self.label_status = parent.label_status
@@ -145,7 +148,7 @@ class GtkInstallProgressAdapter(InstallProgress):
# do a bit of time-keeping
self.start_time = 0.0
self.time_ui = 0.0
- self.longest_time_per_percent = 0.0
+ self.last_activity = 0.0
def error(self, pkg, errormsg):
logging.error("got an error from dpkg for pkg: '%s': '%s'" % (pkg, errormsg))
@@ -204,7 +207,8 @@ class GtkInstallProgressAdapter(InstallProgress):
self.label_status.set_text(status.strip())
# start showing when we gathered some data
if percent > 1.0:
- delta = time.time() - self.start_time
+ self.last_activity = time.time()
+ delta = self.last_activity - self.start_time
time_per_percent = (float(delta)/percent)
eta = (100.0 - self.percent) * time_per_percent
# only show if we have some sensible data
@@ -231,6 +235,11 @@ class GtkInstallProgressAdapter(InstallProgress):
if self.start_time == 0.0:
self.progress.pulse()
time.sleep(0.2)
+ # check about terminal activity
+ if self.last_activity > 0 and \
+ (self.last_activity + self.TIMEOUT_TERMINAL_ACTIVITY) < time.time():
+ logging.warning("no activity on terminal for %s seconds" % self.TIMEOUT_TERMINAL_ACTIVITY)
+ self.parent.expander_terminal.set_expanded(True)
while gtk.events_pending():
gtk.main_iteration()
time.sleep(0.02)