Implement menu color scheme and fixup colors
This commit is contained in:
parent
465253d95e
commit
edba3e0082
@ -1,4 +1,5 @@
|
||||
from sugar.canvas.Menu import Menu
|
||||
from sugar.canvas.Menu import MenuColorScheme
|
||||
from sugar.canvas.IconItem import IconItem
|
||||
from sugar.presence import PresenceService
|
||||
|
||||
@ -9,8 +10,14 @@ class BuddyMenu(Menu):
|
||||
|
||||
def __init__(self, shell, buddy):
|
||||
color = buddy.get_color()
|
||||
Menu.__init__(self, shell.get_grid(), buddy.get_name(),
|
||||
color.get_fill_color(), color.get_stroke_color())
|
||||
|
||||
color_scheme = MenuColorScheme()
|
||||
color_scheme.text = 'black'
|
||||
color_scheme.border = color.get_stroke_color()
|
||||
color_scheme.background = color.get_fill_color()
|
||||
color_scheme.separator = 'black'
|
||||
|
||||
Menu.__init__(self, shell.get_grid(), buddy.get_name(), color_scheme)
|
||||
|
||||
self._buddy = buddy
|
||||
self._shell = shell
|
||||
|
@ -11,7 +11,7 @@ class ActivityMenu(Menu):
|
||||
|
||||
def __init__(self, grid, activity_host):
|
||||
title = activity_host.get_title()
|
||||
Menu.__init__(self, grid, title, 'black', 'black')
|
||||
Menu.__init__(self, grid, title)
|
||||
|
||||
icon = IconItem(icon_name='stock-share')
|
||||
self.add_action(icon, ActivityMenu.ACTION_SHARE)
|
||||
|
@ -6,18 +6,26 @@ from sugar.canvas.CanvasView import CanvasView
|
||||
from sugar.canvas.CanvasBox import CanvasBox
|
||||
from sugar.canvas.IconItem import IconItem
|
||||
|
||||
class MenuColorScheme:
|
||||
def __init__(self):
|
||||
self.text = 'white'
|
||||
self.background = 'black'
|
||||
self.border = 'black'
|
||||
self.separator = '#a1a1a1'
|
||||
|
||||
class Menu(gtk.Window):
|
||||
__gsignals__ = {
|
||||
'action': (gobject.SIGNAL_RUN_FIRST,
|
||||
gobject.TYPE_NONE, ([int])),
|
||||
}
|
||||
|
||||
def __init__(self, grid, title, fill, stroke):
|
||||
def __init__(self, grid, title, color_scheme=MenuColorScheme()):
|
||||
gtk.Window.__init__(self, gtk.WINDOW_POPUP)
|
||||
|
||||
self._width = 13
|
||||
self._grid = grid
|
||||
self._action_box = None
|
||||
self._color_scheme = color_scheme
|
||||
|
||||
self._canvas = CanvasView()
|
||||
self.add(self._canvas)
|
||||
@ -26,12 +34,14 @@ class Menu(gtk.Window):
|
||||
model = goocanvas.CanvasModelSimple()
|
||||
self._root = model.get_root_item()
|
||||
|
||||
self._rect = goocanvas.Rect(fill_color=fill,stroke_color=stroke,
|
||||
self._rect = goocanvas.Rect(fill_color=color_scheme.background,
|
||||
stroke_color=color_scheme.border,
|
||||
line_width=3)
|
||||
self._root.add_child(self._rect)
|
||||
|
||||
text = goocanvas.Text(text=title, font="Sans bold 18",
|
||||
fill_color='black', anchor=gtk.ANCHOR_SW)
|
||||
fill_color=color_scheme.text,
|
||||
anchor=gtk.ANCHOR_SW)
|
||||
self._grid.set_constraints(text, 1, 3, self._width, 2)
|
||||
self._root.add_child(text)
|
||||
|
||||
@ -42,7 +52,7 @@ class Menu(gtk.Window):
|
||||
|
||||
def _create_action_box(self):
|
||||
separator = goocanvas.Path(data='M 15 0 L 185 0', line_width=3,
|
||||
fill_color='black')
|
||||
stroke_color=self._color_scheme.separator)
|
||||
self._grid.set_constraints(separator, 0, 4)
|
||||
self._root.add_child(separator)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user