Merge lp:~mvo/software-center/lobby-visual-mvo-workaround-lp1048912 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 3193
Proposed branch: lp:~mvo/software-center/lobby-visual-mvo-workaround-lp1048912
Merge into: lp:software-center
Diff against target: 150 lines (+51/-6)
6 files modified
softwarecenter/ui/gtk3/views/lobbyview.py (+13/-0)
softwarecenter/ui/gtk3/widgets/containers.py (+1/-1)
softwarecenter/ui/gtk3/widgets/spinner.py (+7/-4)
tests/gtk3/test_recommendations_widgets.py (+17/-0)
tests/gtk3/test_spinner.py (+12/-0)
tests/gtk3/windows.py (+1/-1)
To merge this branch: bzr merge lp:~mvo/software-center/lobby-visual-mvo-workaround-lp1048912
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+125119@code.launchpad.net

Description of the change

As discussed in the previous irc meeting this branch adds a workaround
for the visual corruption we see when recommendations are turned on.

Once the root cause for bug #1048912 the workaround can be removed,
this is documented in the code. The downside of this patch is additional
queue_draw() commands which is bad but the amount if not huge so the
tradeoff is worthwhile.

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

Thanks, Michael!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'softwarecenter/ui/gtk3/views/lobbyview.py'
--- softwarecenter/ui/gtk3/views/lobbyview.py 2012-09-17 15:17:48 +0000
+++ softwarecenter/ui/gtk3/views/lobbyview.py 2012-09-19 07:42:38 +0000
@@ -275,8 +275,21 @@
275 self.recommended_for_you_panel.connect(275 self.recommended_for_you_panel.connect(
276 'more-button-clicked',276 'more-button-clicked',
277 self.on_category_clicked)277 self.on_category_clicked)
278 # until bug #1048912 with the testcase in
279 # tests/gtk3/test_lp1048912.py
280 # is fixed this workaround for the drawing code in FramedHeaderBox
281 # is needed
282 self.recommended_for_you_panel.connect(
283 "size-allocate", self._on_recommended_for_you_panel_size_allocate)
278 self.right_column.pack_start(self.recommended_for_you_panel,284 self.right_column.pack_start(self.recommended_for_you_panel,
279 True, True, 0)285 True, True, 0)
286
287 def _on_recommended_for_you_panel_size_allocate(self, rec_panel, stuff):
288 """This workaround can go once the root cause for bug #1048912 is
289 found, see also tests/gtk3/test_lp1048912.py
290 """
291 #print ">>> called on_recommended_for_you_panel_size_allocate"
292 self.queue_draw()
280293
281 def _append_recommended_for_you(self):294 def _append_recommended_for_you(self):
282 # update will (re)create the widget from scratch295 # update will (re)create the widget from scratch
283296
=== modified file 'softwarecenter/ui/gtk3/widgets/containers.py'
--- softwarecenter/ui/gtk3/widgets/containers.py 2012-09-12 02:21:03 +0000
+++ softwarecenter/ui/gtk3/widgets/containers.py 2012-09-19 07:42:38 +0000
@@ -82,7 +82,7 @@
8282
83 # overrides83 # overrides
84 def do_get_request_mode(self):84 def do_get_request_mode(self):
85 return Gtk.SizeRequestMode.HEIGHT_FOR_WIDTH85 return Gtk.SizeRequestMode.WIDTH_FOR_HEIGHT
8686
87 def do_get_preferred_height_for_width(self, width):87 def do_get_preferred_height_for_width(self, width):
88 old = self.get_allocation()88 old = self.get_allocation()
8989
=== modified file 'softwarecenter/ui/gtk3/widgets/spinner.py'
--- softwarecenter/ui/gtk3/widgets/spinner.py 2012-08-28 16:34:54 +0000
+++ softwarecenter/ui/gtk3/widgets/spinner.py 2012-09-19 07:42:38 +0000
@@ -2,6 +2,7 @@
2#2#
3# Authors:3# Authors:
4# Gary Lasker4# Gary Lasker
5# Natalia Bidart
5#6#
6# This program is free software; you can redistribute it and/or modify it under7# This program is free software; you can redistribute it and/or modify it under
7# the terms of the GNU General Public License as published by the Free Software8# the terms of the GNU General Public License as published by the Free Software
@@ -111,11 +112,13 @@
111 """ show the spinner page with a alternative message """112 """ show the spinner page with a alternative message """
112 if msg:113 if msg:
113 self.spinner_view.set_text(msg)114 self.spinner_view.set_text(msg)
114 # "mask" the spinner view momentarily to prevent it from flashing into115 # delay showing the spinner view prevent it from flashing into
115 # view in the case of short delays where it isn't actually needed116 # view in the case of short delays where it isn't actually needed
116 self.spinner_view.stop_and_hide()117 # (but only if its not already visible anyway)
117 self._last_timeout_id = GObject.timeout_add(250,118 if self.get_current_page() == self.CONTENT_PAGE:
118 self._unmask_view_spinner)119 self.spinner_view.stop_and_hide()
120 self._last_timeout_id = GObject.timeout_add(
121 250, self._unmask_view_spinner)
119122
120 def hide_spinner(self):123 def hide_spinner(self):
121 """ hide the spinner page again and show the content page """124 """ hide the spinner page again and show the content page """
122125
=== modified file 'tests/gtk3/test_recommendations_widgets.py'
--- tests/gtk3/test_recommendations_widgets.py 2012-05-30 18:39:55 +0000
+++ tests/gtk3/test_recommendations_widgets.py 2012-09-19 07:42:38 +0000
@@ -1,5 +1,10 @@
1import unittest1import unittest
22
3from gi.repository import (
4 GObject,
5 Gtk,
6 )
7
3from tests.utils import setup_test_env8from tests.utils import setup_test_env
4setup_test_env()9setup_test_env()
510
@@ -9,19 +14,31 @@
9# FIXME: the code from test_catview that tests the lobby widget should14# FIXME: the code from test_catview that tests the lobby widget should
10# move here as it should be fine to test it in isolation15# move here as it should be fine to test it in isolation
1116
17TIMEOUT=300
12class TestRecommendationsWidgets(unittest.TestCase):18class TestRecommendationsWidgets(unittest.TestCase):
1319
20 def _on_size_allocate(self, widget, allocation):
21 print widget, allocation.width, allocation.height
22
14 def test_recommendations_lobby(self):23 def test_recommendations_lobby(self):
15 win = get_test_window_recommendations(panel_type="lobby")24 win = get_test_window_recommendations(panel_type="lobby")
25 child = win.get_children()[0]
26 child.connect("size-allocate", self._on_size_allocate)
16 self.addCleanup(win.destroy)27 self.addCleanup(win.destroy)
28 GObject.timeout_add(TIMEOUT, Gtk.main_quit)
29 Gtk.main()
1730
18 def test_recommendations_category(self):31 def test_recommendations_category(self):
19 win = get_test_window_recommendations(panel_type="category")32 win = get_test_window_recommendations(panel_type="category")
20 self.addCleanup(win.destroy)33 self.addCleanup(win.destroy)
34 GObject.timeout_add(TIMEOUT, Gtk.main_quit)
35 Gtk.main()
2136
22 def test_recommendations_details(self):37 def test_recommendations_details(self):
23 win = get_test_window_recommendations(panel_type="details")38 win = get_test_window_recommendations(panel_type="details")
24 self.addCleanup(win.destroy)39 self.addCleanup(win.destroy)
40 GObject.timeout_add(TIMEOUT, Gtk.main_quit)
41 Gtk.main()
2542
2643
27if __name__ == "__main__":44if __name__ == "__main__":
2845
=== modified file 'tests/gtk3/test_spinner.py'
--- tests/gtk3/test_spinner.py 2012-08-28 16:34:54 +0000
+++ tests/gtk3/test_spinner.py 2012-09-19 07:42:38 +0000
@@ -99,6 +99,18 @@
99 self.assertTrue(self.obj.spinner_view.spinner.get_visible())99 self.assertTrue(self.obj.spinner_view.spinner.get_visible())
100 self.assertEqual(self.obj.get_current_page(), self.obj.SPINNER_PAGE)100 self.assertEqual(self.obj.get_current_page(), self.obj.SPINNER_PAGE)
101101
102 def test_show_spinner_twice(self):
103 """The spinner is not hiden/shown if its already visible."""
104 with patch.object(self.obj.spinner_view, "stop_and_hide") as m:
105 with patch.object(spinner.GObject, 'timeout_add',
106 lambda t,f: f()):
107 self.obj.show_spinner("meep")
108 self.obj.show_spinner("baap")
109 # ensure that it only called the hide once
110 self.assertEqual(m.call_count, 1)
111 # and that it updated the text
112 self.assertEqual(self.obj.spinner_view.get_text(), "baap")
113
102 def test_show_spinner_with_msg(self):114 def test_show_spinner_with_msg(self):
103 """The spinner is shown with the given message."""115 """The spinner is shown with the given message."""
104 message = 'Something I want to show'116 message = 'Something I want to show'
105117
=== modified file 'tests/gtk3/windows.py'
--- tests/gtk3/windows.py 2012-09-18 04:37:10 +0000
+++ tests/gtk3/windows.py 2012-09-19 07:42:38 +0000
@@ -386,7 +386,7 @@
386 view = recommendations.RecommendationsPanelDetails(386 view = recommendations.RecommendationsPanelDetails(
387 db, properties_helper)387 db, properties_helper)
388388
389 win = get_test_window(child=view)389 win = get_test_window(child=view, width=600, height=300)
390 win.set_data("rec_panel", view)390 win.set_data("rec_panel", view)
391 return win391 return win
392392

Subscribers

People subscribed via source and target branches