From 124f6a5bb0529d04d3d55ca942a5d0df5c2e188e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= <manuq@laptop.org>
Date: Wed, 20 Mar 2013 23:25:30 -0300
Subject: [PATCH 4/5] CellRendererInvoker: remove redrawing when the treeview
path changes - SL #4343
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Mail-Followup-To: <sugar-devel@lists.sugarlabs.org>
Performing a redraw each time the mouse moves inside the cell doesn't
look good. Removing the redraw doesn't introduce a visual difference
and improves performance.
Signed-off-by: Manuel Quiñones <manuq@laptop.org>
---
src/sugar3/graphics/palettewindow.py | 17 -----------------
1 file changed, 17 deletions(-)
diff --git a/src/sugar3/graphics/palettewindow.py b/src/sugar3/graphics/palettewindow.py
index 28789f3..d6bfbf2 100644
a
|
b
|
class CellRendererInvoker(Invoker): |
1406 | 1406 | path, column_, x_, y_ = tree_view.get_path_at_pos(int(event.x), |
1407 | 1407 | int(event.y)) |
1408 | 1408 | if path != self.path: |
1409 | | if self.path is not None: |
1410 | | self._redraw_path(self.path) |
1411 | | if path is not None: |
1412 | | self._redraw_path(path) |
1413 | 1409 | if self.palette is not None: |
1414 | 1410 | self.palette.popdown(immediate=True) |
1415 | 1411 | self.palette = None |
… |
… |
class CellRendererInvoker(Invoker): |
1420 | 1416 | return False |
1421 | 1417 | self.notify_mouse_enter() |
1422 | 1418 | else: |
1423 | | if self.path is not None: |
1424 | | self._redraw_path(self.path) |
1425 | 1419 | self.path = None |
1426 | 1420 | |
1427 | 1421 | if event.get_source_device().get_source() == \ |
… |
… |
class CellRendererInvoker(Invoker): |
1429 | 1423 | return False |
1430 | 1424 | self.notify_mouse_leave() |
1431 | 1425 | |
1432 | | def _redraw_path(self, path): |
1433 | | column = None |
1434 | | for column in self._tree_view.get_columns(): |
1435 | | if self._cell_renderer in column.get_cells(): |
1436 | | break |
1437 | | assert column is not None |
1438 | | area = self._tree_view.get_background_area(path, column) |
1439 | | x, y = \ |
1440 | | self._tree_view.convert_bin_window_to_widget_coords(area.x, area.y) |
1441 | | self._tree_view.queue_draw_area(x, y, area.width, area.height) |
1442 | | |
1443 | 1426 | def __leave_notify_event_cb(self, widget, event): |
1444 | 1427 | if event.mode == Gdk.CrossingMode.NORMAL: |
1445 | 1428 | self.notify_mouse_leave() |