Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/sugar/graphics/popup.py
diff options
context:
space:
mode:
authorTomeu Vizoso <tomeu@tomeuvizoso.net>2007-02-21 16:05:41 (GMT)
committer Tomeu Vizoso <tomeu@tomeuvizoso.net>2007-02-21 16:05:41 (GMT)
commit3ce2a6730436aaedde4f0abdebf0cd19e4766b07 (patch)
tree121e3dfdb11af297c301cbd5b787bcae273f8666 /sugar/graphics/popup.py
parentc05b179675afd326ca80540cd55cfd1900e2970f (diff)
Refactored Menu out of Popup.
Diffstat (limited to 'sugar/graphics/popup.py')
-rw-r--r--sugar/graphics/popup.py40
1 files changed, 3 insertions, 37 deletions
diff --git a/sugar/graphics/popup.py b/sugar/graphics/popup.py
index 471be30..09a1fe2 100644
--- a/sugar/graphics/popup.py
+++ b/sugar/graphics/popup.py
@@ -21,12 +21,6 @@ import gobject
import gtk
import hippo
-from sugar.graphics import units
-from sugar.graphics.roundbox import RoundBox
-from sugar.graphics import color
-from sugar.graphics import font
-from sugar.graphics.canvasicon import CanvasIcon
-
class Popup(hippo.CanvasBox, hippo.CanvasItem):
__gtype_name__ = 'SugarPopup'
@@ -34,38 +28,10 @@ class Popup(hippo.CanvasBox, hippo.CanvasItem):
'action-completed': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, ([]))
}
- def __init__(self, title):
+ def __init__(self):
hippo.CanvasBox.__init__(self)
- self.props.background_color = color.MENU_BACKGROUND.get_int()
- self.props.border_color = color.MENU_BORDER.get_int()
- self.props.border = units.points_to_pixels(1)
self._window = None
-
- def add_item(self, action_id, label, icon_name=None, icon_color=None):
- box = hippo.CanvasBox(orientation=hippo.ORIENTATION_HORIZONTAL)
- box.props.padding = 5
- box.props.spacing = 5
- if icon_name:
- icon = CanvasIcon(icon_name=icon_name,
- scale=units.SMALL_ICON_SCALE)
- if icon_color:
- icon.props.color = icon_color
- box.append(icon)
-
- canvas_text = hippo.CanvasText()
- canvas_text.props.text = label
- canvas_text.props.color = color.LABEL_TEXT.get_int()
- canvas_text.props.font_desc = font.DEFAULT.get_pango_desc()
- box.append(canvas_text)
-
- box.connect('button-press-event', self._item_button_press_event_cb)
- self.append(box)
-
- def add_separator(self):
- box = hippo.CanvasBox()
- box.props.background_color = color.MENU_SEPARATOR.get_int()
- box.props.box_height = units.points_to_pixels(1)
- self.append(box)
+ self.connect('button-press-event', self._button_press_event_cb)
def popup(self, x, y):
if not self._window:
@@ -79,5 +45,5 @@ class Popup(hippo.CanvasBox, hippo.CanvasItem):
self._window.destroy()
self._window = None
- def _item_button_press_event_cb(self, item, event):
+ def _button_press_event_cb(self, menu, event):
self.emit('action-completed')