Completely drop stylesheets. Move some of it inside the nm service, don't want to touch that code because it will be rewritten.
This commit is contained in:
@@ -19,8 +19,6 @@ sugar_PYTHON = \
|
||||
roundbox.py \
|
||||
snowflakebox.py \
|
||||
spreadbox.py \
|
||||
style.py \
|
||||
stylesheet.py \
|
||||
timeline.py \
|
||||
toolbar.py \
|
||||
units.py
|
||||
|
||||
@@ -20,7 +20,6 @@ import hippo
|
||||
import gobject
|
||||
|
||||
from sugar.graphics.canvasicon import CanvasIcon
|
||||
from sugar.graphics import style
|
||||
|
||||
class Menu(gtk.Window):
|
||||
__gsignals__ = {
|
||||
@@ -36,12 +35,10 @@ class Menu(gtk.Window):
|
||||
canvas.show()
|
||||
|
||||
self._root = hippo.CanvasBox()
|
||||
style.apply_stylesheet(self._root, 'menu')
|
||||
canvas.set_root(self._root)
|
||||
|
||||
if title:
|
||||
self._title_item = hippo.CanvasText(text=title)
|
||||
style.apply_stylesheet(self._title_item, 'menu.Title')
|
||||
self._root.append(self._title_item)
|
||||
else:
|
||||
self._title_item = None
|
||||
@@ -56,7 +53,6 @@ class Menu(gtk.Window):
|
||||
|
||||
def _create_separator(self):
|
||||
separator = hippo.CanvasBox()
|
||||
style.apply_stylesheet(separator, 'menu.Separator')
|
||||
return separator
|
||||
|
||||
def _create_item_box(self):
|
||||
@@ -81,7 +77,6 @@ class Menu(gtk.Window):
|
||||
self._create_item_box()
|
||||
|
||||
text = hippo.CanvasText(text=label)
|
||||
style.apply_stylesheet(text, 'menu.Item')
|
||||
if wrap:
|
||||
text.set_property("size-mode", "wrap-word")
|
||||
|
||||
@@ -96,7 +91,6 @@ class Menu(gtk.Window):
|
||||
if not self._action_box:
|
||||
self._create_action_box()
|
||||
|
||||
style.apply_stylesheet(icon, 'menu.ActionIcon')
|
||||
icon.connect('activated', self._action_clicked_cb, action_id)
|
||||
self._action_box.append(icon)
|
||||
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
# Copyright (C) 2006, Red Hat, Inc.
|
||||
#
|
||||
# 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 logging
|
||||
|
||||
import gtk
|
||||
|
||||
### Deprecated: we should drop this once we removed stylesheets ###
|
||||
|
||||
_styles = {}
|
||||
|
||||
screen_factor = gtk.gdk.screen_width() / 1200.0
|
||||
|
||||
space_unit = 9 * screen_factor
|
||||
separator_thickness = 3 * screen_factor
|
||||
|
||||
standard_icon_scale = 1.0 * screen_factor
|
||||
small_icon_scale = 0.5 * screen_factor
|
||||
medium_icon_scale = 1.5 * screen_factor
|
||||
large_icon_scale = 2.0 * screen_factor
|
||||
xlarge_icon_scale = 3.0 * screen_factor
|
||||
|
||||
default_font_size = 9.0 * screen_factor
|
||||
|
||||
def load_stylesheet(module):
|
||||
for objname in dir(module):
|
||||
if not objname.startswith('_'):
|
||||
obj = getattr(module, objname)
|
||||
if isinstance(obj, dict):
|
||||
register_stylesheet(objname.replace('_', '.'), obj)
|
||||
|
||||
def register_stylesheet(name, style):
|
||||
_styles[name] = style
|
||||
|
||||
def apply_stylesheet(item, stylesheet_name):
|
||||
if _styles.has_key(stylesheet_name):
|
||||
style_sheet = _styles[stylesheet_name]
|
||||
for name in style_sheet.keys():
|
||||
item.set_property(name, style_sheet[name])
|
||||
else:
|
||||
logging.debug('Stylesheet %s not found.' % stylesheet_name)
|
||||
|
||||
def get_font_description(style, relative_size):
|
||||
base_size = 18 * screen_factor
|
||||
return '%s %dpx' % (style, int(base_size * relative_size))
|
||||
@@ -1,31 +0,0 @@
|
||||
from sugar.graphics import style
|
||||
|
||||
menu = {
|
||||
'background_color' : 0x000000FF,
|
||||
'spacing' : style.space_unit,
|
||||
'padding' : style.space_unit
|
||||
}
|
||||
|
||||
menu_Title = {
|
||||
'color' : 0xFFFFFFFF,
|
||||
'font' : style.get_font_description('Bold', 1.2)
|
||||
}
|
||||
|
||||
menu_Separator = {
|
||||
'background_color' : 0xFFFFFFFF,
|
||||
'box_height' : style.separator_thickness
|
||||
}
|
||||
|
||||
menu_ActionIcon = {
|
||||
'scale' : style.standard_icon_scale
|
||||
}
|
||||
|
||||
menu_Item = {
|
||||
'color' : 0xFFFFFFFF,
|
||||
'font' : style.get_font_description('Plain', 1.1)
|
||||
}
|
||||
|
||||
menu_Text = {
|
||||
'color' : 0xFFFFFFFF,
|
||||
'font' : style.get_font_description('Plain', 1.2)
|
||||
}
|
||||
Reference in New Issue
Block a user