Merge lp:~mterry/update-manager/stop-update into lp:update-manager
- stop-update
- Merge into main
Proposed by
Michael Terry
Status: | Merged |
---|---|
Merged at revision: | 2538 |
Proposed branch: | lp:~mterry/update-manager/stop-update |
Merge into: | lp:update-manager |
Diff against target: |
389 lines (+173/-65) 7 files modified
UpdateManager/Dialogs.py (+12/-0) UpdateManager/UpdateManager.py (+31/-14) UpdateManager/UpdateProgress.py (+1/-6) UpdateManager/UpdatesAvailable.py (+36/-36) UpdateManager/backend/InstallBackendAptdaemon.py (+3/-0) data/gtkbuilder/UpdateManager.ui (+40/-9) tests/test_stop_update.py (+50/-0) |
To merge this branch: | bzr merge lp:~mterry/update-manager/stop-update |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Michael Vogt (community) | Approve | ||
Review via email: mp+120318@code.launchpad.net |
Commit message
Description of the change
mpt added some dialogs recently to the update-manager experience if the user stops an apt update. See https:/
This branch implements those changes (and does a little minor cleanup in UpdatesAvailable by dropping some support for num_updates == 0 which shouldn't ever happen now, after the redesign).
To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote : | # |
Revision history for this message
Michael Vogt (mvo) : | # |
review:
Approve
- 2536. By Michael Terry
-
merge from trunk
- 2537. By Michael Terry
-
merge from trunk again
- 2538. By Michael Terry
-
fix pep8 and pyflakes issues
- 2539. By Michael Terry
-
adjust code to make the UpdateManager class slightly easier to unit test; add tests for stop-update code
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'UpdateManager/Dialogs.py' | |||
2 | --- UpdateManager/Dialogs.py 2012-07-06 19:30:02 +0000 | |||
3 | +++ UpdateManager/Dialogs.py 2012-08-24 23:06:30 +0000 | |||
4 | @@ -106,6 +106,18 @@ | |||
5 | 106 | self.label_desc.set_visible(bool(label)) | 106 | self.label_desc.set_visible(bool(label)) |
6 | 107 | 107 | ||
7 | 108 | 108 | ||
8 | 109 | class StoppedUpdatesDialog(Dialog): | ||
9 | 110 | def __init__(self, window_main): | ||
10 | 111 | Dialog.__init__(self, window_main) | ||
11 | 112 | self.set_header(_("You stopped the check for updates.")) | ||
12 | 113 | self.add_settings_button() | ||
13 | 114 | self.add_button(_("_Check Again"), self.check) | ||
14 | 115 | self.focus_button = self.add_button(Gtk.STOCK_OK, self.close) | ||
15 | 116 | |||
16 | 117 | def check(self): | ||
17 | 118 | self.window_main.start_update() | ||
18 | 119 | |||
19 | 120 | |||
20 | 109 | class NoUpdatesDialog(Dialog): | 121 | class NoUpdatesDialog(Dialog): |
21 | 110 | def __init__(self, window_main): | 122 | def __init__(self, window_main): |
22 | 111 | Dialog.__init__(self, window_main) | 123 | Dialog.__init__(self, window_main) |
23 | 112 | 124 | ||
24 | === modified file 'UpdateManager/UpdateManager.py' | |||
25 | --- UpdateManager/UpdateManager.py 2012-08-24 20:20:11 +0000 | |||
26 | +++ UpdateManager/UpdateManager.py 2012-08-24 23:06:30 +0000 | |||
27 | @@ -46,6 +46,7 @@ | |||
28 | 46 | ErrorDialog, | 46 | ErrorDialog, |
29 | 47 | NeedRestartDialog, | 47 | NeedRestartDialog, |
30 | 48 | NoUpdatesDialog, | 48 | NoUpdatesDialog, |
31 | 49 | StoppedUpdatesDialog, | ||
32 | 49 | PartialUpgradeDialog, | 50 | PartialUpgradeDialog, |
33 | 50 | UnsupportedDialog) | 51 | UnsupportedDialog) |
34 | 51 | from .InstallProgress import InstallProgress | 52 | from .InstallProgress import InstallProgress |
35 | @@ -162,18 +163,36 @@ | |||
36 | 162 | 163 | ||
37 | 163 | self._start_pane(UpdateProgress(self)) | 164 | self._start_pane(UpdateProgress(self)) |
38 | 164 | 165 | ||
40 | 165 | def start_available(self): | 166 | def start_available(self, cancelled_update=False): |
41 | 166 | self._look_busy() | 167 | self._look_busy() |
42 | 167 | self.refresh_cache() | 168 | self.refresh_cache() |
43 | 168 | 169 | ||
45 | 169 | if self.cache.install_count == 0: | 170 | pane = self._make_available_pane(self.cache.install_count, |
46 | 171 | os.path.exists(REBOOT_REQUIRED_FILE), | ||
47 | 172 | cancelled_update) | ||
48 | 173 | self._start_pane(pane) | ||
49 | 174 | |||
50 | 175 | def _make_available_pane(self, install_count, need_reboot, | ||
51 | 176 | cancelled_update): | ||
52 | 177 | if install_count == 0: | ||
53 | 170 | # Need Restart > New Release > No Updates | 178 | # Need Restart > New Release > No Updates |
58 | 171 | if os.path.exists(REBOOT_REQUIRED_FILE): | 179 | if need_reboot: |
59 | 172 | self._start_pane(NeedRestartDialog(self)) | 180 | return NeedRestartDialog(self) |
60 | 173 | elif not self._check_meta_release(): | 181 | pane = self._check_meta_release() |
61 | 174 | self._start_pane(NoUpdatesDialog(self)) | 182 | if pane: |
62 | 183 | return pane | ||
63 | 184 | elif cancelled_update: | ||
64 | 185 | return StoppedUpdatesDialog(self) | ||
65 | 186 | else: | ||
66 | 187 | return NoUpdatesDialog(self) | ||
67 | 175 | else: | 188 | else: |
69 | 176 | self._start_pane(UpdatesAvailable(self)) | 189 | header = None |
70 | 190 | desc = None | ||
71 | 191 | if cancelled_update: | ||
72 | 192 | header = _("You stopped the check for updates.") | ||
73 | 193 | desc = _("Updated software is available from " | ||
74 | 194 | "a previous check.") | ||
75 | 195 | return UpdatesAvailable(self, header, desc) | ||
76 | 177 | 196 | ||
77 | 178 | def start_install(self): | 197 | def start_install(self): |
78 | 179 | self._start_pane(InstallProgress(self)) | 198 | self._start_pane(InstallProgress(self)) |
79 | @@ -192,7 +211,7 @@ | |||
80 | 192 | 211 | ||
81 | 193 | def _check_meta_release(self): | 212 | def _check_meta_release(self): |
82 | 194 | if self.meta_release is None: | 213 | if self.meta_release is None: |
84 | 195 | return False | 214 | return None |
85 | 196 | 215 | ||
86 | 197 | if self.meta_release.downloading: | 216 | if self.meta_release.downloading: |
87 | 198 | # Block until we get an answer | 217 | # Block until we get an answer |
88 | @@ -202,22 +221,20 @@ | |||
89 | 202 | # Check if there is anything to upgrade to or a known-broken upgrade | 221 | # Check if there is anything to upgrade to or a known-broken upgrade |
90 | 203 | next = self.meta_release.upgradable_to | 222 | next = self.meta_release.upgradable_to |
91 | 204 | if not next or next.upgrade_broken: | 223 | if not next or next.upgrade_broken: |
93 | 205 | return False | 224 | return None |
94 | 206 | 225 | ||
95 | 207 | # Check for end-of-life | 226 | # Check for end-of-life |
96 | 208 | if self.meta_release.no_longer_supported: | 227 | if self.meta_release.no_longer_supported: |
99 | 209 | self._start_pane(UnsupportedDialog(self, self.meta_release)) | 228 | return UnsupportedDialog(self, self.meta_release) |
98 | 210 | return True | ||
100 | 211 | 229 | ||
101 | 212 | # Check for new fresh release | 230 | # Check for new fresh release |
102 | 213 | settings = Gio.Settings("com.ubuntu.update-manager") | 231 | settings = Gio.Settings("com.ubuntu.update-manager") |
103 | 214 | if (self.meta_release.new_dist and | 232 | if (self.meta_release.new_dist and |
104 | 215 | (self.options.check_dist_upgrades or | 233 | (self.options.check_dist_upgrades or |
105 | 216 | settings.get_boolean("check-dist-upgrades"))): | 234 | settings.get_boolean("check-dist-upgrades"))): |
108 | 217 | self._start_pane(DistUpgradeDialog(self, self.meta_release)) | 235 | return DistUpgradeDialog(self, self.meta_release) |
107 | 218 | return True | ||
109 | 219 | 236 | ||
111 | 220 | return False | 237 | return None |
112 | 221 | 238 | ||
113 | 222 | def _meta_release_wait_idle(self): | 239 | def _meta_release_wait_idle(self): |
114 | 223 | # 'downloading' is changed in a thread, but the signal | 240 | # 'downloading' is changed in a thread, but the signal |
115 | 224 | 241 | ||
116 | === modified file 'UpdateManager/UpdateProgress.py' | |||
117 | --- UpdateManager/UpdateProgress.py 2012-06-27 22:01:50 +0000 | |||
118 | +++ UpdateManager/UpdateProgress.py 2012-08-24 23:06:30 +0000 | |||
119 | @@ -35,7 +35,6 @@ | |||
120 | 35 | DeprecationWarning) | 35 | DeprecationWarning) |
121 | 36 | 36 | ||
122 | 37 | import os | 37 | import os |
123 | 38 | import sys | ||
124 | 39 | 38 | ||
125 | 40 | from .backend import get_backend | 39 | from .backend import get_backend |
126 | 41 | 40 | ||
127 | @@ -72,11 +71,7 @@ | |||
128 | 72 | allow_sleep(self.sleep_dev, self.sleep_cookie) | 71 | allow_sleep(self.sleep_dev, self.sleep_cookie) |
129 | 73 | self.sleep_cookie = self.sleep_dev = None | 72 | self.sleep_cookie = self.sleep_dev = None |
130 | 74 | 73 | ||
136 | 75 | # Either launch main dialog and continue or quit altogether | 74 | self.window_main.start_available(not success) |
132 | 76 | if success: | ||
133 | 77 | self.window_main.start_available() | ||
134 | 78 | else: | ||
135 | 79 | sys.exit(0) | ||
137 | 80 | 75 | ||
138 | 81 | def main(self): | 76 | def main(self): |
139 | 82 | self.invoke_manager() | 77 | self.invoke_manager() |
140 | 83 | 78 | ||
141 | === modified file 'UpdateManager/UpdatesAvailable.py' | |||
142 | --- UpdateManager/UpdatesAvailable.py 2012-06-28 00:09:03 +0000 | |||
143 | +++ UpdateManager/UpdatesAvailable.py 2012-08-24 23:06:30 +0000 | |||
144 | @@ -81,7 +81,7 @@ | |||
145 | 81 | 81 | ||
146 | 82 | class UpdatesAvailable(SimpleGtkbuilderApp): | 82 | class UpdatesAvailable(SimpleGtkbuilderApp): |
147 | 83 | 83 | ||
149 | 84 | def __init__(self, app): | 84 | def __init__(self, app, header=None, desc=None): |
150 | 85 | self.window_main = app | 85 | self.window_main = app |
151 | 86 | self.datadir = app.datadir | 86 | self.datadir = app.datadir |
152 | 87 | self.options = app.options | 87 | self.options = app.options |
153 | @@ -99,6 +99,9 @@ | |||
154 | 99 | # workaround for LP: #945536 | 99 | # workaround for LP: #945536 |
155 | 100 | self.clearing_store = False | 100 | self.clearing_store = False |
156 | 101 | 101 | ||
157 | 102 | self.custom_header = header | ||
158 | 103 | self.custom_desc = desc | ||
159 | 104 | |||
160 | 102 | self.button_close.grab_focus() | 105 | self.button_close.grab_focus() |
161 | 103 | self.dl_size = 0 | 106 | self.dl_size = 0 |
162 | 104 | self.connected = True | 107 | self.connected = True |
163 | @@ -360,9 +363,6 @@ | |||
164 | 360 | Gtk.MenuItem.new_with_mnemonic(_("_Deselect All")) | 363 | Gtk.MenuItem.new_with_mnemonic(_("_Deselect All")) |
165 | 361 | item_select_none.connect("activate", self.select_none_updgrades) | 364 | item_select_none.connect("activate", self.select_none_updgrades) |
166 | 362 | menu.append(item_select_none) | 365 | menu.append(item_select_none) |
167 | 363 | num_updates = self.cache.install_count | ||
168 | 364 | if num_updates == 0: | ||
169 | 365 | item_select_none.set_property("sensitive", False) | ||
170 | 366 | item_select_all = Gtk.MenuItem.new_with_mnemonic(_("Select _All")) | 366 | item_select_all = Gtk.MenuItem.new_with_mnemonic(_("Select _All")) |
171 | 367 | item_select_all.connect("activate", self.select_all_updgrades) | 367 | item_select_all.connect("activate", self.select_all_updgrades) |
172 | 368 | menu.append(item_select_all) | 368 | menu.append(item_select_all) |
173 | @@ -462,38 +462,38 @@ | |||
174 | 462 | """activate or disable widgets and show dialog texts correspoding to | 462 | """activate or disable widgets and show dialog texts correspoding to |
175 | 463 | the number of available updates""" | 463 | the number of available updates""" |
176 | 464 | self.refresh_updates_count() | 464 | self.refresh_updates_count() |
209 | 465 | num_updates = self.cache.install_count | 465 | |
210 | 466 | 466 | text_header = None | |
211 | 467 | if num_updates == 0: | 467 | text_desc = None |
212 | 468 | text_header = _("The software on this computer is up to date.") | 468 | |
213 | 469 | self.label_downsize.set_text("\n") | 469 | if self.custom_header is not None: |
214 | 470 | if self.cache.keep_count() == 0: | 470 | text_header = self.custom_header |
215 | 471 | self.notebook_details.set_sensitive(False) | 471 | text_desc = self.custom_desc |
216 | 472 | self.treeview_update.set_sensitive(False) | 472 | # show different text on first run (UX team suggestion) |
217 | 473 | self.button_install.set_sensitive(False) | 473 | elif self.settings.get_boolean("first-run"): |
218 | 474 | self.unity.set_install_menuitem_visible(False) | 474 | flavor = self.window_main.meta_release.flavor_name |
219 | 475 | self.button_close.grab_default() | 475 | version = self.window_main.meta_release.current_dist_version |
220 | 476 | self.textview_changes.get_buffer().set_text("") | 476 | text_header = _("Updated software has been issued since %s %s " |
221 | 477 | self.textview_descr.get_buffer().set_text("") | 477 | "was released. Do you want to install " |
222 | 478 | else: | 478 | "it now?") % (flavor, version) |
223 | 479 | # show different text on first run (UX team suggestion) | 479 | self.settings.set_boolean("first-run", False) |
224 | 480 | firstrun = self.settings.get_boolean("first-run") | 480 | else: |
225 | 481 | if firstrun: | 481 | text_header = _("Updated software is available for this " |
226 | 482 | flavor = self.window_main.meta_release.flavor_name | 482 | "computer. Do you want to install it now?") |
227 | 483 | version = self.window_main.meta_release.current_dist_version | 483 | |
228 | 484 | text_header = _("Updated software has been issued since %s %s " | 484 | self.notebook_details.set_sensitive(True) |
229 | 485 | "was released. Do you want to install " | 485 | self.treeview_update.set_sensitive(True) |
230 | 486 | "it now?") % (flavor, version) | 486 | self.button_install.grab_default() |
231 | 487 | self.settings.set_boolean("first-run", False) | 487 | self.treeview_update.set_cursor(Gtk.TreePath.new_from_string("1"), |
232 | 488 | else: | 488 | None, False) |
233 | 489 | text_header = _("Updated software is available for this " | 489 | self.label_header.set_label(text_header) |
234 | 490 | "computer. Do you want to install it now?") | 490 | |
235 | 491 | self.notebook_details.set_sensitive(True) | 491 | if text_desc is not None: |
236 | 492 | self.treeview_update.set_sensitive(True) | 492 | self.label_desc.set_label(text_desc) |
237 | 493 | self.button_install.grab_default() | 493 | self.label_desc.show() |
238 | 494 | self.treeview_update.set_cursor(Gtk.TreePath.new_from_string("1"), | 494 | else: |
239 | 495 | None, False) | 495 | self.label_desc.hide() |
240 | 496 | self.label_header.set_markup(text_header) | 496 | |
241 | 497 | return True | 497 | return True |
242 | 498 | 498 | ||
243 | 499 | # Before we shrink the window, capture the size | 499 | # Before we shrink the window, capture the size |
244 | 500 | 500 | ||
245 | === modified file 'UpdateManager/backend/InstallBackendAptdaemon.py' | |||
246 | --- UpdateManager/backend/InstallBackendAptdaemon.py 2012-06-28 00:10:23 +0000 | |||
247 | +++ UpdateManager/backend/InstallBackendAptdaemon.py 2012-08-24 23:06:30 +0000 | |||
248 | @@ -125,6 +125,8 @@ | |||
249 | 125 | progressbar_slot.add(progressbar) | 125 | progressbar_slot.add(progressbar) |
250 | 126 | 126 | ||
251 | 127 | self.button_cancel = AptCancelButton(trans) | 127 | self.button_cancel = AptCancelButton(trans) |
252 | 128 | if action == self.UPDATE: | ||
253 | 129 | self.button_cancel.set_label(Gtk.STOCK_STOP) | ||
254 | 128 | self.button_cancel.show() | 130 | self.button_cancel.show() |
255 | 129 | button_cancel_slot = builder.get_object("button_cancel_slot") | 131 | button_cancel_slot = builder.get_object("button_cancel_slot") |
256 | 130 | button_cancel_slot.add(self.button_cancel) | 132 | button_cancel_slot.add(self.button_cancel) |
257 | @@ -225,6 +227,7 @@ | |||
258 | 225 | err_dia = AptErrorDialog(trans.error, self.window_main) | 227 | err_dia = AptErrorDialog(trans.error, self.window_main) |
259 | 226 | err_dia.run() | 228 | err_dia.run() |
260 | 227 | err_dia.hide() | 229 | err_dia.hide() |
261 | 230 | sys.exit(0) | ||
262 | 228 | elif status == EXIT_SUCCESS and close_on_done: | 231 | elif status == EXIT_SUCCESS and close_on_done: |
263 | 229 | sys.exit(0) | 232 | sys.exit(0) |
264 | 230 | # tell unity to hide the progress again | 233 | # tell unity to hide the progress again |
265 | 231 | 234 | ||
266 | === modified file 'data/gtkbuilder/UpdateManager.ui' | |||
267 | --- data/gtkbuilder/UpdateManager.ui 2012-06-18 21:14:43 +0000 | |||
268 | +++ data/gtkbuilder/UpdateManager.ui 2012-08-24 23:06:30 +0000 | |||
269 | @@ -40,16 +40,47 @@ | |||
270 | 40 | </packing> | 40 | </packing> |
271 | 41 | </child> | 41 | </child> |
272 | 42 | <child> | 42 | <child> |
274 | 43 | <object class="GtkLabel" id="label_header"> | 43 | <object class="GtkGrid" id="grid1"> |
275 | 44 | <property name="visible">True</property> | 44 | <property name="visible">True</property> |
276 | 45 | <property name="can_focus">False</property> | 45 | <property name="can_focus">False</property> |
284 | 46 | <property name="xalign">0</property> | 46 | <property name="margin_bottom">6</property> |
285 | 47 | <property name="use_underline">True</property> | 47 | <property name="row_spacing">6</property> |
286 | 48 | <property name="wrap">True</property> | 48 | <property name="column_spacing">12</property> |
287 | 49 | <attributes> | 49 | <child> |
288 | 50 | <attribute name="weight" value="bold"/> | 50 | <object class="GtkLabel" id="label_header"> |
289 | 51 | <attribute name="scale" value="1.25"/> | 51 | <property name="visible">True</property> |
290 | 52 | </attributes> | 52 | <property name="can_focus">False</property> |
291 | 53 | <property name="hexpand">True</property> | ||
292 | 54 | <property name="xalign">0</property> | ||
293 | 55 | <property name="wrap">True</property> | ||
294 | 56 | <attributes> | ||
295 | 57 | <attribute name="weight" value="bold"/> | ||
296 | 58 | <attribute name="scale" value="1.25"/> | ||
297 | 59 | </attributes> | ||
298 | 60 | </object> | ||
299 | 61 | <packing> | ||
300 | 62 | <property name="left_attach">0</property> | ||
301 | 63 | <property name="top_attach">0</property> | ||
302 | 64 | <property name="width">1</property> | ||
303 | 65 | <property name="height">1</property> | ||
304 | 66 | </packing> | ||
305 | 67 | </child> | ||
306 | 68 | <child> | ||
307 | 69 | <object class="GtkLabel" id="label_desc"> | ||
308 | 70 | <property name="can_focus">False</property> | ||
309 | 71 | <property name="no_show_all">True</property> | ||
310 | 72 | <property name="hexpand">True</property> | ||
311 | 73 | <property name="xalign">0</property> | ||
312 | 74 | <property name="wrap">True</property> | ||
313 | 75 | <property name="max_width_chars">20</property> | ||
314 | 76 | </object> | ||
315 | 77 | <packing> | ||
316 | 78 | <property name="left_attach">0</property> | ||
317 | 79 | <property name="top_attach">1</property> | ||
318 | 80 | <property name="width">1</property> | ||
319 | 81 | <property name="height">1</property> | ||
320 | 82 | </packing> | ||
321 | 83 | </child> | ||
322 | 53 | </object> | 84 | </object> |
323 | 54 | <packing> | 85 | <packing> |
324 | 55 | <property name="expand">False</property> | 86 | <property name="expand">False</property> |
325 | @@ -462,8 +493,8 @@ | |||
326 | 462 | <property name="receives_default">True</property> | 493 | <property name="receives_default">True</property> |
327 | 463 | <property name="use_action_appearance">False</property> | 494 | <property name="use_action_appearance">False</property> |
328 | 464 | <property name="use_stock">True</property> | 495 | <property name="use_stock">True</property> |
329 | 496 | <accelerator key="Q" signal="clicked" modifiers="GDK_CONTROL_MASK"/> | ||
330 | 465 | <accelerator key="W" signal="clicked" modifiers="GDK_CONTROL_MASK"/> | 497 | <accelerator key="W" signal="clicked" modifiers="GDK_CONTROL_MASK"/> |
331 | 466 | <accelerator key="Q" signal="clicked" modifiers="GDK_CONTROL_MASK"/> | ||
332 | 467 | </object> | 498 | </object> |
333 | 468 | <packing> | 499 | <packing> |
334 | 469 | <property name="expand">False</property> | 500 | <property name="expand">False</property> |
335 | 470 | 501 | ||
336 | === added file 'tests/test_stop_update.py' | |||
337 | --- tests/test_stop_update.py 1970-01-01 00:00:00 +0000 | |||
338 | +++ tests/test_stop_update.py 2012-08-24 23:06:30 +0000 | |||
339 | @@ -0,0 +1,50 @@ | |||
340 | 1 | #!/usr/bin/python3 | ||
341 | 2 | # -*- Mode: Python; indent-tabs-mode: nil; tab-width: 4; coding: utf-8 -*- | ||
342 | 3 | |||
343 | 4 | import logging | ||
344 | 5 | import sys | ||
345 | 6 | import unittest | ||
346 | 7 | from mock import patch | ||
347 | 8 | |||
348 | 9 | from UpdateManager.UpdateManager import UpdateManager | ||
349 | 10 | from UpdateManager.UpdatesAvailable import UpdatesAvailable | ||
350 | 11 | from UpdateManager import Dialogs | ||
351 | 12 | |||
352 | 13 | import os | ||
353 | 14 | CURDIR = os.path.dirname(os.path.abspath(__file__)) | ||
354 | 15 | |||
355 | 16 | |||
356 | 17 | class TestStopUpdate(unittest.TestCase): | ||
357 | 18 | |||
358 | 19 | def setUp(self): | ||
359 | 20 | patcher = patch('UpdateManager.UpdateManager.UpdateManager') | ||
360 | 21 | self.addCleanup(patcher.stop) | ||
361 | 22 | self.manager = patcher.start() | ||
362 | 23 | self.manager._check_meta_release.return_value = False | ||
363 | 24 | self.manager.datadir = os.path.join(CURDIR, '..', 'data') | ||
364 | 25 | |||
365 | 26 | def test_stop_no_updates(self): | ||
366 | 27 | # install_count, need_reboot, cancelled_update | ||
367 | 28 | p = UpdateManager._make_available_pane(self.manager, 0, False, True) | ||
368 | 29 | self.assertIsInstance(p, Dialogs.StoppedUpdatesDialog) | ||
369 | 30 | |||
370 | 31 | def test_no_stop_no_updates(self): | ||
371 | 32 | # install_count, need_reboot, cancelled_update | ||
372 | 33 | p = UpdateManager._make_available_pane(self.manager, 0, False, False) | ||
373 | 34 | self.assertNotIsInstance(p, Dialogs.StoppedUpdatesDialog) | ||
374 | 35 | |||
375 | 36 | def test_stop_updates(self): | ||
376 | 37 | # install_count, need_reboot, cancelled_update | ||
377 | 38 | p = UpdateManager._make_available_pane(self.manager, 1, False, True) | ||
378 | 39 | self.assertIsInstance(p, UpdatesAvailable) | ||
379 | 40 | self.assertIsNotNone(p.custom_header) | ||
380 | 41 | |||
381 | 42 | def test_no_stop_updates(self): | ||
382 | 43 | p = UpdateManager._make_available_pane(self.manager, 1, False, False) | ||
383 | 44 | self.assertIsInstance(p, UpdatesAvailable) | ||
384 | 45 | self.assertIsNone(p.custom_header) | ||
385 | 46 | |||
386 | 47 | if __name__ == '__main__': | ||
387 | 48 | if len(sys.argv) > 1 and sys.argv[1] == "-v": | ||
388 | 49 | logging.basicConfig(level=logging.DEBUG) | ||
389 | 50 | unittest.main() |
On Mon, Aug 20, 2012 at 02:45:38AM -0000, Michael Terry wrote: pane(UpdateProg ress(self) ) (self): (self, cancelled_update = False): cache() UpdatesAvailabl e.py' UpdatesAvailabl e.py 2012-06-28 00:09:03 +0000 UpdatesAvailabl e.py 2012-08-20 02:44:22 +0000 e(SimpleGtkbuil derApp) :
[..]
> @@ -162,7 +163,7 @@
>
> self._start_
>
> - def start_available
> + def start_available
> self._look_busy()
> self.refresh_
[..]
> === modified file 'UpdateManager/
> --- UpdateManager/
> +++ UpdateManager/
> @@ -81,7 +81,7 @@
>
> class UpdatesAvailabl
>
> - def __init__(self, app):
> + def __init__(self, app, header = None, desc = None):
> self.window_main = app
> self.datadir = app.datadir
> self.options = app.options
pep8 suggests to use "cancelled_ update= False" (no space around the
"=").
Otherwise this looks good, would be nice to have a test, but to get it
in before UIF I'm fine with merging it now.
Thanks,
Michael