From 61d54cf7e2b5f2e9dd5b5866d4f6c5c2c3e97a24 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 21 Jun 2012 10:31:48 +0200 Subject: [PATCH] EventIcon: Have a default create_palette method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The create_palette mechanism allows to create palettes on demand and not for each icon upfront whether it will be needed or not. If you hover over an EventIcon and there is no palette already associated with the Invoker, the Invoker will call create_palette to see if it can be created on demand. With this patch the EventIcon will return None here (see as well CellRendererIcon or ToggleToolButton which are having the same default behavior). When subclassing EventIcon the create_palette method can be overwritten and a Palette returned (see for example the ActivityIcon in the HomeView). Without this patch you can see tracebacks when hovering over the EventIcon because the Invoker tries to call create_palette. Signed-off-by: Simon Schampijer Reviewed-by: Benjamin Berg Acked-by: Manuel QuiƱones --- src/sugar3/graphics/icon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/sugar3/graphics/icon.py b/src/sugar3/graphics/icon.py index 175d235b..0c06bbc9 100644 --- a/src/sugar3/graphics/icon.py +++ b/src/sugar3/graphics/icon.py @@ -594,6 +594,9 @@ class EventIcon(Gtk.EventBox): icon = GObject.property( type=object, getter=get_icon) + def create_palette(self): + return None + def get_palette(self): return self._palette_invoker.palette