Make ClipboardIcon use the new Menu.
This commit is contained in:
parent
9ba487fa1f
commit
b452b7d718
@ -1,16 +1,17 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from sugar.graphics.menuicon import MenuIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from view.clipboardmenu import ClipboardMenu
|
from view.clipboardmenu import ClipboardMenu
|
||||||
from sugar.graphics.iconcolor import IconColor
|
from sugar.graphics.iconcolor import IconColor
|
||||||
from sugar.activity import activityfactory
|
from sugar.activity import activityfactory
|
||||||
from sugar.clipboard import clipboardservice
|
from sugar.clipboard import clipboardservice
|
||||||
from sugar import util
|
from sugar import util
|
||||||
|
|
||||||
class ClipboardIcon(MenuIcon):
|
class ClipboardIcon(CanvasIcon):
|
||||||
|
|
||||||
def __init__(self, menu_shell, object_id, name):
|
def __init__(self, popup_context, object_id, name):
|
||||||
MenuIcon.__init__(self, menu_shell)
|
CanvasIcon.__init__(self)
|
||||||
|
self._popup_context = popup_context
|
||||||
self._object_id = object_id
|
self._object_id = object_id
|
||||||
self._name = name
|
self._name = name
|
||||||
self._percent = 0
|
self._percent = 0
|
||||||
@ -19,12 +20,15 @@ class ClipboardIcon(MenuIcon):
|
|||||||
self.connect('activated', self._icon_activated_cb)
|
self.connect('activated', self._icon_activated_cb)
|
||||||
self._menu = None
|
self._menu = None
|
||||||
|
|
||||||
def create_menu(self):
|
def get_popup(self):
|
||||||
self._menu = ClipboardMenu(self._name, self._percent, self._preview,
|
self._menu = ClipboardMenu(self._name, self._percent, self._preview,
|
||||||
self._activity)
|
self._activity)
|
||||||
self._menu.connect('action', self._popup_action_cb)
|
self._menu.connect('action', self._popup_action_cb)
|
||||||
return self._menu
|
return self._menu
|
||||||
|
|
||||||
|
def get_popup_context(self):
|
||||||
|
return self._popup_context
|
||||||
|
|
||||||
def set_state(self, name, percent, icon_name, preview, activity):
|
def set_state(self, name, percent, icon_name, preview, activity):
|
||||||
self._name = name
|
self._name = name
|
||||||
self._percent = percent
|
self._percent = percent
|
||||||
@ -60,8 +64,8 @@ class ClipboardIcon(MenuIcon):
|
|||||||
def _icon_activated_cb(self, icon):
|
def _icon_activated_cb(self, icon):
|
||||||
self._open_file()
|
self._open_file()
|
||||||
|
|
||||||
def _popup_action_cb(self, popup, action):
|
def _popup_action_cb(self, popup, menu_item):
|
||||||
self.popdown()
|
action = menu_item.props.action_id
|
||||||
|
|
||||||
if action == ClipboardMenu.ACTION_STOP_DOWNLOAD:
|
if action == ClipboardMenu.ACTION_STOP_DOWNLOAD:
|
||||||
raise "Stopping downloads still not implemented."
|
raise "Stopping downloads still not implemented."
|
||||||
|
@ -1,16 +1,23 @@
|
|||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
from sugar.graphics.menu import Menu
|
from sugar.graphics.menu import Menu, MenuItem
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from sugar.graphics.ClipboardBubble import ClipboardBubble
|
from sugar.graphics.ClipboardBubble import ClipboardBubble
|
||||||
|
from sugar.graphics import color
|
||||||
|
from sugar.graphics import font
|
||||||
|
|
||||||
class ClipboardMenuItem(ClipboardBubble):
|
class ClipboardProgressBar(ClipboardBubble):
|
||||||
|
|
||||||
def __init__(self, percent = 0):
|
def __init__(self, percent = 0):
|
||||||
self._text_item = None
|
self._text_item = None
|
||||||
ClipboardBubble.__init__(self, percent=percent)
|
ClipboardBubble.__init__(self, percent=percent)
|
||||||
|
|
||||||
self._text_item = hippo.CanvasText(text=str(percent) + ' %')
|
self._text_item = hippo.CanvasText(text=str(percent) + ' %')
|
||||||
|
self._text_item.props.color = color.LABEL_TEXT.get_int()
|
||||||
|
self._text_item.props.font_desc = font.DEFAULT.get_pango_desc()
|
||||||
|
|
||||||
self.append(self._text_item)
|
self.append(self._text_item)
|
||||||
|
|
||||||
def do_set_property(self, pspec, value):
|
def do_set_property(self, pspec, value):
|
||||||
@ -30,57 +37,69 @@ class ClipboardMenu(Menu):
|
|||||||
Menu.__init__(self, name)
|
Menu.__init__(self, name)
|
||||||
|
|
||||||
if percent < 100:
|
if percent < 100:
|
||||||
self._progress_bar = ClipboardMenuItem(percent)
|
self._progress_bar = ClipboardProgressBar(percent)
|
||||||
self._root.append(self._progress_bar)
|
self.append(self._progress_bar)
|
||||||
else:
|
else:
|
||||||
self._progress_bar = None
|
self._progress_bar = None
|
||||||
|
|
||||||
self._remove_icon = None
|
self._remove_item = None
|
||||||
self._open_icon = None
|
self._open_item = None
|
||||||
self._stop_icon = None
|
self._stop_item = None
|
||||||
|
|
||||||
self.add_item(preview, wrap=True)
|
if preview:
|
||||||
|
self._preview_text = hippo.CanvasText(text=preview,
|
||||||
|
size_mode=hippo.CANVAS_SIZE_WRAP_WORD)
|
||||||
|
self._preview_text.props.color = color.LABEL_TEXT.get_int()
|
||||||
|
self._preview_text.props.font_desc = font.DEFAULT.get_pango_desc()
|
||||||
|
self.append(self._preview_text)
|
||||||
|
|
||||||
self._update_icons(percent, activity)
|
self._update_icons(percent, activity)
|
||||||
|
|
||||||
def _update_icons(self, percent, activity):
|
def _update_icons(self, percent, activity):
|
||||||
|
|
||||||
if percent == 100 and activity:
|
if percent == 100 and activity:
|
||||||
if not self._remove_icon:
|
if not self._remove_item:
|
||||||
self._remove_icon = CanvasIcon(icon_name='theme:stock-remove')
|
self._remove_item = MenuItem(ClipboardMenu.ACTION_DELETE,
|
||||||
self.add_action(self._remove_icon, ClipboardMenu.ACTION_DELETE)
|
_('Remove'),
|
||||||
|
'theme:stock-remove')
|
||||||
|
self.add_item(self._remove_item)
|
||||||
|
|
||||||
if not self._open_icon:
|
if not self._open_item:
|
||||||
self._open_icon = CanvasIcon(icon_name='theme:stock-keep')
|
self._open_item = MenuItem(ClipboardMenu.ACTION_OPEN,
|
||||||
self.add_action(self._open_icon, ClipboardMenu.ACTION_OPEN)
|
_('Open'),
|
||||||
|
'theme:stock-keep')
|
||||||
|
self.add_item(self._open_item)
|
||||||
|
|
||||||
if self._stop_icon:
|
if self._stop_item:
|
||||||
self.remove_action(self._stop_icon)
|
self.remove_item(self._stop_item)
|
||||||
self._stop_icon = None
|
self._stop_item = None
|
||||||
elif percent == 100 and not activity:
|
elif percent == 100 and not activity:
|
||||||
if not self._remove_icon:
|
if not self._remove_item:
|
||||||
self._remove_icon = CanvasIcon(icon_name='theme:stock-remove')
|
self._remove_item = MenuItem(ClipboardMenu.ACTION_DELETE,
|
||||||
self.add_action(self._remove_icon, ClipboardMenu.ACTION_DELETE)
|
_('Remove'),
|
||||||
|
'theme:stock-remove')
|
||||||
|
self.add_item(self._remove_item)
|
||||||
|
|
||||||
if self._open_icon:
|
if self._open_item:
|
||||||
self.remove_action(self._open_icon)
|
self.remove_item(self._open_item)
|
||||||
self._open_icon = None
|
self._open_item = None
|
||||||
|
|
||||||
if self._stop_icon:
|
if self._stop_item:
|
||||||
self.remove_action(self._stop_icon)
|
self.remove_item(self._stop_item)
|
||||||
self._stop_icon = None
|
self._stop_item = None
|
||||||
else:
|
else:
|
||||||
if not self._stop_icon:
|
if not self._stop_item:
|
||||||
self._stop_icon = CanvasIcon(icon_name='theme:stock-close')
|
self._stop_item = MenuItem(ClipboardMenu.ACTION_STOP_DOWNLOAD,
|
||||||
self.add_action(self._stop_icon, ClipboardMenu.ACTION_STOP_DOWNLOAD)
|
_('Stop download'),
|
||||||
|
'theme:stock-close')
|
||||||
|
self.add_item(self._stop_item)
|
||||||
|
|
||||||
if self._remove_icon:
|
if self._remove_item:
|
||||||
self.remove_action(self._remove_icon)
|
self.remove_item(self._remove_item)
|
||||||
self._remove_icon = None
|
self._remove_item = None
|
||||||
|
|
||||||
if self._open_icon:
|
if self._open_item:
|
||||||
self.remove_action(self._open_icon)
|
self.remove_item(self._open_item)
|
||||||
self._open_icon = None
|
self._open_item = None
|
||||||
|
|
||||||
def set_state(self, name, percent, preview, activity):
|
def set_state(self, name, percent, preview, activity):
|
||||||
self.set_title(name)
|
self.set_title(name)
|
||||||
|
@ -10,4 +10,5 @@ sugar_PYTHON = \
|
|||||||
ZoomBox.py \
|
ZoomBox.py \
|
||||||
notificationtray.py \
|
notificationtray.py \
|
||||||
overlaybox.py \
|
overlaybox.py \
|
||||||
PanelWindow.py
|
PanelWindow.py \
|
||||||
|
framepopupcontext.py
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
import gtk
|
import gtk
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
from sugar.graphics.menushell import MenuShell
|
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
|
|
||||||
class PanelWindow(gtk.Window):
|
class PanelWindow(gtk.Window):
|
||||||
@ -51,13 +50,8 @@ class PanelWindow(gtk.Window):
|
|||||||
self.add(self._canvas)
|
self.add(self._canvas)
|
||||||
self._canvas.show()
|
self._canvas.show()
|
||||||
|
|
||||||
self._menu_shell = MenuShell(self._canvas)
|
|
||||||
|
|
||||||
self.resize(width, height)
|
self.resize(width, height)
|
||||||
|
|
||||||
def get_menu_shell(self):
|
|
||||||
return self._menu_shell
|
|
||||||
|
|
||||||
def get_root(self):
|
def get_root(self):
|
||||||
return self._bg
|
return self._bg
|
||||||
|
|
||||||
|
@ -42,9 +42,10 @@ class ActivityMenu(Menu):
|
|||||||
'theme:stock-close'))
|
'theme:stock-close'))
|
||||||
|
|
||||||
class ActivityButton(IconButton):
|
class ActivityButton(IconButton):
|
||||||
def __init__(self, shell, activity_model):
|
def __init__(self, shell, activity_model, popup_context):
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
self._activity_model = activity_model
|
self._activity_model = activity_model
|
||||||
|
self._popup_context = popup_context
|
||||||
|
|
||||||
icon_name = self._activity_model.get_icon_name()
|
icon_name = self._activity_model.get_icon_name()
|
||||||
icon_color = self._activity_model.get_icon_color()
|
icon_color = self._activity_model.get_icon_color()
|
||||||
@ -57,7 +58,7 @@ class ActivityButton(IconButton):
|
|||||||
return menu
|
return menu
|
||||||
|
|
||||||
def get_popup_context(self):
|
def get_popup_context(self):
|
||||||
return self._shell.get_popup_context()
|
return self._popup_context
|
||||||
|
|
||||||
def _action_cb(self, menu, menu_item):
|
def _action_cb(self, menu, menu_item):
|
||||||
# TODO: Wouldn't be better to share/close the activity associated with
|
# TODO: Wouldn't be better to share/close the activity associated with
|
||||||
@ -73,11 +74,11 @@ class ActivityButton(IconButton):
|
|||||||
activity.close()
|
activity.close()
|
||||||
|
|
||||||
class ZoomBox(hippo.CanvasBox):
|
class ZoomBox(hippo.CanvasBox):
|
||||||
def __init__(self, shell, menu_shell):
|
def __init__(self, shell, popup_context):
|
||||||
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
|
hippo.CanvasBox.__init__(self, orientation=hippo.ORIENTATION_HORIZONTAL)
|
||||||
|
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
self._menu_shell = menu_shell
|
self._popup_context = popup_context
|
||||||
self._activity_icon = None
|
self._activity_icon = None
|
||||||
|
|
||||||
icon = IconButton(icon_name='theme:stock-zoom-mesh')
|
icon = IconButton(icon_name='theme:stock-zoom-mesh')
|
||||||
@ -106,7 +107,7 @@ class ZoomBox(hippo.CanvasBox):
|
|||||||
self.remove(self._activity_icon)
|
self.remove(self._activity_icon)
|
||||||
|
|
||||||
if home_activity:
|
if home_activity:
|
||||||
icon = ActivityButton(self._shell, home_activity)
|
icon = ActivityButton(self._shell, home_activity, self._popup_context)
|
||||||
self.append(icon)
|
self.append(icon)
|
||||||
self._activity_icon = icon
|
self._activity_icon = icon
|
||||||
else:
|
else:
|
||||||
|
@ -37,9 +37,9 @@ class _ContextMap:
|
|||||||
|
|
||||||
class ClipboardBox(hippo.CanvasBox):
|
class ClipboardBox(hippo.CanvasBox):
|
||||||
|
|
||||||
def __init__(self, menu_shell):
|
def __init__(self, popup_context):
|
||||||
hippo.CanvasBox.__init__(self)
|
hippo.CanvasBox.__init__(self)
|
||||||
self._menu_shell = menu_shell
|
self._popup_context = popup_context
|
||||||
self._icons = {}
|
self._icons = {}
|
||||||
self._context_map = _ContextMap()
|
self._context_map = _ContextMap()
|
||||||
|
|
||||||
@ -74,7 +74,7 @@ class ClipboardBox(hippo.CanvasBox):
|
|||||||
on_disk = False)
|
on_disk = False)
|
||||||
|
|
||||||
def _object_added_cb(self, cb_service, object_id, name):
|
def _object_added_cb(self, cb_service, object_id, name):
|
||||||
icon = ClipboardIcon(self._menu_shell, object_id, name)
|
icon = ClipboardIcon(self._popup_context, object_id, name)
|
||||||
self.append(icon)
|
self.append(icon)
|
||||||
self._icons[object_id] = icon
|
self._icons[object_id] = icon
|
||||||
|
|
||||||
|
@ -17,10 +17,9 @@ class ClipboardPanelWindow(PanelWindow):
|
|||||||
clipboard = gtk.Clipboard()
|
clipboard = gtk.Clipboard()
|
||||||
clipboard.connect("owner-change", self._owner_change_cb)
|
clipboard.connect("owner-change", self._owner_change_cb)
|
||||||
|
|
||||||
menu_shell = self.get_menu_shell()
|
|
||||||
root = self.get_root()
|
root = self.get_root()
|
||||||
|
|
||||||
box = ClipboardBox(menu_shell)
|
box = ClipboardBox(frame.get_popup_context())
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
# Receiving dnd drops
|
# Receiving dnd drops
|
||||||
|
@ -27,9 +27,9 @@ from view.frame.FriendsBox import FriendsBox
|
|||||||
from view.frame.PanelWindow import PanelWindow
|
from view.frame.PanelWindow import PanelWindow
|
||||||
from view.frame.clipboardpanelwindow import ClipboardPanelWindow
|
from view.frame.clipboardpanelwindow import ClipboardPanelWindow
|
||||||
from view.frame.notificationtray import NotificationTray
|
from view.frame.notificationtray import NotificationTray
|
||||||
|
from view.frame.framepopupcontext import FramePopupContext
|
||||||
from model.ShellModel import ShellModel
|
from model.ShellModel import ShellModel
|
||||||
from sugar.graphics.timeline import Timeline
|
from sugar.graphics.timeline import Timeline
|
||||||
from sugar.graphics.menushell import MenuShell
|
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
|
|
||||||
_ANIMATION = False
|
_ANIMATION = False
|
||||||
@ -62,6 +62,12 @@ class Frame:
|
|||||||
self._event_frame.connect('leave', self._event_frame_leave_cb)
|
self._event_frame.connect('leave', self._event_frame_leave_cb)
|
||||||
self._event_frame.show()
|
self._event_frame.show()
|
||||||
|
|
||||||
|
self._popup_context = FramePopupContext()
|
||||||
|
self._popup_context.connect('activated',
|
||||||
|
self._popup_context_activated_cb)
|
||||||
|
self._popup_context.connect('deactivated',
|
||||||
|
self._popup_context_deactivated_cb)
|
||||||
|
|
||||||
self._top_panel = self._create_top_panel()
|
self._top_panel = self._create_top_panel()
|
||||||
self._bottom_panel = self._create_bottom_panel()
|
self._bottom_panel = self._create_bottom_panel()
|
||||||
self._left_panel = self._create_left_panel()
|
self._left_panel = self._create_left_panel()
|
||||||
@ -70,20 +76,11 @@ class Frame:
|
|||||||
shell.get_model().connect('notify::state',
|
shell.get_model().connect('notify::state',
|
||||||
self._shell_state_changed_cb)
|
self._shell_state_changed_cb)
|
||||||
|
|
||||||
popup_context = shell.get_popup_context()
|
|
||||||
popup_context.connect('activated',
|
|
||||||
self._popup_context_activated_cb)
|
|
||||||
popup_context.connect('deactivated',
|
|
||||||
self._popup_context_deactivated_cb)
|
|
||||||
|
|
||||||
def _create_top_panel(self):
|
def _create_top_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
||||||
menu_shell = panel.get_menu_shell()
|
|
||||||
root = panel.get_root()
|
root = panel.get_root()
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.BOTTOM)
|
box = ZoomBox(self._shell, self._popup_context)
|
||||||
|
|
||||||
box = ZoomBox(self._shell, menu_shell)
|
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
tray = NotificationTray()
|
tray = NotificationTray()
|
||||||
@ -103,11 +100,8 @@ class Frame:
|
|||||||
|
|
||||||
def _create_bottom_panel(self):
|
def _create_bottom_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
panel = self._create_panel(hippo.ORIENTATION_HORIZONTAL)
|
||||||
menu_shell = panel.get_menu_shell()
|
|
||||||
root = panel.get_root()
|
root = panel.get_root()
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.TOP)
|
|
||||||
|
|
||||||
box = ActivitiesBox(self._shell)
|
box = ActivitiesBox(self._shell)
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
@ -115,12 +109,9 @@ class Frame:
|
|||||||
|
|
||||||
def _create_right_panel(self):
|
def _create_right_panel(self):
|
||||||
panel = self._create_panel(hippo.ORIENTATION_VERTICAL)
|
panel = self._create_panel(hippo.ORIENTATION_VERTICAL)
|
||||||
menu_shell = panel.get_menu_shell()
|
|
||||||
root = panel.get_root()
|
root = panel.get_root()
|
||||||
|
|
||||||
menu_shell.set_position(MenuShell.LEFT)
|
box = FriendsBox(self._shell, self._popup_context)
|
||||||
|
|
||||||
box = FriendsBox(self._shell, menu_shell)
|
|
||||||
root.append(box)
|
root.append(box)
|
||||||
|
|
||||||
return panel
|
return panel
|
||||||
@ -158,19 +149,6 @@ class Frame:
|
|||||||
panel.connect('enter-notify-event', self._enter_notify_cb)
|
panel.connect('enter-notify-event', self._enter_notify_cb)
|
||||||
panel.connect('leave-notify-event', self._leave_notify_cb)
|
panel.connect('leave-notify-event', self._leave_notify_cb)
|
||||||
|
|
||||||
menu_shell = panel.get_menu_shell()
|
|
||||||
menu_shell.connect('activated',
|
|
||||||
self._menu_shell_activated_cb)
|
|
||||||
menu_shell.connect('deactivated',
|
|
||||||
self._menu_shell_deactivated_cb)
|
|
||||||
|
|
||||||
def _menu_shell_activated_cb(self, menu_shell):
|
|
||||||
self._timeline.goto('slide_in', True)
|
|
||||||
|
|
||||||
def _menu_shell_deactivated_cb(self, menu_shell):
|
|
||||||
if self._mode != Frame.STICKY and not self._hover_frame:
|
|
||||||
self._timeline.play('before_slide_out', 'slide_out')
|
|
||||||
|
|
||||||
def _popup_context_activated_cb(self, popup_context):
|
def _popup_context_activated_cb(self, popup_context):
|
||||||
self._timeline.goto('slide_in', True)
|
self._timeline.goto('slide_in', True)
|
||||||
|
|
||||||
@ -205,8 +183,7 @@ class Frame:
|
|||||||
|
|
||||||
def _leave_notify(self, panel):
|
def _leave_notify(self, panel):
|
||||||
self._hover_frame = False
|
self._hover_frame = False
|
||||||
if not panel.get_menu_shell().is_active() and \
|
if not self._popup_context.is_active() and \
|
||||||
not self._shell.get_popup_context().is_active() and \
|
|
||||||
(self._mode == Frame.HIDE_ON_LEAVE or \
|
(self._mode == Frame.HIDE_ON_LEAVE or \
|
||||||
self._mode == Frame.AUTOMATIC):
|
self._mode == Frame.AUTOMATIC):
|
||||||
self._timeline.play('before_slide_out', 'slide_out')
|
self._timeline.play('before_slide_out', 'slide_out')
|
||||||
@ -281,3 +258,6 @@ class Frame:
|
|||||||
|
|
||||||
def is_visible(self):
|
def is_visible(self):
|
||||||
return self._top_panel.props.visible
|
return self._top_panel.props.visible
|
||||||
|
|
||||||
|
def get_popup_context(self):
|
||||||
|
return self._popup_context
|
||||||
|
26
shell/view/frame/framepopupcontext.py
Normal file
26
shell/view/frame/framepopupcontext.py
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) 2007, One Laptop Per Child
|
||||||
|
#
|
||||||
|
# This library is free software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU Lesser General Public
|
||||||
|
# License as published by the Free Software Foundation; either
|
||||||
|
# version 2 of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This library is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
# Lesser General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU Lesser General Public
|
||||||
|
# License along with this library; if not, write to the
|
||||||
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
# Boston, MA 02111-1307, USA.
|
||||||
|
import gobject
|
||||||
|
import hippo
|
||||||
|
|
||||||
|
from sugar.graphics.popupcontext import PopupContext
|
||||||
|
|
||||||
|
class FramePopupContext(PopupContext):
|
||||||
|
__gtype_name__ = 'SugarFramePopupContext'
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
PopupContext.__init__(self)
|
@ -98,6 +98,9 @@ class Menu(Popup):
|
|||||||
item.connect('button-press-event', self._item_button_press_event_cb)
|
item.connect('button-press-event', self._item_button_press_event_cb)
|
||||||
self.append(item)
|
self.append(item)
|
||||||
|
|
||||||
|
def remove_item(self, item):
|
||||||
|
self.remove(item)
|
||||||
|
|
||||||
def add_separator(self):
|
def add_separator(self):
|
||||||
box = hippo.CanvasBox()
|
box = hippo.CanvasBox()
|
||||||
box.props.background_color = color.MENU_SEPARATOR.get_int()
|
box.props.background_color = color.MENU_SEPARATOR.get_int()
|
||||||
|
Loading…
Reference in New Issue
Block a user