Merge lp:~mterry/update-manager/update-at-start into lp:update-manager
- update-at-start
- Merge into main
Status: | Merged |
---|---|
Approved by: | Barry Warsaw |
Approved revision: | 2441 |
Merged at revision: | 2504 |
Proposed branch: | lp:~mterry/update-manager/update-at-start |
Merge into: | lp:update-manager |
Diff against target: |
896 lines (+148/-397) 8 files modified
UpdateManager/UnitySupport.py (+0/-9) UpdateManager/UpdateManager.py (+22/-168) UpdateManager/UpdateProgress.py (+84/-0) UpdateManager/backend/InstallBackendAptdaemon.py (+11/-5) data/com.ubuntu.update-manager.gschema.xml.in (+0/-5) data/gtkbuilder/UpdateManager.ui (+14/-206) data/update-manager.convert (+0/-1) update-manager (+17/-3) |
To merge this branch: | bzr merge lp:~mterry/update-manager/update-at-start |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Barry Warsaw (community) | Approve | ||
Michael Vogt | Pending | ||
Review via email: mp+108369@code.launchpad.net |
Commit message
Description of the change
Implements the 'update on start' aspect of the new spec.
This means that all ways to manually start an update are gone from the UI. We no longer warn about how long it's been since the last update, etc.
I've added a new class to handle the initial progress dialog. It just seemed cleaner to me to do it that way rather than introduce more possible states to the main dialog's class. Especially since so little of that class is relevant to the progress dialog.
The progress dialog doesn't look quite like it does in the spec yet. That will require changes to aptdaemon's progress dialog widget. But those can be done separately.
Michael Terry (mterry) wrote : | # |
- 2439. By Michael Terry
-
merge from trunk
Barry Warsaw (barry) wrote : | # |
When I run ./update-manager from your branch I get the following errors on the console:
% ./update-manager
Traceback (most recent call last):
File "/usr/lib/
raise AttributeError(
AttributeError: Handler on_button_
Traceback (most recent call last):
File "/usr/lib/
raise AttributeError(
AttributeError: Handler on_checkbutton_
Probably some additional left over cruft that isn't removed in your branch?
Also, you mention a spec, but I'm not aware of it. Do you have a link?
Minor misspelling at the top of UpdateProgress.py
You might want to run pyflakes over UpdateProgress.py. Unused imports include Gtk, _, ngettext
Also, you can probably collapse the .Core.utils import onto one line
Spaces around the = sign when setting os.environ[]
4 space indents please! :)
Could you add some tests for the new functionality and files?
Michael Terry (mterry) wrote : | # |
The spec is https:/
The AttributeError is likely because you need to point at the new glade files too (update-manager isn't smart enough to look in the local location). So either futz with XDG_DATA_DIRS or just do "sudo cp data/gtkbuilder/* /usr/share/
I'll update UpdateProgress.py and fix the nits. You're killing me with the 4-indents. Not that I care, but update-manager source is very inconsistent with 2 or 4, even inside a file, so I've tried to always stick with 2 in all my pending branches. :(
- 2440. By Michael Terry
-
review style nits and pyflakes fixes
Michael Terry (mterry) wrote : | # |
OK, I've updated to fix nits. I'm not going to do the 4-indent change, because that would cause massive headache with all my chain of pending merges. I'd rather just do a big flag-day indent fixup branch at the end, which will fix existing inconsistencies too.
As for tests, I'd like to talk to mvo first about what his plans were for tests going forward. (tests right now are very hodge-pogde; some rely on internal test-only flags for detecting if a dialog was shown, some just use direct imports of modules and poke around, I don't think any use a UI-driving framework) It's fine if that's a blocker, but it's not something I can fix right this second.
Michael Vogt (mvo) wrote : | # |
On Tue, Jun 19, 2012 at 09:56:18PM -0000, Michael Terry wrote:
> The spec is https:/
>
> The AttributeError is likely because you need to point at the new glade files too (update-manager isn't smart enough to look in the local location). So either futz with XDG_DATA_DIRS or just do "sudo cp data/gtkbuilder/* /usr/share/
Alternatively:
$ ./update-manager --data-dir ./data
should work too.
> I'll update UpdateProgress.py and fix the nits. You're killing me with the 4-indents. Not that I care, but update-manager source is very inconsistent with 2 or 4, even inside a file, so I've tried to always stick with 2 in all my pending branches. :(
Yeah, its a big pain, given the restructure that is going on, it
sounds like a good time to make it consistently 4 spaces, wdyt?
Cheers,
Michael
Michael Vogt (mvo) wrote : | # |
On Tue, Jun 19, 2012 at 10:07:18PM -0000, Michael Terry wrote:
> OK, I've updated to fix nits. I'm not going to do the 4-indent change, because that would cause massive headache with all my chain of pending merges. I'd rather just do a big flag-day indent fixup branch at the end, which will fix existing inconsistencies too.
That sounds like a reasonable approach.
> As for tests, I'd like to talk to mvo first about what his plans were for tests going forward. (tests right now are very hodge-pogde; some rely on internal test-only flags for detecting if a dialog was shown, some just use direct imports of modules and poke around, I don't think any use a UI-driving framework) It's fine if that's a blocker, but it's not something I can fix right this second.
Indeed, there is no UI-driving framework, my experience with all of
them wasn't that great, so its importing and poking around at the
modules/classes. I'm happy about u-m moving towards a UI-driving
framework, suggestions for a good one welcome.
Cheers,
Michael
Michael Terry (mterry) wrote : | # |
<mterry> mvo, darn, I was hoping you had been hiding some amazing UI driving framework that you had been too lazy to use. :-/
<mterry> mvo, the best I've used is ldtp, but it's very rickety
<mvo> mterry: yeah, excatly, I wasn't overly impressed with that one :/
<mterry> mvo, well, I'm happy to write various tests, but since doing so might involve various code changes (for instrumentation) and since code is moving around a lot in my branches, would you mind if I did a big test branch after all these intermediate branches land? (ala the indentation one)
<mvo> mterry: that is fine with me (for the given reasons)
So I'll start working on an indentation branch and a testing branch after my branches land on trunk. I believe that means there's no outstanding issue with this particular branch. Could I get a re-review?
Ken VanDine (ken-vandine) wrote : | # |
I got a very minor merge conflict for UpdateManager/
<<<<<<< TREE
if self._get_
if ago_minutes is not None and ago_minutes > self.NO_
# add timer to ensure we update the information when the
# last package count update was performed
=======
>>>>>>> MERGE-SOURCE
I manually fixed the merge and tested. After applying updates I noticed the "Details of updates" expander doesn't get hidden. Perhaps that is expected at this point and fixed in another branch.
Still reviewing... more to come later.
Barry Warsaw (barry) wrote : | # |
On Jun 22, 2012, at 06:36 PM, Ken VanDine wrote:
>I got a very minor merge conflict for UpdateManager/
>
><<<<<<< TREE
> if self._get_
> text_label_main = self._get_
> ago_minutes = self._get_
> if ago_minutes is not None and ago_minutes > self.NO_
> text_header = _("Software updates may be available for your computer.")
> # add timer to ensure we update the information when the
> # last package count update was performed
> GObject.
>=======
>>>>>>>> MERGE-SOURCE
I get the same conflict against trunk. I suppose that chunk of code is
supposed to be removed?
Barry Warsaw (barry) wrote : | # |
On Jun 19, 2012, at 10:07 PM, Michael Terry wrote:
>OK, I've updated to fix nits. I'm not going to do the 4-indent change,
>because that would cause massive headache with all my chain of pending
>merges. I'd rather just do a big flag-day indent fixup branch at the end,
>which will fix existing inconsistencies too.
I think it's fine to defer the reindentation, and I agree the code base is
fairly inconsistent about indentation right now. It would be nice at some
point to do a thorough PEP-8-ification of the code.
>As for tests, I'd like to talk to mvo first about what his plans were for
>tests going forward. (tests right now are very hodge-pogde; some rely on
>internal test-only flags for detecting if a dialog was shown, some just use
>direct imports of modules and poke around, I don't think any use a UI-driving
>framework) It's fine if that's a blocker, but it's not something I can fix
>right this second.
I guess not. This is another thing I'd really like to do at some point,
i.e. refactor the code to be more testable and have better coverage.
Right now your branch is conflicting with trunk. Can you resolve that and
push an update?
Ken VanDine (ken-vandine) wrote : | # |
On Fri, 2012-06-22 at 18:22 -0400, Barry Warsaw wrote:
> On Jun 22, 2012, at 06:36 PM, Ken VanDine wrote:
>
> >I got a very minor merge conflict for UpdateManager/
> >
> ><<<<<<< TREE
> > if self._get_
> > text_label_main = self._get_
> > ago_minutes = self._get_
> > if ago_minutes is not None and ago_minutes > self.NO_
> > text_header = _("Software updates may be available for your computer.")
> > # add timer to ensure we update the information when the
> > # last package count update was performed
> > GObject.
> >=======
> >>>>>>>> MERGE-SOURCE
>
> I get the same conflict against trunk. I suppose that chunk of code is
> supposed to be removed?
>
Looks like it to me.
--
Ken VanDine
Ubuntu Desktop Integration Engineer
Canonical, Ltd.
- 2441. By Michael Terry
-
merge from trunk
Michael Terry (mterry) wrote : | # |
Yup, the conflicting code just needed to be removed. How about now?
Barry Warsaw (barry) wrote : | # |
Looks good now, thanks.
Barry Warsaw (barry) wrote : | # |
On Jun 25, 2012, at 03:06 PM, Michael Terry wrote:
>Yup, the conflicting code just needed to be removed. How about now?
Looks good, thanks. I've merged this into trunk, but didn't upload it, in
case there are other upcoming changes for u-m. Happy to upload it if you
prefer though.
Preview Diff
1 | === modified file 'UpdateManager/UnitySupport.py' | |||
2 | --- UpdateManager/UnitySupport.py 2011-08-11 11:47:34 +0000 | |||
3 | +++ UpdateManager/UnitySupport.py 2012-06-25 15:02:27 +0000 | |||
4 | @@ -51,15 +51,6 @@ | |||
5 | 51 | 51 | ||
6 | 52 | def _add_quicklist(self, parent): | 52 | def _add_quicklist(self, parent): |
7 | 53 | quicklist = Dbusmenu.Menuitem.new() | 53 | quicklist = Dbusmenu.Menuitem.new() |
8 | 54 | # update | ||
9 | 55 | update_dbusmenuitem = Dbusmenu.Menuitem.new() | ||
10 | 56 | update_dbusmenuitem.property_set( | ||
11 | 57 | Dbusmenu.MENUITEM_PROP_LABEL, _("Check for Updates")) | ||
12 | 58 | update_dbusmenuitem.property_set_bool( | ||
13 | 59 | Dbusmenu.MENUITEM_PROP_VISIBLE, True) | ||
14 | 60 | update_dbusmenuitem.connect ( | ||
15 | 61 | "item-activated", parent.on_button_reload_clicked, None) | ||
16 | 62 | quicklist.child_append(update_dbusmenuitem) | ||
17 | 63 | # install | 54 | # install |
18 | 64 | self.install_dbusmenuitem = Dbusmenu.Menuitem.new() | 55 | self.install_dbusmenuitem = Dbusmenu.Menuitem.new() |
19 | 65 | self.install_dbusmenuitem.property_set (Dbusmenu.MENUITEM_PROP_LABEL, | 56 | self.install_dbusmenuitem.property_set (Dbusmenu.MENUITEM_PROP_LABEL, |
20 | 66 | 57 | ||
21 | === modified file 'UpdateManager/UpdateManager.py' | |||
22 | --- UpdateManager/UpdateManager.py 2012-06-14 21:14:13 +0000 | |||
23 | +++ UpdateManager/UpdateManager.py 2012-06-25 15:02:27 +0000 | |||
24 | @@ -1,6 +1,6 @@ | |||
25 | 1 | # UpdateManager.py | 1 | # UpdateManager.py |
26 | 2 | # | 2 | # |
28 | 3 | # Copyright (c) 2004-2010 Canonical | 3 | # Copyright (c) 2004-2012 Canonical |
29 | 4 | # 2004 Michiel Sikkes | 4 | # 2004 Michiel Sikkes |
30 | 5 | # 2005 Martin Willemoes Hansen | 5 | # 2005 Martin Willemoes Hansen |
31 | 6 | # 2010 Mohamed Amine IL Idrissi | 6 | # 2010 Mohamed Amine IL Idrissi |
32 | @@ -10,6 +10,7 @@ | |||
33 | 10 | # Martin Willemoes Hansen <mwh@sysrq.dk> | 10 | # Martin Willemoes Hansen <mwh@sysrq.dk> |
34 | 11 | # Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> | 11 | # Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> |
35 | 12 | # Alex Launi <alex.launi@canonical.com> | 12 | # Alex Launi <alex.launi@canonical.com> |
36 | 13 | # Michael Terry <michael.terry@canonical.com> | ||
37 | 13 | # | 14 | # |
38 | 14 | # This program is free software; you can redistribute it and/or | 15 | # This program is free software; you can redistribute it and/or |
39 | 15 | # modify it under the terms of the GNU General Public License as | 16 | # modify it under the terms of the GNU General Public License as |
40 | @@ -40,12 +41,10 @@ | |||
41 | 40 | 41 | ||
42 | 41 | import apt_pkg | 42 | import apt_pkg |
43 | 42 | 43 | ||
44 | 43 | import gettext | ||
45 | 44 | import sys | 44 | import sys |
46 | 45 | import os | 45 | import os |
47 | 46 | import stat | 46 | import stat |
48 | 47 | import re | 47 | import re |
49 | 48 | import locale | ||
50 | 49 | import logging | 48 | import logging |
51 | 50 | import operator | 49 | import operator |
52 | 51 | import subprocess | 50 | import subprocess |
53 | @@ -66,7 +65,6 @@ | |||
54 | 66 | 65 | ||
55 | 67 | 66 | ||
56 | 68 | from .Core.utils import (humanize_size, | 67 | from .Core.utils import (humanize_size, |
57 | 69 | init_proxy, | ||
58 | 70 | on_battery, | 68 | on_battery, |
59 | 71 | inhibit_sleep, | 69 | inhibit_sleep, |
60 | 72 | allow_sleep) | 70 | allow_sleep) |
61 | @@ -91,9 +89,6 @@ | |||
62 | 91 | # list constants | 89 | # list constants |
63 | 92 | (LIST_CONTENTS, LIST_NAME, LIST_PKG, LIST_ORIGIN, LIST_TOGGLE_CHECKED) = range(5) | 90 | (LIST_CONTENTS, LIST_NAME, LIST_PKG, LIST_ORIGIN, LIST_TOGGLE_CHECKED) = range(5) |
64 | 93 | 91 | ||
65 | 94 | # actions for "invoke_manager" | ||
66 | 95 | (INSTALL, UPDATE) = range(2) | ||
67 | 96 | |||
68 | 97 | # file that signals if we need to reboot | 92 | # file that signals if we need to reboot |
69 | 98 | REBOOT_REQUIRED_FILE = "/var/run/reboot-required" | 93 | REBOOT_REQUIRED_FILE = "/var/run/reboot-required" |
70 | 99 | 94 | ||
71 | @@ -140,27 +135,14 @@ | |||
72 | 140 | return True | 135 | return True |
73 | 141 | 136 | ||
74 | 142 | @dbus.service.method('org.freedesktop.UpdateManagerIFace') | 137 | @dbus.service.method('org.freedesktop.UpdateManagerIFace') |
75 | 143 | def update(self): | ||
76 | 144 | try: | ||
77 | 145 | self.alert_watcher.check_alert_state () | ||
78 | 146 | self.parent.invoke_manager(UPDATE) | ||
79 | 147 | return self.connected | ||
80 | 148 | except: | ||
81 | 149 | return False | ||
82 | 150 | |||
83 | 151 | @dbus.service.method('org.freedesktop.UpdateManagerIFace') | ||
84 | 152 | def upgrade(self): | 138 | def upgrade(self): |
85 | 153 | try: | 139 | try: |
86 | 154 | self.parent.cache.checkFreeSpace() | 140 | self.parent.cache.checkFreeSpace() |
88 | 155 | self.parent.invoke_manager(INSTALL) | 141 | self.parent.invoke_manager() |
89 | 156 | return True | 142 | return True |
90 | 157 | except: | 143 | except: |
91 | 158 | return False | 144 | return False |
92 | 159 | 145 | ||
93 | 160 | @dbus.service.signal('org.freedesktop.UpdateManagerIFace', 'b') | ||
94 | 161 | def updated(self, success): | ||
95 | 162 | pass | ||
96 | 163 | |||
97 | 164 | def _on_network_alert(self, watcher, state): | 146 | def _on_network_alert(self, watcher, state): |
98 | 165 | if state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST: | 147 | if state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST: |
99 | 166 | self.connected = True | 148 | self.connected = True |
100 | @@ -169,21 +151,12 @@ | |||
101 | 169 | 151 | ||
102 | 170 | class UpdateManager(SimpleGtkbuilderApp): | 152 | class UpdateManager(SimpleGtkbuilderApp): |
103 | 171 | 153 | ||
104 | 172 | # how many days until u-m warns about manual pressing "check" | ||
105 | 173 | NO_UPDATE_WARNING_DAYS = 7 | ||
106 | 174 | |||
107 | 175 | def __init__(self, datadir, options): | 154 | def __init__(self, datadir, options): |
108 | 176 | self.setupDbus() | 155 | self.setupDbus() |
109 | 177 | Gtk.Window.set_default_icon_name("system-software-update") | ||
110 | 178 | self.datadir = datadir | 156 | self.datadir = datadir |
111 | 157 | self.options = options | ||
112 | 179 | SimpleGtkbuilderApp.__init__(self, datadir+"gtkbuilder/UpdateManager.ui", | 158 | SimpleGtkbuilderApp.__init__(self, datadir+"gtkbuilder/UpdateManager.ui", |
113 | 180 | "update-manager") | 159 | "update-manager") |
114 | 181 | gettext.bindtextdomain("update-manager", "/usr/share/locale") | ||
115 | 182 | gettext.textdomain("update-manager") | ||
116 | 183 | try: | ||
117 | 184 | locale.setlocale(locale.LC_ALL, "") | ||
118 | 185 | except: | ||
119 | 186 | logging.exception("setlocale failed") | ||
120 | 187 | 160 | ||
121 | 188 | # Used for inhibiting power management | 161 | # Used for inhibiting power management |
122 | 189 | self.sleep_cookie = None | 162 | self.sleep_cookie = None |
123 | @@ -192,7 +165,6 @@ | |||
124 | 192 | # workaround for LP: #945536 | 165 | # workaround for LP: #945536 |
125 | 193 | self.clearing_store = False | 166 | self.clearing_store = False |
126 | 194 | 167 | ||
127 | 195 | self.image_logo.set_from_icon_name("system-software-update", Gtk.IconSize.DIALOG) | ||
128 | 196 | self.window_main.set_sensitive(False) | 168 | self.window_main.set_sensitive(False) |
129 | 197 | self.window_main.grab_focus() | 169 | self.window_main.grab_focus() |
130 | 198 | self.button_close.grab_focus() | 170 | self.button_close.grab_focus() |
131 | @@ -257,13 +229,10 @@ | |||
132 | 257 | self.button_settings.set_sensitive(False) | 229 | self.button_settings.set_sensitive(False) |
133 | 258 | 230 | ||
134 | 259 | self.settings = Gio.Settings("com.ubuntu.update-manager") | 231 | self.settings = Gio.Settings("com.ubuntu.update-manager") |
135 | 260 | init_proxy(self.settings) | ||
136 | 261 | # init show version | 232 | # init show version |
137 | 262 | self.show_versions = self.settings.get_boolean("show-versions") | 233 | self.show_versions = self.settings.get_boolean("show-versions") |
138 | 263 | # init summary_before_name | 234 | # init summary_before_name |
139 | 264 | self.summary_before_name = self.settings.get_boolean("summary-before-name") | 235 | self.summary_before_name = self.settings.get_boolean("summary-before-name") |
140 | 265 | # keep track when we run (for update-notifier) | ||
141 | 266 | self.settings.set_int("launch-time", int(time.time())) | ||
142 | 267 | 236 | ||
143 | 268 | # get progress object | 237 | # get progress object |
144 | 269 | self.progress = GtkOpProgressInline( | 238 | self.progress = GtkOpProgressInline( |
145 | @@ -366,10 +335,6 @@ | |||
146 | 366 | self.dbusController = UpdateManagerDbusController(self, bus_name) | 335 | self.dbusController = UpdateManagerDbusController(self, bus_name) |
147 | 367 | 336 | ||
148 | 368 | 337 | ||
149 | 369 | def on_checkbutton_reminder_toggled(self, checkbutton): | ||
150 | 370 | self.settings.set_boolean("remind-reload", | ||
151 | 371 | not checkbutton.get_active()) | ||
152 | 372 | |||
153 | 373 | def close(self, widget, data=None): | 338 | def close(self, widget, data=None): |
154 | 374 | if self.window_main.get_property("sensitive") is False: | 339 | if self.window_main.get_property("sensitive") is False: |
155 | 375 | return True | 340 | return True |
156 | @@ -600,74 +565,11 @@ | |||
157 | 600 | self.hbox_downsize.show() | 565 | self.hbox_downsize.show() |
158 | 601 | self.vbox_alerts.show() | 566 | self.vbox_alerts.show() |
159 | 602 | 567 | ||
160 | 603 | def _get_last_apt_get_update_minutes(self): | ||
161 | 604 | """ | ||
162 | 605 | Return the number of minutes since the last successful apt-get update | ||
163 | 606 | |||
164 | 607 | If the date is unknown, return "None" | ||
165 | 608 | """ | ||
166 | 609 | if not os.path.exists("/var/lib/apt/periodic/update-success-stamp"): | ||
167 | 610 | return None | ||
168 | 611 | # calculate when the last apt-get update (or similar operation) | ||
169 | 612 | # was performed | ||
170 | 613 | mtime = os.stat("/var/lib/apt/periodic/update-success-stamp")[stat.ST_MTIME] | ||
171 | 614 | ago_minutes = int((time.time() - mtime) / 60 ) | ||
172 | 615 | return ago_minutes | ||
173 | 616 | |||
174 | 617 | def _get_last_apt_get_update_text(self): | ||
175 | 618 | """ | ||
176 | 619 | return a human readable string with the information when | ||
177 | 620 | the last apt-get update was run | ||
178 | 621 | """ | ||
179 | 622 | ago_minutes = self._get_last_apt_get_update_minutes() | ||
180 | 623 | if ago_minutes is None: | ||
181 | 624 | return _("It is unknown when the package information was " | ||
182 | 625 | "updated last. Please click the 'Check' " | ||
183 | 626 | "button to update the information.") | ||
184 | 627 | ago_hours = int( ago_minutes / 60 ) | ||
185 | 628 | ago_days = int( ago_hours / 24 ) | ||
186 | 629 | if ago_days > self.NO_UPDATE_WARNING_DAYS: | ||
187 | 630 | return _("The package information was last updated %(days_ago)s " | ||
188 | 631 | "days ago.\n" | ||
189 | 632 | "Press the 'Check' button below to check for new software " | ||
190 | 633 | "updates.") % { "days_ago" : ago_days, } | ||
191 | 634 | elif ago_days > 0: | ||
192 | 635 | return ngettext("The package information was last updated %(days_ago)s day ago.", | ||
193 | 636 | "The package information was last updated %(days_ago)s days ago.", | ||
194 | 637 | ago_days) % { "days_ago" : ago_days, } | ||
195 | 638 | elif ago_hours > 0: | ||
196 | 639 | return ngettext("The package information was last updated %(hours_ago)s hour ago.", | ||
197 | 640 | "The package information was last updated %(hours_ago)s hours ago.", | ||
198 | 641 | ago_hours) % { "hours_ago" : ago_hours, } | ||
199 | 642 | elif ago_minutes >= 45: | ||
200 | 643 | # TRANSLATORS: only in plural form, as %s minutes ago is one of 15, 30, 45 minutes ago | ||
201 | 644 | return _("The package information was last updated about %s minutes ago.")%45 | ||
202 | 645 | elif ago_minutes >= 30: | ||
203 | 646 | return _("The package information was last updated about %s minutes ago.")%30 | ||
204 | 647 | elif ago_minutes >= 15: | ||
205 | 648 | return _("The package information was last updated about %s minutes ago.")%15 | ||
206 | 649 | else: | ||
207 | 650 | return _("The package information was just updated.") | ||
208 | 651 | return None | ||
209 | 652 | |||
210 | 653 | def update_last_updated_text(self, user_data): | ||
211 | 654 | """timer that updates the last updated text """ | ||
212 | 655 | #print("update_last_updated_text") | ||
213 | 656 | num_updates = self.cache.install_count | ||
214 | 657 | if num_updates == 0: | ||
215 | 658 | if self._get_last_apt_get_update_text() is not None: | ||
216 | 659 | text_label_main = self._get_last_apt_get_update_text() | ||
217 | 660 | self.label_main_details.set_text(text_label_main) | ||
218 | 661 | return True | ||
219 | 662 | # stop the timer if there are upgrades now | ||
220 | 663 | return False | ||
221 | 664 | |||
222 | 665 | def update_count(self): | 568 | def update_count(self): |
223 | 666 | """activate or disable widgets and show dialog texts correspoding to | 569 | """activate or disable widgets and show dialog texts correspoding to |
224 | 667 | the number of available updates""" | 570 | the number of available updates""" |
225 | 668 | self.refresh_updates_count() | 571 | self.refresh_updates_count() |
226 | 669 | num_updates = self.cache.install_count | 572 | num_updates = self.cache.install_count |
227 | 670 | text_label_main = "" | ||
228 | 671 | 573 | ||
229 | 672 | # setup unity stuff | 574 | # setup unity stuff |
230 | 673 | self.unity.set_updates_count(num_updates) | 575 | self.unity.set_updates_count(num_updates) |
231 | @@ -683,14 +585,6 @@ | |||
232 | 683 | self.button_close.grab_default() | 585 | self.button_close.grab_default() |
233 | 684 | self.textview_changes.get_buffer().set_text("") | 586 | self.textview_changes.get_buffer().set_text("") |
234 | 685 | self.textview_descr.get_buffer().set_text("") | 587 | self.textview_descr.get_buffer().set_text("") |
235 | 686 | if self._get_last_apt_get_update_text() is not None: | ||
236 | 687 | text_label_main = self._get_last_apt_get_update_text() | ||
237 | 688 | ago_minutes = self._get_last_apt_get_update_minutes() | ||
238 | 689 | if ago_minutes is not None and ago_minutes > self.NO_UPDATE_WARNING_DAYS*24*60: | ||
239 | 690 | text_header = _("Software updates may be available for your computer.") | ||
240 | 691 | # add timer to ensure we update the information when the | ||
241 | 692 | # last package count update was performed | ||
242 | 693 | GObject.timeout_add_seconds(10, self.update_last_updated_text, None) | ||
243 | 694 | else: | 588 | else: |
244 | 695 | # show different text on first run (UX team suggestion) | 589 | # show different text on first run (UX team suggestion) |
245 | 696 | firstrun = self.settings.get_boolean("first-run") | 590 | firstrun = self.settings.get_boolean("first-run") |
246 | @@ -704,7 +598,6 @@ | |||
247 | 704 | self.button_install.grab_default() | 598 | self.button_install.grab_default() |
248 | 705 | self.treeview_update.set_cursor(Gtk.TreePath.new_from_string("1"), None, False) | 599 | self.treeview_update.set_cursor(Gtk.TreePath.new_from_string("1"), None, False) |
249 | 706 | self.label_header.set_markup(text_header) | 600 | self.label_header.set_markup(text_header) |
250 | 707 | self.label_main_details.set_text(text_label_main) | ||
251 | 708 | return True | 601 | return True |
252 | 709 | 602 | ||
253 | 710 | # Before we shrink the window, capture the size | 603 | # Before we shrink the window, capture the size |
254 | @@ -725,11 +618,6 @@ | |||
255 | 725 | expanded = self.expander_desc.get_expanded() | 618 | expanded = self.expander_desc.get_expanded() |
256 | 726 | self.expander_desc.set_vexpand(expanded) | 619 | self.expander_desc.set_vexpand(expanded) |
257 | 727 | 620 | ||
258 | 728 | def on_button_reload_clicked(self, widget, menuitem = None, data = None): | ||
259 | 729 | #print("on_button_reload_clicked") | ||
260 | 730 | self.check_metarelease() | ||
261 | 731 | self.invoke_manager(UPDATE) | ||
262 | 732 | |||
263 | 733 | #def on_button_help_clicked(self, widget): | 621 | #def on_button_help_clicked(self, widget): |
264 | 734 | # self.help_viewer.run() | 622 | # self.help_viewer.run() |
265 | 735 | 623 | ||
266 | @@ -774,7 +662,7 @@ | |||
267 | 774 | return | 662 | return |
268 | 775 | except SystemError as e: | 663 | except SystemError as e: |
269 | 776 | logging.exception("free space check failed") | 664 | logging.exception("free space check failed") |
271 | 777 | self.invoke_manager(INSTALL) | 665 | self.invoke_manager() |
272 | 778 | 666 | ||
273 | 779 | def on_button_restart_required_clicked(self, button=None): | 667 | def on_button_restart_required_clicked(self, button=None): |
274 | 780 | self._request_reboot_via_session_manager() | 668 | self._request_reboot_via_session_manager() |
275 | @@ -807,7 +695,7 @@ | |||
276 | 807 | except dbus.DBusException: | 695 | except dbus.DBusException: |
277 | 808 | pass | 696 | pass |
278 | 809 | 697 | ||
280 | 810 | def invoke_manager(self, action): | 698 | def invoke_manager(self): |
281 | 811 | # check first if no other package manager is runing | 699 | # check first if no other package manager is runing |
282 | 812 | 700 | ||
283 | 813 | # don't display apt-listchanges, we already showed the changelog | 701 | # don't display apt-listchanges, we already showed the changelog |
284 | @@ -819,30 +707,23 @@ | |||
285 | 819 | # set window to insensitive | 707 | # set window to insensitive |
286 | 820 | self.window_main.set_sensitive(False) | 708 | self.window_main.set_sensitive(False) |
287 | 821 | self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) | 709 | self.window_main.get_window().set_cursor(Gdk.Cursor.new(Gdk.CursorType.WATCH)) |
305 | 822 | # | 710 | |
306 | 823 | # do it | 711 | # If the progress dialog should be closed automatically afterwards |
307 | 824 | if action == UPDATE: | 712 | settings = Gio.Settings("com.ubuntu.update-manager") |
308 | 825 | self.install_backend.update() | 713 | close_on_done = settings.get_boolean("autoclose-install-window") |
309 | 826 | elif action == INSTALL: | 714 | # Get the packages which should be installed and update |
310 | 827 | # If the progress dialog should be closed automatically afterwards | 715 | pkgs_install = [] |
311 | 828 | settings = Gio.Settings("com.ubuntu.update-manager") | 716 | pkgs_upgrade = [] |
312 | 829 | close_on_done = settings.get_boolean("autoclose-install-window") | 717 | for pkg in self.cache: |
313 | 830 | # Get the packages which should be installed and update | 718 | if pkg.marked_install: |
314 | 831 | pkgs_install = [] | 719 | pkgs_install.append(pkg.name) |
315 | 832 | pkgs_upgrade = [] | 720 | elif pkg.marked_upgrade: |
316 | 833 | for pkg in self.cache: | 721 | pkgs_upgrade.append(pkg.name) |
317 | 834 | if pkg.marked_install: | 722 | self.install_backend.commit(pkgs_install, pkgs_upgrade, close_on_done) |
301 | 835 | pkgs_install.append(pkg.name) | ||
302 | 836 | elif pkg.marked_upgrade: | ||
303 | 837 | pkgs_upgrade.append(pkg.name) | ||
304 | 838 | self.install_backend.commit(pkgs_install, pkgs_upgrade, close_on_done) | ||
318 | 839 | 723 | ||
319 | 840 | def _on_backend_done(self, backend, action, authorized, success): | 724 | def _on_backend_done(self, backend, action, authorized, success): |
320 | 841 | if (action == UPDATE): | ||
321 | 842 | self.dbusController.updated(success) | ||
322 | 843 | # check if there is a new reboot required notification | 725 | # check if there is a new reboot required notification |
325 | 844 | if (action == INSTALL and | 726 | if os.path.exists(REBOOT_REQUIRED_FILE): |
324 | 845 | os.path.exists(REBOOT_REQUIRED_FILE)): | ||
326 | 846 | self.show_reboot_required_info() | 727 | self.show_reboot_required_info() |
327 | 847 | if authorized: | 728 | if authorized: |
328 | 848 | msg = _("Reading package information") | 729 | msg = _("Reading package information") |
329 | @@ -861,7 +742,6 @@ | |||
330 | 861 | # can deal with dialup connections properly | 742 | # can deal with dialup connections properly |
331 | 862 | if state in NetworkManagerHelper.NM_STATE_CONNECTING_LIST: | 743 | if state in NetworkManagerHelper.NM_STATE_CONNECTING_LIST: |
332 | 863 | self.label_offline.set_text(_("Connecting...")) | 744 | self.label_offline.set_text(_("Connecting...")) |
333 | 864 | #self.button_reload.set_sensitive(False) | ||
334 | 865 | self.refresh_updates_count() | 745 | self.refresh_updates_count() |
335 | 866 | self.hbox_offline.show() | 746 | self.hbox_offline.show() |
336 | 867 | self.vbox_alerts.show() | 747 | self.vbox_alerts.show() |
337 | @@ -869,7 +749,6 @@ | |||
338 | 869 | # in doubt (STATE_UNKNOWN), assume connected | 749 | # in doubt (STATE_UNKNOWN), assume connected |
339 | 870 | elif (state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST or | 750 | elif (state in NetworkManagerHelper.NM_STATE_CONNECTED_LIST or |
340 | 871 | state == NetworkManagerHelper.NM_STATE_UNKNOWN): | 751 | state == NetworkManagerHelper.NM_STATE_UNKNOWN): |
341 | 872 | #self.button_reload.set_sensitive(True) | ||
342 | 873 | self.refresh_updates_count() | 752 | self.refresh_updates_count() |
343 | 874 | self.hbox_offline.hide() | 753 | self.hbox_offline.hide() |
344 | 875 | self.connected = True | 754 | self.connected = True |
345 | @@ -878,7 +757,6 @@ | |||
346 | 878 | else: | 757 | else: |
347 | 879 | self.connected = False | 758 | self.connected = False |
348 | 880 | self.label_offline.set_text(_("You may not be able to check for updates or download new updates.")) | 759 | self.label_offline.set_text(_("You may not be able to check for updates or download new updates.")) |
349 | 881 | #self.button_reload.set_sensitive(False) | ||
350 | 882 | self.refresh_updates_count() | 760 | self.refresh_updates_count() |
351 | 883 | self.hbox_offline.show() | 761 | self.hbox_offline.show() |
352 | 884 | self.vbox_alerts.show() | 762 | self.vbox_alerts.show() |
353 | @@ -1022,11 +900,7 @@ | |||
354 | 1022 | 900 | ||
355 | 1023 | # fill them again | 901 | # fill them again |
356 | 1024 | try: | 902 | try: |
362 | 1025 | # This is a quite nasty hack to stop the initial update | 903 | self.list.update(self.cache) |
358 | 1026 | if not self.options.no_update: | ||
359 | 1027 | self.list.update(self.cache) | ||
360 | 1028 | else: | ||
361 | 1029 | self.options.no_update = False | ||
363 | 1030 | except SystemError as e: | 904 | except SystemError as e: |
364 | 1031 | msg = ("<big><b>%s</b></big>\n\n%s\n'%s'" % | 905 | msg = ("<big><b>%s</b></big>\n\n%s\n'%s'" % |
365 | 1032 | (_("Could not calculate the upgrade"), | 906 | (_("Could not calculate the upgrade"), |
366 | @@ -1167,22 +1041,6 @@ | |||
367 | 1167 | else: | 1041 | else: |
368 | 1168 | self.progress.all_done() | 1042 | self.progress.all_done() |
369 | 1169 | 1043 | ||
370 | 1170 | def check_auto_update(self): | ||
371 | 1171 | # Check if automatic update is enabled. If not show a dialog to inform | ||
372 | 1172 | # the user about the need of manual "reloads" | ||
373 | 1173 | remind = self.settings.get_boolean("remind-reload") | ||
374 | 1174 | if remind == False: | ||
375 | 1175 | return | ||
376 | 1176 | |||
377 | 1177 | update_days = apt_pkg.config.find_i("APT::Periodic::Update-Package-Lists") | ||
378 | 1178 | if update_days < 1: | ||
379 | 1179 | self.dialog_manual_update.set_transient_for(self.window_main) | ||
380 | 1180 | self.dialog_manual_update.set_title("") | ||
381 | 1181 | res = self.dialog_manual_update.run() | ||
382 | 1182 | self.dialog_manual_update.hide() | ||
383 | 1183 | if res == Gtk.ResponseType.YES: | ||
384 | 1184 | self.on_button_reload_clicked(None) | ||
385 | 1185 | |||
386 | 1186 | def check_all_updates_installable(self): | 1044 | def check_all_updates_installable(self): |
387 | 1187 | """ Check if all available updates can be installed and suggest | 1045 | """ Check if all available updates can be installed and suggest |
388 | 1188 | to run a distribution upgrade if not """ | 1046 | to run a distribution upgrade if not """ |
389 | @@ -1214,9 +1072,7 @@ | |||
390 | 1214 | self.meta.connect("new_dist_available",self.new_dist_available) | 1072 | self.meta.connect("new_dist_available",self.new_dist_available) |
391 | 1215 | 1073 | ||
392 | 1216 | 1074 | ||
396 | 1217 | def main(self, options): | 1075 | def main(self): |
394 | 1218 | self.options = options | ||
395 | 1219 | |||
397 | 1220 | # check for new distributin information | 1076 | # check for new distributin information |
398 | 1221 | self.check_metarelease() | 1077 | self.check_metarelease() |
399 | 1222 | 1078 | ||
400 | @@ -1224,6 +1080,4 @@ | |||
401 | 1224 | Gtk.main_iteration() | 1080 | Gtk.main_iteration() |
402 | 1225 | 1081 | ||
403 | 1226 | self.fillstore() | 1082 | self.fillstore() |
404 | 1227 | self.check_auto_update() | ||
405 | 1228 | self.alert_watcher.check_alert_state() | 1083 | self.alert_watcher.check_alert_state() |
406 | 1229 | Gtk.main() | ||
407 | 1230 | 1084 | ||
408 | === added file 'UpdateManager/UpdateProgress.py' | |||
409 | --- UpdateManager/UpdateProgress.py 1970-01-01 00:00:00 +0000 | |||
410 | +++ UpdateManager/UpdateProgress.py 2012-06-25 15:02:27 +0000 | |||
411 | @@ -0,0 +1,84 @@ | |||
412 | 1 | # UpdateProgress.py | ||
413 | 2 | # | ||
414 | 3 | # Copyright (c) 2004-2012 Canonical | ||
415 | 4 | # 2004 Michiel Sikkes | ||
416 | 5 | # 2005 Martin Willemoes Hansen | ||
417 | 6 | # 2010 Mohamed Amine IL Idrissi | ||
418 | 7 | # | ||
419 | 8 | # Author: Michiel Sikkes <michiel@eyesopened.nl> | ||
420 | 9 | # Michael Vogt <mvo@debian.org> | ||
421 | 10 | # Martin Willemoes Hansen <mwh@sysrq.dk> | ||
422 | 11 | # Mohamed Amine IL Idrissi <ilidrissiamine@gmail.com> | ||
423 | 12 | # Alex Launi <alex.launi@canonical.com> | ||
424 | 13 | # Michael Terry <michael.terry@canonical.com> | ||
425 | 14 | # | ||
426 | 15 | # This program is free software; you can redistribute it and/or | ||
427 | 16 | # modify it under the terms of the GNU General Public License as | ||
428 | 17 | # published by the Free Software Foundation; either version 2 of the | ||
429 | 18 | # License, or (at your option) any later version. | ||
430 | 19 | # | ||
431 | 20 | # This program is distributed in the hope that it will be useful, | ||
432 | 21 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
433 | 22 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
434 | 23 | # GNU General Public License for more details. | ||
435 | 24 | # | ||
436 | 25 | # You should have received a copy of the GNU General Public License | ||
437 | 26 | # along with this program; if not, write to the Free Software | ||
438 | 27 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
439 | 28 | # USA | ||
440 | 29 | |||
441 | 30 | from __future__ import absolute_import, print_function | ||
442 | 31 | |||
443 | 32 | from gi.repository import GLib | ||
444 | 33 | |||
445 | 34 | import warnings | ||
446 | 35 | warnings.filterwarnings("ignore", "Accessed deprecated property", DeprecationWarning) | ||
447 | 36 | |||
448 | 37 | import os | ||
449 | 38 | import sys | ||
450 | 39 | |||
451 | 40 | from .backend import get_backend | ||
452 | 41 | |||
453 | 42 | from UpdateManager.UpdateManager import UpdateManager | ||
454 | 43 | from .Core.utils import inhibit_sleep, allow_sleep | ||
455 | 44 | |||
456 | 45 | class UpdateProgress(object): | ||
457 | 46 | |||
458 | 47 | def __init__(self, datadir, options): | ||
459 | 48 | self.datadir = datadir | ||
460 | 49 | self.options = options | ||
461 | 50 | |||
462 | 51 | # Used for inhibiting power management | ||
463 | 52 | self.sleep_cookie = None | ||
464 | 53 | self.sleep_dev = None | ||
465 | 54 | |||
466 | 55 | # get the install backend | ||
467 | 56 | self.install_backend = get_backend(None) | ||
468 | 57 | self.install_backend.connect("action-done", self._on_backend_done) | ||
469 | 58 | |||
470 | 59 | def invoke_manager(self): | ||
471 | 60 | # don't display apt-listchanges | ||
472 | 61 | os.environ["APT_LISTCHANGES_FRONTEND"] = "none" | ||
473 | 62 | |||
474 | 63 | # Do not suspend during the update process | ||
475 | 64 | (self.sleep_dev, self.sleep_cookie) = inhibit_sleep() | ||
476 | 65 | |||
477 | 66 | self.install_backend.update() | ||
478 | 67 | |||
479 | 68 | def _on_backend_done(self, backend, action, authorized, success): | ||
480 | 69 | # Allow suspend after synaptic is finished | ||
481 | 70 | if self.sleep_cookie: | ||
482 | 71 | allow_sleep(self.sleep_dev, self.sleep_cookie) | ||
483 | 72 | self.sleep_cookie = self.sleep_dev = None | ||
484 | 73 | |||
485 | 74 | # Either launch main dialog and continue or quit altogether | ||
486 | 75 | if success: | ||
487 | 76 | app = UpdateManager(self.datadir, self.options) | ||
488 | 77 | # Run app.main at idle time so the progress dialog can close before we | ||
489 | 78 | # do lengthy recalculation in app.main | ||
490 | 79 | GLib.idle_add(app.main) | ||
491 | 80 | else: | ||
492 | 81 | sys.exit(0) | ||
493 | 82 | |||
494 | 83 | def main(self): | ||
495 | 84 | self.invoke_manager() | ||
496 | 0 | 85 | ||
497 | === modified file 'UpdateManager/backend/InstallBackendAptdaemon.py' | |||
498 | --- UpdateManager/backend/InstallBackendAptdaemon.py 2012-05-01 00:29:04 +0000 | |||
499 | +++ UpdateManager/backend/InstallBackendAptdaemon.py 2012-06-25 15:02:27 +0000 | |||
500 | @@ -12,6 +12,8 @@ | |||
501 | 12 | from UpdateManager.backend import InstallBackend | 12 | from UpdateManager.backend import InstallBackend |
502 | 13 | from UpdateManager.UnitySupport import UnitySupport | 13 | from UpdateManager.UnitySupport import UnitySupport |
503 | 14 | 14 | ||
504 | 15 | from gettext import gettext as _ | ||
505 | 16 | |||
506 | 15 | import apt | 17 | import apt |
507 | 16 | import dbus | 18 | import dbus |
508 | 17 | 19 | ||
509 | @@ -33,7 +35,7 @@ | |||
510 | 33 | pass | 35 | pass |
511 | 34 | try: | 36 | try: |
512 | 35 | trans = yield self.client.update_cache(defer=True) | 37 | trans = yield self.client.update_cache(defer=True) |
514 | 36 | yield self._run_in_dialog(trans, self.UPDATE) | 38 | yield self._run_in_dialog(trans, self.UPDATE, False) |
515 | 37 | except errors.NotAuthorizedError: | 39 | except errors.NotAuthorizedError: |
516 | 38 | self.emit("action-done", self.UPDATE, False, False) | 40 | self.emit("action-done", self.UPDATE, False, False) |
517 | 39 | except: | 41 | except: |
518 | @@ -53,7 +55,7 @@ | |||
519 | 53 | pkgs_install, reinstall, remove, purge, pkgs_upgrade, | 55 | pkgs_install, reinstall, remove, purge, pkgs_upgrade, |
520 | 54 | downgrade, defer=True) | 56 | downgrade, defer=True) |
521 | 55 | trans.connect("progress-changed", self._on_progress_changed) | 57 | trans.connect("progress-changed", self._on_progress_changed) |
523 | 56 | yield self._run_in_dialog(trans, self.INSTALL) | 58 | yield self._run_in_dialog(trans, self.INSTALL, True) |
524 | 57 | except errors.NotAuthorizedError as e: | 59 | except errors.NotAuthorizedError as e: |
525 | 58 | self.emit("action-done", self.INSTALL, False, False) | 60 | self.emit("action-done", self.INSTALL, False, False) |
526 | 59 | except dbus.DBusException as e: | 61 | except dbus.DBusException as e: |
527 | @@ -70,18 +72,22 @@ | |||
528 | 70 | self.unity.set_progress(progress) | 72 | self.unity.set_progress(progress) |
529 | 71 | 73 | ||
530 | 72 | @inline_callbacks | 74 | @inline_callbacks |
532 | 73 | def _run_in_dialog(self, trans, action): | 75 | def _run_in_dialog(self, trans, action, show_details): |
533 | 74 | dia = AptProgressDialog(trans, parent=self.window_main) | 76 | dia = AptProgressDialog(trans, parent=self.window_main) |
534 | 75 | dia.set_icon_name("system-software-update") | 77 | dia.set_icon_name("system-software-update") |
535 | 78 | dia.set_title(_("Software Updater")) | ||
536 | 79 | if not show_details: | ||
537 | 80 | dia.expander.set_no_show_all(True) | ||
538 | 81 | dia.expander.hide() | ||
539 | 76 | dia.connect("finished", self._on_finished, action) | 82 | dia.connect("finished", self._on_finished, action) |
541 | 77 | yield dia.run() | 83 | yield dia.run(close_on_finished=False) |
542 | 78 | 84 | ||
543 | 79 | def _on_finished(self, dialog, action): | 85 | def _on_finished(self, dialog, action): |
544 | 80 | dialog.hide() | ||
545 | 81 | # tell unity to hide the progress again | 86 | # tell unity to hide the progress again |
546 | 82 | self.unity.set_progress(-1) | 87 | self.unity.set_progress(-1) |
547 | 83 | self.emit("action-done", action, | 88 | self.emit("action-done", action, |
548 | 84 | True, dialog._transaction.exit == EXIT_SUCCESS) | 89 | True, dialog._transaction.exit == EXIT_SUCCESS) |
549 | 90 | dialog.hide() | ||
550 | 85 | 91 | ||
551 | 86 | if __name__ == "__main__": | 92 | if __name__ == "__main__": |
552 | 87 | b = InstallBackendAptdaemon(None) | 93 | b = InstallBackendAptdaemon(None) |
553 | 88 | 94 | ||
554 | === modified file 'data/com.ubuntu.update-manager.gschema.xml.in' | |||
555 | --- data/com.ubuntu.update-manager.gschema.xml.in 2012-05-31 22:18:33 +0000 | |||
556 | +++ data/com.ubuntu.update-manager.gschema.xml.in 2012-06-25 15:02:27 +0000 | |||
557 | @@ -1,10 +1,5 @@ | |||
558 | 1 | <schemalist> | 1 | <schemalist> |
559 | 2 | <schema id="com.ubuntu.update-manager" path="/apps/update-manager/"> | 2 | <schema id="com.ubuntu.update-manager" path="/apps/update-manager/"> |
560 | 3 | <key name="remind-reload" type="b"> | ||
561 | 4 | <default>true</default> | ||
562 | 5 | <summary>Remind to reload the channel list</summary> | ||
563 | 6 | <description>If automatic checking for updates is disabled, you have to reload the channel list manually. This option allows to hide the reminder shown in this case.</description> | ||
564 | 7 | </key> | ||
565 | 8 | <key name="show-details" type="b"> | 3 | <key name="show-details" type="b"> |
566 | 9 | <default>false</default> | 4 | <default>false</default> |
567 | 10 | <summary>Show details of an update</summary> | 5 | <summary>Show details of an update</summary> |
568 | 11 | 6 | ||
569 | === modified file 'data/gtkbuilder/UpdateManager.ui' | |||
570 | --- data/gtkbuilder/UpdateManager.ui 2012-05-31 22:18:33 +0000 | |||
571 | +++ data/gtkbuilder/UpdateManager.ui 2012-06-25 15:02:27 +0000 | |||
572 | @@ -230,153 +230,6 @@ | |||
573 | 230 | <action-widget response="-7">okbutton3</action-widget> | 230 | <action-widget response="-7">okbutton3</action-widget> |
574 | 231 | </action-widgets> | 231 | </action-widgets> |
575 | 232 | </object> | 232 | </object> |
576 | 233 | <object class="GtkDialog" id="dialog_manual_update"> | ||
577 | 234 | <property name="can_focus">False</property> | ||
578 | 235 | <property name="border_width">6</property> | ||
579 | 236 | <property name="resizable">False</property> | ||
580 | 237 | <property name="modal">True</property> | ||
581 | 238 | <property name="window_position">center-on-parent</property> | ||
582 | 239 | <property name="type_hint">dialog</property> | ||
583 | 240 | <property name="skip_taskbar_hint">True</property> | ||
584 | 241 | <property name="skip_pager_hint">True</property> | ||
585 | 242 | <child internal-child="vbox"> | ||
586 | 243 | <object class="GtkBox" id="dialog-vbox4"> | ||
587 | 244 | <property name="visible">True</property> | ||
588 | 245 | <property name="can_focus">False</property> | ||
589 | 246 | <property name="spacing">12</property> | ||
590 | 247 | <child internal-child="action_area"> | ||
591 | 248 | <object class="GtkButtonBox" id="dialog-action_area4"> | ||
592 | 249 | <property name="visible">True</property> | ||
593 | 250 | <property name="can_focus">False</property> | ||
594 | 251 | <property name="layout_style">end</property> | ||
595 | 252 | <child> | ||
596 | 253 | <object class="GtkButton" id="cancelbutton1"> | ||
597 | 254 | <property name="label" translatable="yes">Chec_k</property> | ||
598 | 255 | <property name="use_action_appearance">False</property> | ||
599 | 256 | <property name="visible">True</property> | ||
600 | 257 | <property name="can_focus">True</property> | ||
601 | 258 | <property name="can_default">True</property> | ||
602 | 259 | <property name="receives_default">False</property> | ||
603 | 260 | <property name="use_action_appearance">False</property> | ||
604 | 261 | <property name="image">image-refresh</property> | ||
605 | 262 | <property name="use_underline">True</property> | ||
606 | 263 | </object> | ||
607 | 264 | <packing> | ||
608 | 265 | <property name="expand">False</property> | ||
609 | 266 | <property name="fill">False</property> | ||
610 | 267 | <property name="position">0</property> | ||
611 | 268 | </packing> | ||
612 | 269 | </child> | ||
613 | 270 | <child> | ||
614 | 271 | <object class="GtkButton" id="okbutton2"> | ||
615 | 272 | <property name="label">gtk-close</property> | ||
616 | 273 | <property name="use_action_appearance">False</property> | ||
617 | 274 | <property name="visible">True</property> | ||
618 | 275 | <property name="can_focus">True</property> | ||
619 | 276 | <property name="can_default">True</property> | ||
620 | 277 | <property name="receives_default">False</property> | ||
621 | 278 | <property name="use_action_appearance">False</property> | ||
622 | 279 | <property name="use_stock">True</property> | ||
623 | 280 | </object> | ||
624 | 281 | <packing> | ||
625 | 282 | <property name="expand">False</property> | ||
626 | 283 | <property name="fill">False</property> | ||
627 | 284 | <property name="position">1</property> | ||
628 | 285 | </packing> | ||
629 | 286 | </child> | ||
630 | 287 | </object> | ||
631 | 288 | <packing> | ||
632 | 289 | <property name="expand">False</property> | ||
633 | 290 | <property name="fill">True</property> | ||
634 | 291 | <property name="pack_type">end</property> | ||
635 | 292 | <property name="position">0</property> | ||
636 | 293 | </packing> | ||
637 | 294 | </child> | ||
638 | 295 | <child> | ||
639 | 296 | <object class="GtkHBox" id="hbox16"> | ||
640 | 297 | <property name="visible">True</property> | ||
641 | 298 | <property name="can_focus">False</property> | ||
642 | 299 | <property name="border_width">6</property> | ||
643 | 300 | <property name="spacing">11</property> | ||
644 | 301 | <child> | ||
645 | 302 | <object class="GtkImage" id="image12"> | ||
646 | 303 | <property name="visible">True</property> | ||
647 | 304 | <property name="can_focus">False</property> | ||
648 | 305 | <property name="xalign">0</property> | ||
649 | 306 | <property name="yalign">0</property> | ||
650 | 307 | <property name="stock">gtk-dialog-info</property> | ||
651 | 308 | <property name="icon-size">6</property> | ||
652 | 309 | </object> | ||
653 | 310 | <packing> | ||
654 | 311 | <property name="expand">False</property> | ||
655 | 312 | <property name="fill">True</property> | ||
656 | 313 | <property name="position">0</property> | ||
657 | 314 | </packing> | ||
658 | 315 | </child> | ||
659 | 316 | <child> | ||
660 | 317 | <object class="GtkVBox" id="vbox17"> | ||
661 | 318 | <property name="visible">True</property> | ||
662 | 319 | <property name="can_focus">False</property> | ||
663 | 320 | <property name="spacing">12</property> | ||
664 | 321 | <child> | ||
665 | 322 | <object class="GtkLabel" id="label27"> | ||
666 | 323 | <property name="visible">True</property> | ||
667 | 324 | <property name="can_focus">True</property> | ||
668 | 325 | <property name="xalign">0</property> | ||
669 | 326 | <property name="yalign">0</property> | ||
670 | 327 | <property name="label" translatable="yes"><b><big>You must check for updates manually</big></b> | ||
671 | 328 | |||
672 | 329 | Your system does not check for updates automatically. You can configure this behavior in <i>Software Sources</i> on the <i>Updates</i> tab.</property> | ||
673 | 330 | <property name="use_markup">True</property> | ||
674 | 331 | <property name="wrap">True</property> | ||
675 | 332 | <property name="selectable">True</property> | ||
676 | 333 | </object> | ||
677 | 334 | <packing> | ||
678 | 335 | <property name="expand">False</property> | ||
679 | 336 | <property name="fill">False</property> | ||
680 | 337 | <property name="position">0</property> | ||
681 | 338 | </packing> | ||
682 | 339 | </child> | ||
683 | 340 | <child> | ||
684 | 341 | <object class="GtkCheckButton" id="checkbutton_reminder"> | ||
685 | 342 | <property name="label" translatable="yes">_Hide this information in the future</property> | ||
686 | 343 | <property name="use_action_appearance">False</property> | ||
687 | 344 | <property name="visible">True</property> | ||
688 | 345 | <property name="can_focus">True</property> | ||
689 | 346 | <property name="receives_default">False</property> | ||
690 | 347 | <property name="use_action_appearance">False</property> | ||
691 | 348 | <property name="use_underline">True</property> | ||
692 | 349 | <property name="xalign">0.5</property> | ||
693 | 350 | <property name="draw_indicator">True</property> | ||
694 | 351 | <signal name="toggled" handler="on_checkbutton_reminder_toggled" swapped="no"/> | ||
695 | 352 | </object> | ||
696 | 353 | <packing> | ||
697 | 354 | <property name="expand">False</property> | ||
698 | 355 | <property name="fill">False</property> | ||
699 | 356 | <property name="position">1</property> | ||
700 | 357 | </packing> | ||
701 | 358 | </child> | ||
702 | 359 | </object> | ||
703 | 360 | <packing> | ||
704 | 361 | <property name="expand">False</property> | ||
705 | 362 | <property name="fill">False</property> | ||
706 | 363 | <property name="position">1</property> | ||
707 | 364 | </packing> | ||
708 | 365 | </child> | ||
709 | 366 | </object> | ||
710 | 367 | <packing> | ||
711 | 368 | <property name="expand">True</property> | ||
712 | 369 | <property name="fill">True</property> | ||
713 | 370 | <property name="position">1</property> | ||
714 | 371 | </packing> | ||
715 | 372 | </child> | ||
716 | 373 | </object> | ||
717 | 374 | </child> | ||
718 | 375 | <action-widgets> | ||
719 | 376 | <action-widget response="-8">cancelbutton1</action-widget> | ||
720 | 377 | <action-widget response="-7">okbutton2</action-widget> | ||
721 | 378 | </action-widgets> | ||
722 | 379 | </object> | ||
723 | 380 | <object class="GtkDialog" id="dialog_on_battery"> | 233 | <object class="GtkDialog" id="dialog_on_battery"> |
724 | 381 | <property name="can_focus">False</property> | 234 | <property name="can_focus">False</property> |
725 | 382 | <property name="border_width">6</property> | 235 | <property name="border_width">6</property> |
726 | @@ -607,11 +460,6 @@ | |||
727 | 607 | <property name="can_focus">False</property> | 460 | <property name="can_focus">False</property> |
728 | 608 | <property name="stock">gtk-apply</property> | 461 | <property name="stock">gtk-apply</property> |
729 | 609 | </object> | 462 | </object> |
730 | 610 | <object class="GtkImage" id="image-refresh"> | ||
731 | 611 | <property name="visible">True</property> | ||
732 | 612 | <property name="can_focus">False</property> | ||
733 | 613 | <property name="stock">gtk-refresh</property> | ||
734 | 614 | </object> | ||
735 | 615 | <object class="GtkWindow" id="window_fetch"> | 463 | <object class="GtkWindow" id="window_fetch"> |
736 | 616 | <property name="can_focus">False</property> | 464 | <property name="can_focus">False</property> |
737 | 617 | <property name="border_width">6</property> | 465 | <property name="border_width">6</property> |
738 | @@ -796,6 +644,8 @@ | |||
739 | 796 | <property name="visible">True</property> | 644 | <property name="visible">True</property> |
740 | 797 | <property name="can_focus">False</property> | 645 | <property name="can_focus">False</property> |
741 | 798 | <property name="yalign">0</property> | 646 | <property name="yalign">0</property> |
742 | 647 | <property name="pixel_size">48</property> | ||
743 | 648 | <property name="icon_name">system-software-update</property> | ||
744 | 799 | </object> | 649 | </object> |
745 | 800 | <packing> | 650 | <packing> |
746 | 801 | <property name="expand">False</property> | 651 | <property name="expand">False</property> |
747 | @@ -804,46 +654,19 @@ | |||
748 | 804 | </packing> | 654 | </packing> |
749 | 805 | </child> | 655 | </child> |
750 | 806 | <child> | 656 | <child> |
752 | 807 | <object class="GtkVBox" id="vbox_label_main"> | 657 | <object class="GtkLabel" id="label_header"> |
753 | 808 | <property name="visible">True</property> | 658 | <property name="visible">True</property> |
754 | 809 | <property name="can_focus">False</property> | 659 | <property name="can_focus">False</property> |
789 | 810 | <property name="spacing">6</property> | 660 | <property name="xalign">0</property> |
790 | 811 | <child> | 661 | <property name="use_underline">True</property> |
791 | 812 | <object class="GtkLabel" id="label_header"> | 662 | <property name="wrap">True</property> |
792 | 813 | <property name="visible">True</property> | 663 | <attributes> |
793 | 814 | <property name="can_focus">False</property> | 664 | <attribute name="weight" value="bold"/> |
794 | 815 | <property name="xalign">0</property> | 665 | <attribute name="scale" value="1.25"/> |
795 | 816 | <property name="yalign">0</property> | 666 | </attributes> |
762 | 817 | <property name="label" translatable="yes">Starting Software Updater</property> | ||
763 | 818 | <property name="use_underline">True</property> | ||
764 | 819 | <property name="wrap">True</property> | ||
765 | 820 | <attributes> | ||
766 | 821 | <attribute name="weight" value="bold"/> | ||
767 | 822 | <attribute name="scale" value="1.25"/> | ||
768 | 823 | </attributes> | ||
769 | 824 | </object> | ||
770 | 825 | <packing> | ||
771 | 826 | <property name="expand">False</property> | ||
772 | 827 | <property name="fill">False</property> | ||
773 | 828 | <property name="position">0</property> | ||
774 | 829 | </packing> | ||
775 | 830 | </child> | ||
776 | 831 | <child> | ||
777 | 832 | <object class="GtkLabel" id="label_main_details"> | ||
778 | 833 | <property name="visible">True</property> | ||
779 | 834 | <property name="can_focus">False</property> | ||
780 | 835 | <property name="xalign">0</property> | ||
781 | 836 | <property name="wrap">True</property> | ||
782 | 837 | </object> | ||
783 | 838 | <packing> | ||
784 | 839 | <property name="expand">False</property> | ||
785 | 840 | <property name="fill">False</property> | ||
786 | 841 | <property name="position">1</property> | ||
787 | 842 | </packing> | ||
788 | 843 | </child> | ||
796 | 844 | </object> | 667 | </object> |
797 | 845 | <packing> | 668 | <packing> |
799 | 846 | <property name="expand">True</property> | 669 | <property name="expand">False</property> |
800 | 847 | <property name="fill">True</property> | 670 | <property name="fill">True</property> |
801 | 848 | <property name="position">1</property> | 671 | <property name="position">1</property> |
802 | 849 | </packing> | 672 | </packing> |
803 | @@ -998,6 +821,9 @@ | |||
804 | 998 | </child> | 821 | </child> |
805 | 999 | <signal name="cursor-changed" handler="on_treeview_update_cursor_changed" swapped="no"/> | 822 | <signal name="cursor-changed" handler="on_treeview_update_cursor_changed" swapped="no"/> |
806 | 1000 | <signal name="row-activated" handler="on_treeview_update_row_activated" swapped="no"/> | 823 | <signal name="row-activated" handler="on_treeview_update_row_activated" swapped="no"/> |
807 | 824 | <child internal-child="selection"> | ||
808 | 825 | <object class="GtkTreeSelection" id="treeview-selection2"/> | ||
809 | 826 | </child> | ||
810 | 1001 | </object> | 827 | </object> |
811 | 1002 | </child> | 828 | </child> |
812 | 1003 | </object> | 829 | </object> |
813 | @@ -1365,24 +1191,6 @@ | |||
814 | 1365 | </packing> | 1191 | </packing> |
815 | 1366 | </child> | 1192 | </child> |
816 | 1367 | <child> | 1193 | <child> |
817 | 1368 | <object class="GtkButton" id="button_reload"> | ||
818 | 1369 | <property name="label" translatable="yes">Chec_k</property> | ||
819 | 1370 | <property name="use_action_appearance">False</property> | ||
820 | 1371 | <property name="visible">True</property> | ||
821 | 1372 | <property name="can_focus">True</property> | ||
822 | 1373 | <property name="receives_default">True</property> | ||
823 | 1374 | <property name="use_action_appearance">False</property> | ||
824 | 1375 | <property name="image">image-refresh</property> | ||
825 | 1376 | <property name="use_underline">True</property> | ||
826 | 1377 | <signal name="clicked" handler="on_button_reload_clicked" swapped="no"/> | ||
827 | 1378 | </object> | ||
828 | 1379 | <packing> | ||
829 | 1380 | <property name="expand">False</property> | ||
830 | 1381 | <property name="fill">True</property> | ||
831 | 1382 | <property name="position">1</property> | ||
832 | 1383 | </packing> | ||
833 | 1384 | </child> | ||
834 | 1385 | <child> | ||
835 | 1386 | <object class="GtkButton" id="button_close"> | 1194 | <object class="GtkButton" id="button_close"> |
836 | 1387 | <property name="label">gtk-close</property> | 1195 | <property name="label">gtk-close</property> |
837 | 1388 | <property name="use_action_appearance">False</property> | 1196 | <property name="use_action_appearance">False</property> |
838 | 1389 | 1197 | ||
839 | === modified file 'data/update-manager.convert' | |||
840 | --- data/update-manager.convert 2012-05-31 22:18:33 +0000 | |||
841 | +++ data/update-manager.convert 2012-06-25 15:02:27 +0000 | |||
842 | @@ -1,5 +1,4 @@ | |||
843 | 1 | [com.ubuntu.update-manager] | 1 | [com.ubuntu.update-manager] |
844 | 2 | remind-reload = /apps/update-manager/remind_reload | ||
845 | 3 | show-details = /apps/update-manager/show_details | 2 | show-details = /apps/update-manager/show_details |
846 | 4 | check-dist-upgrades = /apps/update-manager/check_dist_upgrades | 3 | check-dist-upgrades = /apps/update-manager/check_dist_upgrades |
847 | 5 | autoclose-install-window = /apps/update-manager/autoclose_install_window | 4 | autoclose-install-window = /apps/update-manager/autoclose_install_window |
848 | 6 | 5 | ||
849 | === modified file 'update-manager' | |||
850 | --- update-manager 2012-06-13 22:45:57 +0000 | |||
851 | +++ update-manager 2012-06-25 15:02:27 +0000 | |||
852 | @@ -26,13 +26,17 @@ | |||
853 | 26 | from __future__ import print_function | 26 | from __future__ import print_function |
854 | 27 | 27 | ||
855 | 28 | from gi.repository import Gtk | 28 | from gi.repository import Gtk |
856 | 29 | from gi.repository import Gio | ||
857 | 29 | import gi | 30 | import gi |
858 | 30 | gi.require_version("Gtk", "3.0") | 31 | gi.require_version("Gtk", "3.0") |
859 | 31 | 32 | ||
860 | 32 | import os | 33 | import os |
861 | 33 | import sys | 34 | import sys |
862 | 35 | import time | ||
863 | 34 | 36 | ||
864 | 35 | from UpdateManager.UpdateManager import UpdateManager | 37 | from UpdateManager.UpdateManager import UpdateManager |
865 | 38 | from UpdateManager.UpdateProgress import UpdateProgress | ||
866 | 39 | from UpdateManager.Core.utils import init_proxy | ||
867 | 36 | from DistUpgrade.DistUpgradeVersion import VERSION | 40 | from DistUpgrade.DistUpgradeVersion import VERSION |
868 | 37 | import locale | 41 | import locale |
869 | 38 | import gettext | 42 | import gettext |
870 | @@ -42,7 +46,8 @@ | |||
871 | 42 | if __name__ == "__main__": | 46 | if __name__ == "__main__": |
872 | 43 | 47 | ||
873 | 44 | Gtk.init_check(sys.argv) | 48 | Gtk.init_check(sys.argv) |
875 | 45 | 49 | Gtk.Window.set_default_icon_name("system-software-update") | |
876 | 50 | |||
877 | 46 | #FIXME: Workaround a bug in optparser which doesn't handle unicode/str | 51 | #FIXME: Workaround a bug in optparser which doesn't handle unicode/str |
878 | 47 | # correctly, see http://bugs.python.org/issue4391 | 52 | # correctly, see http://bugs.python.org/issue4391 |
879 | 48 | # Should be resolved by Python3 | 53 | # Should be resolved by Python3 |
880 | @@ -117,5 +122,14 @@ | |||
881 | 117 | controller = DistUpgradeController(view, datadir=data_dir) | 122 | controller = DistUpgradeController(view, datadir=data_dir) |
882 | 118 | controller.doPartialUpgrade() | 123 | controller.doPartialUpgrade() |
883 | 119 | else: | 124 | else: |
886 | 120 | app = UpdateManager(data_dir, options) | 125 | # keep track when we run (for update-notifier) |
887 | 121 | app.main(options) | 126 | settings = Gio.Settings("com.ubuntu.update-manager") |
888 | 127 | settings.set_int("launch-time", int(time.time())) | ||
889 | 128 | init_proxy(settings) | ||
890 | 129 | |||
891 | 130 | if options.no_update: | ||
892 | 131 | app = UpdateManager(data_dir, options) | ||
893 | 132 | else: | ||
894 | 133 | app = UpdateProgress(data_dir, options) | ||
895 | 134 | app.main() | ||
896 | 135 | Gtk.main() |
Note that I also filed https:/ /code.launchpad .net/~mterry/ update- notifier/ use-no- update/ +merge/ 108377 to have update-notifier pass --no-update when launching update-manager.