Add/use a frame widget invoker.
This commit is contained in:
parent
c21e2b56e4
commit
722b9d01e7
@ -18,13 +18,14 @@
|
|||||||
import gtk
|
import gtk
|
||||||
import os
|
import os
|
||||||
import gobject
|
import gobject
|
||||||
|
from gettext import gettext as _
|
||||||
|
|
||||||
from sugar.graphics.palette import Palette
|
from sugar.graphics.palette import Palette
|
||||||
from sugar.graphics.tray import TrayButton
|
from sugar.graphics.tray import TrayButton
|
||||||
from sugar.graphics.icon import Icon
|
from sugar.graphics.icon import Icon
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
|
|
||||||
from gettext import gettext as _
|
from view.frame.frameinvoker import FrameWidgetInvoker
|
||||||
|
|
||||||
class ActivityButton(TrayButton, gobject.GObject):
|
class ActivityButton(TrayButton, gobject.GObject):
|
||||||
__gtype_name__ = 'SugarActivityButton'
|
__gtype_name__ = 'SugarActivityButton'
|
||||||
@ -50,6 +51,7 @@ class ActivityButton(TrayButton, gobject.GObject):
|
|||||||
def setup_rollover_options(self):
|
def setup_rollover_options(self):
|
||||||
palette = Palette(self._activity_info.name)
|
palette = Palette(self._activity_info.name)
|
||||||
self.set_palette(palette)
|
self.set_palette(palette)
|
||||||
|
palette.props.invoker = FrameWidgetInvoker(self)
|
||||||
|
|
||||||
menu_item = gtk.MenuItem(_('Remove'))
|
menu_item = gtk.MenuItem(_('Remove'))
|
||||||
menu_item.connect('activate', self.item_remove_cb)
|
menu_item.connect('activate', self.item_remove_cb)
|
||||||
|
@ -20,6 +20,26 @@ import gtk
|
|||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
from sugar.graphics.palette import Palette
|
from sugar.graphics.palette import Palette
|
||||||
from sugar.graphics.palette import CanvasInvoker
|
from sugar.graphics.palette import CanvasInvoker
|
||||||
|
from sugar.graphics.palette import WidgetInvoker
|
||||||
|
|
||||||
|
def _get_screen_area():
|
||||||
|
frame_thickness = style.GRID_CELL_SIZE
|
||||||
|
|
||||||
|
x = y = frame_thickness
|
||||||
|
width = gtk.gdk.screen_width() - frame_thickness
|
||||||
|
height = gtk.gdk.screen_height() - frame_thickness
|
||||||
|
|
||||||
|
return gtk.gdk.Rectangle(x, y, width, height)
|
||||||
|
|
||||||
|
class FrameWidgetInvoker(WidgetInvoker):
|
||||||
|
def __init__(self, widget):
|
||||||
|
WidgetInvoker.__init__(self, widget)
|
||||||
|
|
||||||
|
def get_default_position(self):
|
||||||
|
return Palette.AROUND
|
||||||
|
|
||||||
|
def get_screen_area(self):
|
||||||
|
return _get_screen_area()
|
||||||
|
|
||||||
class FrameCanvasInvoker(CanvasInvoker):
|
class FrameCanvasInvoker(CanvasInvoker):
|
||||||
def __init__(self, item):
|
def __init__(self, item):
|
||||||
@ -29,10 +49,4 @@ class FrameCanvasInvoker(CanvasInvoker):
|
|||||||
return Palette.AROUND
|
return Palette.AROUND
|
||||||
|
|
||||||
def get_screen_area(self):
|
def get_screen_area(self):
|
||||||
frame_thickness = style.GRID_CELL_SIZE
|
return _get_screen_area()
|
||||||
|
|
||||||
x = y = frame_thickness
|
|
||||||
width = gtk.gdk.screen_width() - frame_thickness
|
|
||||||
height = gtk.gdk.screen_height() - frame_thickness
|
|
||||||
|
|
||||||
return gtk.gdk.Rectangle(x, y, width, height)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user