From e2ddd70c13c43c96d7228de5a3b9d8408a8eefdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20Qui=C3=B1ones?= Date: Thu, 23 Aug 2012 00:40:10 -0300 Subject: [PATCH] Fix the drawing method of _IconWidget, used by IconTray MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Invoker draw_rectangle() now receives a Cairo context, as can be seen in [1] The testcase is also fixed by this commit. Signed-off-by: Manuel QuiƱones Acked-by: Simon Schampijer [1] http://git.sugarlabs.org/sugar-toolkit-gtk3/sugar-toolkit-gtk3/blobs/master/src/sugar3/graphics/palettewindow.py#line1018 --- src/sugar3/graphics/tray.py | 6 +++--- tests/graphics/common.py | 1 + tests/graphics/tray.py | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sugar3/graphics/tray.py b/src/sugar3/graphics/tray.py index d1c0cfd5..82e1d979 100644 --- a/src/sugar3/graphics/tray.py +++ b/src/sugar3/graphics/tray.py @@ -415,13 +415,13 @@ class _IconWidget(Gtk.EventBox): self.add(self._icon) self._icon.show() - def do_expose_event(self, event): + def do_draw(self, cr): palette = self.get_parent().palette if palette and palette.is_up(): invoker = palette.props.invoker - invoker.draw_rectangle(event, palette) + invoker.draw_rectangle(cr, palette) - Gtk.EventBox.do_expose_event(self, event) + Gtk.EventBox.do_draw(self, cr) def get_icon(self): return self._icon diff --git a/tests/graphics/common.py b/tests/graphics/common.py index e5aabd48..3d20d588 100644 --- a/tests/graphics/common.py +++ b/tests/graphics/common.py @@ -16,6 +16,7 @@ # Boston, MA 02111-1307, USA. from gi.repository import Gtk +from gi.repository import GObject from sugar3.graphics.toolbutton import ToolButton diff --git a/tests/graphics/tray.py b/tests/graphics/tray.py index fbe78d1e..3da60e38 100644 --- a/tests/graphics/tray.py +++ b/tests/graphics/tray.py @@ -31,10 +31,10 @@ test = common.Test() vbox = Gtk.VBox() tray = HTray() -vbox.pack_start(tray, False) +vbox.pack_start(tray, False, False, 0) tray.show() -theme_icons = Gtk.IconTheme.get_default().list_icons() +theme_icons = Gtk.IconTheme.get_default().list_icons(context=None) for i in range(0, 100): button = TrayButton(icon_name=theme_icons[i]) @@ -42,7 +42,7 @@ for i in range(0, 100): button.show() tray = HTray() -vbox.pack_start(tray, False) +vbox.pack_start(tray, False, False, 0) tray.show() for i in range(0, 10): @@ -53,7 +53,7 @@ for i in range(0, 10): hbox = Gtk.HBox() tray = VTray() -hbox.pack_start(tray, False) +hbox.pack_start(tray, False, False, 0) tray.show() for i in range(0, 100): @@ -62,7 +62,7 @@ for i in range(0, 100): button.show() tray = VTray() -hbox.pack_start(tray, False) +hbox.pack_start(tray, False, False, 0) tray.show() for i in range(0, 4):