Merge lp:~mvo/software-center/workaround-gtk-regression-lp986186 into lp:software-center

Proposed by Michael Vogt
Status: Merged
Merged at revision: 2994
Proposed branch: lp:~mvo/software-center/workaround-gtk-regression-lp986186
Merge into: lp:software-center
Diff against target: 103 lines (+37/-26)
1 file modified
softwarecenter/ui/gtk3/widgets/apptreeview.py (+37/-26)
To merge this branch: bzr merge lp:~mvo/software-center/workaround-gtk-regression-lp986186
Reviewer Review Type Date Requested Status
Gary Lasker (community) Approve
Review via email: mp+103314@code.launchpad.net

Description of the change

This is a workaround for bug #986186. To test:
1. open s-c and click on system
2. watch the system freeze for more than 10s

with this branch the delay is in the range of 1s now, not great but better than before.

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

Hello Michael! So, hmm, on my system it seems I don't see nearly as dramatic a delay when clicking System as you are seeing. For me, it's about 3-4 seconds. That's about the same time as I'm seeing in my Oneiric VM, fully updated. With your branch, it does seem a slight amount faster, maybe about 1/2 second or so. Based on this, I'm not sure that I can say with any confidence that I'm able to reproduce the issue.

The other thing that I'm finding a bit confusing is that the report, bug 986186, appears to be against Software Center 3.0.6 in Oneiric, but this shouldn't be a bug in Oneiric.

However, looking at your code, it looks just fine, and so I will mark this as approved, with the caveat that I appear to be unable to reproduce the actual issue on my own machine, and so cannot verify the fix directly.

And please let me know if I am misunderstanding something! Thanks! :)

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

Thanks Gary, that is interessting, maybe its releated to something like theme/a11y or something like this. If you run the testcase attached to the bug (https://bugs.launchpad.net/ubuntu/+source/software-center/+bug/986186/+attachment/3101578/+files/lala.py) what numbers do you get?

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Here's the output of lala:

$ python lala.py
not visible set_model is fast
set_model takes: 0.0163969993591
nr of nr_cell_data_func_calls 0

delayed set_model is not so fast anymore
set_model takes: 0.0361030101776
nr of nr_cell_data_func_calls 91

Hmm, does this make sense? Very different to your result, it seems??

Revision history for this message
Gary Lasker (gary-lasker) wrote :

P.S. My these is Ambience and I have a11y turned off.

Revision history for this message
Gary Lasker (gary-lasker) wrote :

Sorry, my *theme* is Ambience.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'softwarecenter/ui/gtk3/widgets/apptreeview.py'
2--- softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-04-16 09:38:51 +0000
3+++ softwarecenter/ui/gtk3/widgets/apptreeview.py 2012-04-24 16:06:20 +0000
4@@ -63,17 +63,13 @@
5
6 self.set_headers_visible(False)
7
8- # a11y: this is a cell renderer that only displays a icon, but still
9- # has a markup property for orca and friends
10- # we use it so that orca and other a11y tools get proper text to read
11- # it needs to be the first one, because that is what the tools look
12- # at by default
13- tr = CellRendererAppView(icons,
14+ # our custom renderer
15+ self._renderer = CellRendererAppView(icons,
16 self.create_pango_layout(''),
17 show_ratings,
18 Icons.INSTALLED_OVERLAY)
19- tr.set_pixbuf_width(32)
20- tr.set_button_spacing(em(0.3))
21+ self._renderer.set_pixbuf_width(32)
22+ self._renderer.set_button_spacing(em(0.3))
23
24 # create buttons and set initial strings
25 info = CellButtonRenderer(self,
26@@ -89,37 +85,43 @@
27 self.VARIANT_REMOVE: _('Remove'),
28 self.VARIANT_PURCHASE: _(u'Buy\u2026')})
29
30- tr.button_pack_start(info)
31- tr.button_pack_end(action)
32+ self._renderer.button_pack_start(info)
33+ self._renderer.button_pack_end(action)
34
35- column = Gtk.TreeViewColumn("Applications", tr,
36- application=AppGenericStore.COL_ROW_DATA)
37- column.set_cell_data_func(tr, self._cell_data_func_cb)
38- column.set_fixed_width(200)
39- column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
40- self.append_column(column)
41+ self._column = Gtk.TreeViewColumn(
42+ "Applications", self._renderer,
43+ application=AppGenericStore.COL_ROW_DATA)
44+ self._column.set_cell_data_func(
45+ self._renderer, self._cell_data_func_cb)
46+ self._column.set_fixed_width(200)
47+ self._column.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
48+ self.append_column(self._column)
49
50 # network status watcher
51 watcher = get_network_watcher()
52- watcher.connect("changed", self._on_net_state_changed, tr)
53+ watcher.connect("changed", self._on_net_state_changed, self._renderer)
54
55 # custom cursor
56 self._cursor_hand = Gdk.Cursor.new(Gdk.CursorType.HAND2)
57
58- self.connect("style-updated", self._on_style_updated, tr)
59+ self.connect("style-updated", self._on_style_updated, self._renderer)
60 # button and motion are "special"
61- self.connect("button-press-event", self._on_button_press_event, tr)
62- self.connect("button-release-event", self._on_button_release_event, tr)
63- self.connect("key-press-event", self._on_key_press_event, tr)
64- self.connect("key-release-event", self._on_key_release_event, tr)
65- self.connect("motion-notify-event", self._on_motion, tr)
66- self.connect("cursor-changed", self._on_cursor_changed, tr)
67+ self.connect("button-press-event", self._on_button_press_event,
68+ self._renderer)
69+ self.connect("button-release-event", self._on_button_release_event,
70+ self._renderer)
71+ self.connect("key-press-event", self._on_key_press_event,
72+ self._renderer)
73+ self.connect("key-release-event", self._on_key_release_event,
74+ self._renderer)
75+ self.connect("motion-notify-event", self._on_motion, self._renderer)
76+ self.connect("cursor-changed", self._on_cursor_changed, self._renderer)
77 # our own "activate" handler
78- self.connect("row-activated", self._on_row_activated, tr)
79+ self.connect("row-activated", self._on_row_activated, self._renderer)
80
81 self.backend = get_install_backend()
82 self._transactions_connected = False
83- self.connect('realize', self._on_realize, tr)
84+ self.connect('realize', self._on_realize, self._renderer)
85
86 @property
87 def appmodel(self):
88@@ -144,6 +146,15 @@
89 model.clear()
90 self.set_model(model)
91
92+ def set_model(self, model):
93+ # the set_cell_data_func() calls here are a workaround for bug
94+ # LP: #986186 - once that is fixed upstream we can revert this
95+ # and remove the entire "set_model" again
96+ self._column.set_cell_data_func(self._renderer, None)
97+ Gtk.TreeView.set_model(self, model)
98+ self._column.set_cell_data_func(
99+ self._renderer, self._cell_data_func_cb)
100+
101 def expand_path(self, path):
102 if path is not None and not isinstance(path, Gtk.TreePath):
103 raise TypeError("Expects Gtk.TreePath or None, got %s" %

Subscribers

People subscribed via source and target branches