From abff0a8cecb5b16c7c6f4a21cd3e4d8d8023ccab Mon Sep 17 00:00:00 2001 From: Tomeu Vizoso Date: Wed, 21 Feb 2007 12:02:57 +0100 Subject: [PATCH] Throw NotImplementedError in abstract method. --- sugar/graphics/button.py | 7 +++++-- sugar/graphics/popupcontext.py | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sugar/graphics/button.py b/sugar/graphics/button.py index ea4df95c..28c9f59c 100644 --- a/sugar/graphics/button.py +++ b/sugar/graphics/button.py @@ -89,9 +89,12 @@ class Button(hippo.CanvasBox): [x, y] = [None, None] if popup_context: - [x, y] = popup_context.get_position(self._icon, popup) + try: + [x, y] = popup_context.get_position(self._icon, popup) + except NotImplementedError: + pass - if (not x) or (not y): + if [x, y] == [None, None]: context = self._icon.get_context() #[x, y] = context.translate_to_screen(self._icon) [x, y] = context.translate_to_widget(self._icon) diff --git a/sugar/graphics/popupcontext.py b/sugar/graphics/popupcontext.py index 59fb16bb..99498e93 100644 --- a/sugar/graphics/popupcontext.py +++ b/sugar/graphics/popupcontext.py @@ -44,4 +44,4 @@ class PopupContext(gobject.GObject): return self._active_control != None def get_position(self, control, popup): - return [None, None] + raise NotImplementedError