Merge lp:~mvo/software-center/lp977179 into lp:software-center

Proposed by Michael Vogt on 2012-04-13
Status: Merged
Merged at revision: 2977
Proposed branch: lp:~mvo/software-center/lp977179
Merge into: lp:software-center
Diff against target: 74 lines (+8/-15)
1 file modified
softwarecenter/ui/gtk3/widgets/reviews.py (+8/-15)
To merge this branch: bzr merge lp:~mvo/software-center/lp977179
Reviewer Review Type Date Requested Status
Gary Lasker (community) 2012-04-13 Approve on 2012-04-16
Review via email: mp+101926@code.launchpad.net

Description of the change

This branch started out to fix the crash in bug #977179 (it still does fix that).

But then I got carried away a bit and fixed the fact that the reviews UI does not react
properly to network change events currently. The problem is that we use "show_all" after _fill()
which means that when the elements are hidden they become visible again. This branch should fix
that now.

To test open a package with reviews like eg. apt and disconnect network-manager. In trunk
you will still see "was this review useful yes/no" but with that branch those elementes are
hidden now. Same when starting without network. When the network becomes available the elements
become available as well.

Extra critical review for this is appreciated :)

To post a comment you must log in.
Gary Lasker (gary-lasker) wrote :

Michael, this is really nice. It does just the right thing. 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/widgets/reviews.py'
2--- softwarecenter/ui/gtk3/widgets/reviews.py 2012-03-13 08:28:22 +0000
3+++ softwarecenter/ui/gtk3/widgets/reviews.py 2012-04-13 16:18:33 +0000
4@@ -199,6 +199,7 @@
5 pkgversion = self._parent.app_details.version
6 review = UIReview(r, pkgversion, self.logged_in_person,
7 self.useful_votes)
8+ review.show_all()
9 self.vbox.pack_start(review, True, True, 0)
10
11 def _be_the_first_to_review(self):
12@@ -273,7 +274,6 @@
13 # always hide spinner and call _fill (fine if there is nothing to do)
14 self.hide_spinner()
15 self._fill()
16- self.vbox.show_all()
17
18 if self.reviews:
19 # adjust label if we have reviews
20@@ -452,17 +452,10 @@
21 self._allocation = None
22
23 if review_data:
24- # when this is mapped, show/hide widgets that are network sensitive
25- # this ensures that even with show_all() we show the right stuff
26- self.connect('realize',
27- self._on_realize,
28- review_data,
29- app_version,
30- logged_in_person,
31- useful_votes)
32-
33- def _on_realize(self, widget, *content):
34- self._build(*content)
35+ self._build(review_data,
36+ app_version,
37+ logged_in_person,
38+ useful_votes)
39
40 def _on_report_abuse_clicked(self, button):
41 reviews = self.get_ancestor(UIReviewsList)
42@@ -690,6 +683,7 @@
43 watcher.connect(
44 "changed", lambda w, s: self._on_network_state_change())
45
46+
47 def _build_usefulness_ui(self, current_user_reviewer, useful_total,
48 useful_favorable, useful_votes,
49 usefulness_submit_error=False):
50@@ -738,14 +732,14 @@
51 if network_state_is_connected():
52 self.likebox.show()
53 self.useful.show()
54- self.complain.show()
55+ self.flagbox.show()
56 else:
57 self.likebox.hide()
58 # we hide the useful box because if its there it says something
59 # like "10 people found this useful. Did you?" but you can't
60 # actually submit anything without network
61 self.useful.hide()
62- self.complain.hide()
63+ self.flagbox.hide()
64
65 def _get_usefulness_label(self, current_user_reviewer,
66 useful_total, useful_favorable, already_voted):
67@@ -839,7 +833,6 @@
68 # verb, it won't need a question mark.
69 self.complain = Link(m % _('Inappropriate?'))
70 self.complain.set_name("subtle-label")
71- self.complain.set_sensitive(network_state_is_connected())
72 self.flagbox.pack_start(self.complain, False, False, 0)
73 self.complain.connect('clicked', self._on_report_abuse_clicked)
74 self.flagbox.show_all()

Subscribers

People subscribed via source and target branches