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

Proposed by Michael Vogt
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) Approve
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.
Revision history for this message
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
=== modified file 'softwarecenter/ui/gtk3/widgets/reviews.py'
--- softwarecenter/ui/gtk3/widgets/reviews.py 2012-03-13 08:28:22 +0000
+++ softwarecenter/ui/gtk3/widgets/reviews.py 2012-04-13 16:18:33 +0000
@@ -199,6 +199,7 @@
199 pkgversion = self._parent.app_details.version199 pkgversion = self._parent.app_details.version
200 review = UIReview(r, pkgversion, self.logged_in_person,200 review = UIReview(r, pkgversion, self.logged_in_person,
201 self.useful_votes)201 self.useful_votes)
202 review.show_all()
202 self.vbox.pack_start(review, True, True, 0)203 self.vbox.pack_start(review, True, True, 0)
203204
204 def _be_the_first_to_review(self):205 def _be_the_first_to_review(self):
@@ -273,7 +274,6 @@
273 # always hide spinner and call _fill (fine if there is nothing to do)274 # always hide spinner and call _fill (fine if there is nothing to do)
274 self.hide_spinner()275 self.hide_spinner()
275 self._fill()276 self._fill()
276 self.vbox.show_all()
277277
278 if self.reviews:278 if self.reviews:
279 # adjust label if we have reviews279 # adjust label if we have reviews
@@ -452,17 +452,10 @@
452 self._allocation = None452 self._allocation = None
453453
454 if review_data:454 if review_data:
455 # when this is mapped, show/hide widgets that are network sensitive455 self._build(review_data,
456 # this ensures that even with show_all() we show the right stuff456 app_version,
457 self.connect('realize',457 logged_in_person,
458 self._on_realize,458 useful_votes)
459 review_data,
460 app_version,
461 logged_in_person,
462 useful_votes)
463
464 def _on_realize(self, widget, *content):
465 self._build(*content)
466459
467 def _on_report_abuse_clicked(self, button):460 def _on_report_abuse_clicked(self, button):
468 reviews = self.get_ancestor(UIReviewsList)461 reviews = self.get_ancestor(UIReviewsList)
@@ -690,6 +683,7 @@
690 watcher.connect(683 watcher.connect(
691 "changed", lambda w, s: self._on_network_state_change())684 "changed", lambda w, s: self._on_network_state_change())
692685
686
693 def _build_usefulness_ui(self, current_user_reviewer, useful_total,687 def _build_usefulness_ui(self, current_user_reviewer, useful_total,
694 useful_favorable, useful_votes,688 useful_favorable, useful_votes,
695 usefulness_submit_error=False):689 usefulness_submit_error=False):
@@ -738,14 +732,14 @@
738 if network_state_is_connected():732 if network_state_is_connected():
739 self.likebox.show()733 self.likebox.show()
740 self.useful.show()734 self.useful.show()
741 self.complain.show()735 self.flagbox.show()
742 else:736 else:
743 self.likebox.hide()737 self.likebox.hide()
744 # we hide the useful box because if its there it says something738 # we hide the useful box because if its there it says something
745 # like "10 people found this useful. Did you?" but you can't739 # like "10 people found this useful. Did you?" but you can't
746 # actually submit anything without network740 # actually submit anything without network
747 self.useful.hide()741 self.useful.hide()
748 self.complain.hide()742 self.flagbox.hide()
749743
750 def _get_usefulness_label(self, current_user_reviewer,744 def _get_usefulness_label(self, current_user_reviewer,
751 useful_total, useful_favorable, already_voted):745 useful_total, useful_favorable, already_voted):
@@ -839,7 +833,6 @@
839 # verb, it won't need a question mark.833 # verb, it won't need a question mark.
840 self.complain = Link(m % _('Inappropriate?'))834 self.complain = Link(m % _('Inappropriate?'))
841 self.complain.set_name("subtle-label")835 self.complain.set_name("subtle-label")
842 self.complain.set_sensitive(network_state_is_connected())
843 self.flagbox.pack_start(self.complain, False, False, 0)836 self.flagbox.pack_start(self.complain, False, False, 0)
844 self.complain.connect('clicked', self._on_report_abuse_clicked)837 self.complain.connect('clicked', self._on_report_abuse_clicked)
845 self.flagbox.show_all()838 self.flagbox.show_all()

Subscribers

People subscribed via source and target branches