Merge lp:~gary-lasker/software-center/previous-purchase-sorting-lp873104 into lp:software-center/5.2

Proposed by Gary Lasker
Status: Merged
Merged at revision: 3049
Proposed branch: lp:~gary-lasker/software-center/previous-purchase-sorting-lp873104
Merge into: lp:software-center/5.2
Diff against target: 83 lines (+11/-7)
3 files modified
softwarecenter/backend/channel.py (+2/-0)
softwarecenter/ui/gtk3/panes/availablepane.py (+9/-5)
softwarecenter/ui/gtk3/panes/softwarepane.py (+0/-2)
To merge this branch: bzr merge lp:~gary-lasker/software-center/previous-purchase-sorting-lp873104
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+109458@code.launchpad.net

Commit message

* lp:~gary-lasker/software-center/previous-purchase-sorting-lp873104:
   - return correct results when sorting the list of previous
     purchases (LP: #873104)
   - fix bug that caused a search of the list of previous purchases to
     return too many items (LP: #969273)

Description of the change

This branch fixes bug 873104 and bug 969273 by replacing the "special case" code for the previous purchases view with in an implementation using a SoftwareChannel. This allows us to use the view state in the way that we do for the other available pane views, and thereby fixes the two issues described by these bug reports.

Please also note that I removed the unused 'previous_purchases_query' from the DisplayState class.

All unit tests pass.

Many thanks for your review!

To post a comment you must log in.
Revision history for this message
Michael Vogt (mvo) wrote :

Thanks for your branch.

This is great work and a nice improvement, especially that the special case got removed is great.

The change:
29 + self.state.search_term = ""
make me a little bit nervous as the _clear_search() is called in various places, but I could not
think of (or find one by playing around) any regression this might cause so I think its fine.

Unfortunately bug #969273 is only fixed inside the "Previous purchases" subcategory (which is nice),
but its not fixed in the "All software" case which Michael Terry was referring to in the bugreport.
I updated the description there to make the testcase clearer. For me it still returns
three items with this branch. But that is not a regression or anything like this, so I'm happy to
merge the branch as #873104 is fixed.

review: Approve
Revision history for this message
Michael Vogt (mvo) wrote :

While testing I noticed bug #1011522, but its not a regression in this branch, so this is just a FYI :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/backend/channel.py'
2--- softwarecenter/backend/channel.py 2012-05-21 20:10:39 +0000
3+++ softwarecenter/backend/channel.py 2012-06-08 23:52:19 +0000
4@@ -237,6 +237,8 @@
5 channel_display_name = self.distro.get_distro_channel_description()
6 elif channel_name == "For Purchase":
7 channel_display_name = _("For Purchase")
8+ elif channel_name == "Previous Purchases":
9+ channel_display_name = _("Previous Purchases")
10 elif channel_name == "Application Review Board PPA":
11 channel_display_name = _("Independent")
12 elif channel_name == "notdownloadable":
13
14=== modified file 'softwarecenter/ui/gtk3/panes/availablepane.py'
15--- softwarecenter/ui/gtk3/panes/availablepane.py 2012-05-30 12:34:44 +0000
16+++ softwarecenter/ui/gtk3/panes/availablepane.py 2012-06-08 23:52:19 +0000
17@@ -48,6 +48,7 @@
18 from softwarepane import SoftwarePane
19 from softwarecenter.ui.gtk3.session.viewmanager import get_viewmanager
20 from softwarecenter.ui.gtk3.session.appmanager import get_appmanager
21+from softwarecenter.backend.channel import SoftwareChannel
22 from softwarecenter.backend.unitylauncher import (UnityLauncher,
23 UnityLauncherInfo,
24 TransactionDetails)
25@@ -537,6 +538,7 @@
26 self.searchentry.clear_with_no_signal()
27 self.apps_limit = 0
28 self.apps_search_term = ""
29+ self.state.search_term = ""
30
31 def _is_custom_list_search(self, search_term):
32 return (search_term and
33@@ -697,15 +699,15 @@
34
35 def display_previous_purchases(self, page, view_state):
36 self.nonapps_visible = NonAppVisibility.ALWAYS_VISIBLE
37- self.app_view.set_header_labels(_("Previous Purchases"), None)
38+ header_strings = self._get_header_for_view_state(view_state)
39+ self.app_view.set_header_labels(*header_strings)
40 self.notebook.set_current_page(AvailablePane.Pages.LIST)
41 # clear any search terms
42 self._clear_search()
43- # do not emit app-list-changed here, this is done async when
44- # the new model is ready
45- self.refresh_apps(query=self.previous_purchases_query)
46+ self.refresh_apps()
47 self.action_bar.clear()
48 self.cat_view.stop_carousels()
49+ return True
50
51 def on_subcategory_activated(self, subcat_view, category):
52 LOG.debug("on_subcategory_activated: %s %s" % (
53@@ -761,7 +763,9 @@
54 """ called to activate the previous purchases view """
55 #print cat_view, name, query
56 LOG.debug("on_previous_purchases_activated with query: %s" % query)
57- self.previous_purchases_query = query
58+ self.state.channel = SoftwareChannel("Previous Purchases",
59+ "software-center-agent",
60+ None, channel_query=query)
61 vm = get_viewmanager()
62 vm.display_page(self, AvailablePane.Pages.LIST, self.state,
63 self.display_previous_purchases)
64
65=== modified file 'softwarecenter/ui/gtk3/panes/softwarepane.py'
66--- softwarecenter/ui/gtk3/panes/softwarepane.py 2012-05-17 13:57:45 +0000
67+++ softwarecenter/ui/gtk3/panes/softwarepane.py 2012-06-08 23:52:19 +0000
68@@ -66,7 +66,6 @@
69 'application': (type(None), Application),
70 'limit': (int,),
71 'filter': (type(None), AppFilter),
72- 'previous_purchases_query': (type(None), xapian.Query),
73 'vadjustment': (float, ),
74 }
75
76@@ -78,7 +77,6 @@
77 self.application = None
78 self.limit = 0
79 self.filter = None
80- self.previous_purchases_query = None
81 self.vadjustment = 0.0
82
83 def __setattr__(self, name, val):

Subscribers

People subscribed via source and target branches