Merge lp:~evfool/update-manager/shortinterval into lp:update-manager

Proposed by Robert Roth
Status: Merged
Merged at revision: 2187
Proposed branch: lp:~evfool/update-manager/shortinterval
Merge into: lp:update-manager
Diff against target: 66 lines (+16/-8)
1 file modified
UpdateManager/UpdateManager.py (+16/-8)
To merge this branch: bzr merge lp:~evfool/update-manager/shortinterval
Reviewer Review Type Date Requested Status
Michael Vogt Pending
Review via email: mp+69367@code.launchpad.net

Description of the change

Show more detailed information about when the package information was last updated, if it has been updated in less then an hour. This branch shows the following instead of showing "The package information was last updated less then an hour ago":
The package information was last updated about {15,30,45} minutes ago - if the package information was last updated x minutes ago where {15<x<30, 30<x<45, 45<x<60}
The package information was just updated - if the package information was last updated in the last <15 minutes. (bug #747336 requested this, there was a patch attached, I have committed the patch with some minor changes to have less translations to do and with the author set to the original author).

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'UpdateManager/UpdateManager.py'
2--- UpdateManager/UpdateManager.py 2011-07-25 08:01:02 +0000
3+++ UpdateManager/UpdateManager.py 2011-07-26 21:12:35 +0000
4@@ -587,9 +587,9 @@
5 self.hbox_downsize.show()
6 self.vbox_alerts.show()
7
8- def _get_last_apt_get_update_hours(self):
9+ def _get_last_apt_get_update_minutes(self):
10 """
11- Return the number of hours since the last successful apt-get update
12+ Return the number of minutes since the last successful apt-get update
13
14 If the date is unknown, return "None"
15 """
16@@ -598,19 +598,20 @@
17 # calculate when the last apt-get update (or similar operation)
18 # was performed
19 mtime = os.stat("/var/lib/apt/periodic/update-success-stamp")[stat.ST_MTIME]
20- ago_hours = int((time.time() - mtime) / (60*60) )
21- return ago_hours
22+ ago_minutes = int((time.time() - mtime) / 60 )
23+ return ago_minutes
24
25 def _get_last_apt_get_update_text(self):
26 """
27 return a human readable string with the information when
28 the last apt-get update was run
29 """
30- ago_hours = self._get_last_apt_get_update_hours()
31- if ago_hours is None:
32+ ago_minutes = self._get_last_apt_get_update_minutes()
33+ if ago_minutes is None:
34 return _("It is unknown when the package information was "
35 "updated last. Please try clicking on the 'Check' "
36 "button to update the information.")
37+ ago_hours = int( ago_minutes / 60 )
38 ago_days = int( ago_hours / 24 )
39 if ago_days > self.NO_UPDATE_WARNING_DAYS:
40 return _("The package information was last updated %(days_ago)s "
41@@ -625,8 +626,15 @@
42 return ngettext("The package information was last updated %(hours_ago)s hour ago.",
43 "The package information was last updated %(hours_ago)s hours ago.",
44 ago_hours) % { "hours_ago" : ago_hours, }
45+ elif ago_minutes >= 45:
46+ # TRANSLATORS: only in plural form, as %s minutes ago is one of 15, 30, 45 minutes ago
47+ return _("The package information was last updated about %s minutes ago.")%45
48+ elif ago_minutes >= 30:
49+ return _("The package information was last updated about %s minutes ago.")%30
50+ elif ago_minutes >= 15:
51+ return _("The package information was last updated about %s minutes ago.")%15
52 else:
53- return _("The package information was last updated less than one hour ago.")
54+ return _("The package information was just updated.")
55 return None
56
57 def update_last_updated_text(self, user_data):
58@@ -664,7 +672,7 @@
59 self.textview_descr.get_buffer().set_text("")
60 if self._get_last_apt_get_update_text() is not None:
61 text_label_main = self._get_last_apt_get_update_text()
62- if self._get_last_apt_get_update_hours() > self.NO_UPDATE_WARNING_DAYS*24:
63+ if int(self._get_last_apt_get_update_minutes() / 60) > self.NO_UPDATE_WARNING_DAYS*24:
64 text_header = "<big><b>%s</b></big>" % _("Software updates may be available for your computer.")
65 # add timer to ensure we update the information when the
66 # last package count update was performed

Subscribers

People subscribed via source and target branches

to status/vote changes: