Merge lp:~gary-lasker/software-center/installed-pane-refresh into lp:software-center

Proposed by Gary Lasker
Status: Merged
Merged at revision: 2926
Proposed branch: lp:~gary-lasker/software-center/installed-pane-refresh
Merge into: lp:software-center
Diff against target: 49 lines (+18/-4)
1 file modified
softwarecenter/ui/gtk3/panes/installedpane.py (+18/-4)
To merge this branch: bzr merge lp:~gary-lasker/software-center/installed-pane-refresh
Reviewer Review Type Date Requested Status
Michael Vogt Approve
Review via email: mp+99641@code.launchpad.net

Description of the change

This branch implements a simple, low-risk fix to the quite annoying usability issue of the installed view pane refreshing every time that it is displayed, whether or not its contents have changed. Any expanded treeview categories are reset each time, and the user's place in the list is lost as well. Please take a look at corresponding bug 828887 for details, including steps to reproduce.

With this change, we only refresh the view when the contents have actually changed due to one of either 1. a different channel being selected, or 2. when the pane content itself has been refreshed (e.g., when an item is installed or removed).

All unit tests pass and I did a fair bit of additional testing of the application in use and was unable to find any regression or unwanted side effects.

Note that there is still room for improvement in the installed pane refreshing. Particularly, when there is a refresh on the view due to an install or removal, the entire treeview collapses again. This is annoying, but is far less often a use case than the one addressed by this fix (that is, simple navaigating between views).

Many thanks in advance for your review!

To post a comment you must log in.
Michael Vogt (mvo) wrote :

Thanks, that looks good.

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/panes/installedpane.py'
2--- softwarecenter/ui/gtk3/panes/installedpane.py 2012-03-15 01:00:27 +0000
3+++ softwarecenter/ui/gtk3/panes/installedpane.py 2012-03-27 23:12:21 +0000
4@@ -226,6 +226,9 @@
5
6 self.hide_appview_spinner()
7
8+ # keep track of the current view by tracking its origin
9+ self.current_displayed_origin = None
10+
11 # now we are initialized
12 self.emit("installed-pane-created")
13
14@@ -655,11 +658,19 @@
15 if self.state.search_term:
16 self._search()
17 self._build_oneconfview()
18- else:
19+ elif (view_state and
20+ view_state.channel and
21+ view_state.channel.origin is not self.current_displayed_origin):
22+ # we don't need to refresh the full installed view every time it
23+ # is displayed, so we check to see if we are viewing the same
24+ # channel and if so we don't refresh the view, note that the view
25+ # *is* is refreshed whenever the contents change and this is
26+ # sufficient (see LP: #828887)
27 self._build_categorised_installedview()
28+ self.current_displayed_origin = view_state.channel.origin
29
30- if self.state.search_term:
31- self._search(self.state.search_term)
32+ if self.state.search_term:
33+ self._search(self.state.search_term)
34 return True
35
36 def get_current_app(self):
37@@ -709,8 +720,11 @@
38 w.init_view()
39
40 from softwarecenter.backend.channel import AllInstalledChannel
41+ from softwarecenter.ui.gtk3.panes.softwarepane import DisplayState
42 w.state.channel = AllInstalledChannel()
43- w.display_overview_page(None, None)
44+ view_state = DisplayState()
45+ view_state.channel = AllInstalledChannel()
46+ w.display_overview_page(None, view_state)
47
48 win.show()
49 return win

Subscribers

People subscribed via source and target branches