Merge lp:~mvo/software-center/fix-lp1011522 into lp:software-center/5.2

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3058
Proposed branch: lp:~mvo/software-center/fix-lp1011522
Merge into: lp:software-center/5.2
Diff against target: 72 lines (+27/-6)
2 files modified
softwarecenter/ui/gtk3/app.py (+3/-1)
test/gtk3/test_app.py (+24/-5)
To merge this branch: bzr merge lp:~mvo/software-center/fix-lp1011522
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+112288@code.launchpad.net

Description of the change

This branch fixes bug #1011522. To test:
- run software-center
- click on reinstall-previous purchases
- wait until the data is available
- click on reinstall-previous-purchases again
- a spinner appears and never goes away

This branch fixes that behavior.

To post a comment you must log in.
Revision history for this message
Gary Lasker (gary-lasker) wrote :

Nice simple fix, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/app.py'
2--- softwarecenter/ui/gtk3/app.py 2012-06-01 17:51:05 +0000
3+++ softwarecenter/ui/gtk3/app.py 2012-06-27 08:26:28 +0000
4@@ -882,12 +882,14 @@
5 def on_menuitem_reinstall_purchases_activate(self, menuitem):
6 self.view_manager.set_active_view(ViewPages.AVAILABLE)
7 self.view_manager.search_entry.clear_with_no_signal()
8- self.available_pane.show_appview_spinner()
9 if self.available_for_me_query:
10 # we already have the list of available items, so just show it
11+ # (no need for spinner here)
12 self.available_pane.on_previous_purchases_activated(
13 self.available_for_me_query)
14 else:
15+ # show spinner as this may take some time
16+ self.available_pane.show_appview_spinner()
17 # fetch the list of available items and show it
18 self._create_scagent_if_needed()
19 self._login_via_dbus_sso()
20
21=== modified file 'test/gtk3/test_app.py'
22--- test/gtk3/test_app.py 2012-05-21 20:10:39 +0000
23+++ test/gtk3/test_app.py 2012-06-27 08:26:28 +0000
24@@ -5,17 +5,23 @@
25
26 from collections import defaultdict
27 from functools import partial
28-
29-from mock import Mock
30-
31-from testutils import FakedCache, get_mock_options, setup_test_env
32+import xapian
33+
34+from mock import Mock, patch
35+
36+from testutils import (
37+ FakedCache,
38+ get_mock_options,
39+ setup_test_env,
40+ do_events_with_sleep,
41+ )
42 setup_test_env()
43
44 import softwarecenter.paths
45 from softwarecenter.db import DebFileApplication, DebFileOpenError
46 from softwarecenter.enums import PkgStates, SearchSeparators
47 from softwarecenter.ui.gtk3 import app
48-
49+from softwarecenter.ui.gtk3.widgets.spinner import SpinnerNotebook
50
51 class ParsePackagesArgsTestCase(unittest.TestCase):
52 """Test suite for the parse_packages_args helper."""
53@@ -315,6 +321,19 @@
54
55 installed = True
56
57+class MenuTestCase(AppTestCase):
58+ """ Test case for the menus """
59+
60+ def test_reinstall_previous_purchases_lp1011522(self):
61+ # pretend we have the available_for_me data (much quicker
62+ # than to do a real s-c-agent query for this)
63+ self.app.available_for_me_query = xapian.Query()
64+ self.app.on_menuitem_reinstall_purchases_activate(None)
65+ do_events_with_sleep()
66+ self.assertEqual(
67+ self.app.available_pane.spinner_notebook.get_current_page(),
68+ SpinnerNotebook.CONTENT_PAGE)
69+
70
71 if __name__ == "__main__":
72 # avoid spawning recommender-agent, reviews, software-center-agent etc,

Subscribers

People subscribed via source and target branches