summaryrefslogtreecommitdiff
path: root/DistUpgrade/DistUpgradeViewGtk.py
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2006-10-10 20:39:01 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2006-10-10 20:39:01 +0200
commit6dd632f5233fc6c6ffe04dd2d15b633f23c5e457 (patch)
treee3357b5fd5226fbeb38607b2555dfc960632c2c5 /DistUpgrade/DistUpgradeViewGtk.py
parentba0fc9a5fc32bc7f43aa6043a7f05a5145e432f8 (diff)
downloadpython-apt-6dd632f5233fc6c6ffe04dd2d15b633f23c5e457.tar.gz
* DistUpgrade/DistUpgradeViewGtk.py:
- calculate the time spend in the ui as well (lp: #48733) * po/*: - make update-po
Diffstat (limited to 'DistUpgrade/DistUpgradeViewGtk.py')
-rw-r--r--DistUpgrade/DistUpgradeViewGtk.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/DistUpgrade/DistUpgradeViewGtk.py b/DistUpgrade/DistUpgradeViewGtk.py
index e77fe858..11b3e041 100644
--- a/DistUpgrade/DistUpgradeViewGtk.py
+++ b/DistUpgrade/DistUpgradeViewGtk.py
@@ -198,6 +198,7 @@ class GtkInstallProgressAdapter(InstallProgress):
def conffile(self, current, new):
logging.debug("got a conffile-prompt from dpkg for file: '%s'" % current)
+ start = time.time()
#self.expander.set_expanded(True)
prim = _("Replace the customized configuration file\n'%s'?") % current
sec = _("You will lose any changes you have made to this "
@@ -216,6 +217,7 @@ class GtkInstallProgressAdapter(InstallProgress):
self.parent.textview_conffile.get_buffer().set_text(_("The 'diff' command was not found"))
res = self.parent.dialog_conffile.run()
self.parent.dialog_conffile.hide()
+ self.time_ui += time.time() - start
# if replace, send this to the terminal
if res == gtk.RESPONSE_YES:
self.term.feed_child("y\n")
@@ -242,9 +244,11 @@ class GtkInstallProgressAdapter(InstallProgress):
self.last_activity = time.time()
self.activity_timeout_reported = False
delta = self.last_activity - self.start_time
+ # time wasted in conffile questions (or other ui activity)
+ delta -= self.time_ui
time_per_percent = (float(delta)/percent)
eta = (100.0 - self.percent) * time_per_percent
- # only show if we have some sensible data
+ # only show if we have some sensible data (60sec < eta < 2days)
if eta > 61.0 and eta < (60*60*24*2):
self.progress.set_text(_("About %s remaining") % FuzzyTimeToStr(eta))
else:
@@ -588,11 +592,11 @@ if __name__ == "__main__":
fp = GtkFetchProgressAdapter(view)
ip = GtkInstallProgressAdapter(view)
-
cache = apt.Cache()
for pkg in sys.argv[1:]:
cache[pkg].markInstall()
cache.commit(fp,ip)
+ sys.exit(0)
#sys.exit(0)
ip.conffile("TODO","TODO~")