Remove obsolete sugar.graphics.color.
This commit is contained in:
parent
1845435e8c
commit
cca69e7012
@ -24,7 +24,6 @@ from sugar.graphics.canvasicon import CanvasIcon
|
|||||||
from view.clipboardmenu import ClipboardMenu
|
from view.clipboardmenu import ClipboardMenu
|
||||||
from sugar.graphics.xocolor import XoColor
|
from sugar.graphics.xocolor import XoColor
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.clipboard import clipboardservice
|
from sugar.clipboard import clipboardservice
|
||||||
from sugar import util
|
from sugar import util
|
||||||
from sugar import profile
|
from sugar import profile
|
||||||
@ -76,9 +75,9 @@ class ClipboardIcon(CanvasIcon):
|
|||||||
self._selected = selected
|
self._selected = selected
|
||||||
if selected:
|
if selected:
|
||||||
if not self._hover:
|
if not self._hover:
|
||||||
self.props.background_color = color.DESKTOP_BACKGROUND.get_int()
|
self.props.background_color = style.COLOR_PANEL_GREY.get_int()
|
||||||
else:
|
else:
|
||||||
self.props.background_color = color.TOOLBAR_BACKGROUND.get_int()
|
self.props.background_color = style.COLOR_TOOLBAR_GREY.get_int()
|
||||||
|
|
||||||
def set_state(self, name, percent, icon_name, preview, activity):
|
def set_state(self, name, percent, icon_name, preview, activity):
|
||||||
cb_service = clipboardservice.get_instance()
|
cb_service = clipboardservice.get_instance()
|
||||||
|
@ -25,7 +25,6 @@ import hippo
|
|||||||
|
|
||||||
from sugar.graphics.palette import Palette
|
from sugar.graphics.palette import Palette
|
||||||
from sugar.graphics.menuitem import MenuItem
|
from sugar.graphics.menuitem import MenuItem
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
from sugar.clipboard import clipboardservice
|
from sugar.clipboard import clipboardservice
|
||||||
from sugar.datastore import datastore
|
from sugar.datastore import datastore
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
from sugar.graphics import canvasicon
|
from sugar.graphics import canvasicon
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from model.devices import device
|
from model.devices import device
|
||||||
|
|
||||||
@ -36,11 +36,11 @@ class DeviceView(canvasicon.CanvasIcon):
|
|||||||
# FIXME Change icon colors once we have real icons
|
# FIXME Change icon colors once we have real icons
|
||||||
state = self._model.props.state
|
state = self._model.props.state
|
||||||
if state == device.STATE_ACTIVATING:
|
if state == device.STATE_ACTIVATING:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||||
elif state == device.STATE_ACTIVATED:
|
elif state == device.STATE_ACTIVATED:
|
||||||
self.props.fill_color = None
|
self.props.fill_color = None
|
||||||
self.props.stroke_color = None
|
self.props.stroke_color = None
|
||||||
elif state == device.STATE_INACTIVE:
|
elif state == device.STATE_INACTIVE:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
from sugar.graphics import canvasicon
|
from sugar.graphics import canvasicon
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from model.devices.network import wireless
|
from model.devices.network import wireless
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
@ -56,11 +56,11 @@ class DeviceView(CanvasIcon):
|
|||||||
# FIXME Change icon colors once we have real icons
|
# FIXME Change icon colors once we have real icons
|
||||||
state = self._model.props.state
|
state = self._model.props.state
|
||||||
if state == device.STATE_ACTIVATING:
|
if state == device.STATE_ACTIVATING:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||||
elif state == device.STATE_ACTIVATED:
|
elif state == device.STATE_ACTIVATED:
|
||||||
self.props.fill_color = None
|
self.props.fill_color = None
|
||||||
self.props.stroke_color = None
|
self.props.stroke_color = None
|
||||||
elif state == device.STATE_INACTIVE:
|
elif state == device.STATE_INACTIVE:
|
||||||
self.props.fill_color = color.ICON_FILL_INACTIVE
|
self.props.fill_color = style.COLOR_INACTIVE_FILL
|
||||||
self.props.stroke_color = color.ICON_STROKE_INACTIVE
|
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
from sugar.presence import presenceservice
|
from sugar.presence import presenceservice
|
||||||
from view.BuddyIcon import BuddyIcon
|
from view.BuddyIcon import BuddyIcon
|
||||||
from model.BuddyModel import BuddyModel
|
from model.BuddyModel import BuddyModel
|
||||||
@ -29,9 +29,9 @@ class FriendIcon(BuddyIcon):
|
|||||||
|
|
||||||
def prelight(self, enter):
|
def prelight(self, enter):
|
||||||
if enter:
|
if enter:
|
||||||
self.props.background_color = color.BLACK.get_int()
|
self.props.background_color = style.COLOR_BLACK.get_int()
|
||||||
else:
|
else:
|
||||||
self.props.background_color = color.TOOLBAR_BACKGROUND.get_int()
|
self.props.background_color = style.COLOR_TOOLBAR.GREY.get_int()
|
||||||
|
|
||||||
class FriendsBox(hippo.CanvasBox):
|
class FriendsBox(hippo.CanvasBox):
|
||||||
def __init__(self, shell):
|
def __init__(self, shell):
|
||||||
|
@ -18,7 +18,6 @@ from gettext import gettext as _
|
|||||||
|
|
||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.graphics.palette import Palette
|
from sugar.graphics.palette import Palette
|
||||||
from sugar.graphics.iconbutton import IconButton
|
from sugar.graphics.iconbutton import IconButton
|
||||||
from frameinvoker import FrameCanvasInvoker
|
from frameinvoker import FrameCanvasInvoker
|
||||||
@ -31,9 +30,7 @@ class ZoomBox(hippo.CanvasBox):
|
|||||||
|
|
||||||
self._shell = shell
|
self._shell = shell
|
||||||
|
|
||||||
icon = IconButton(icon_name='theme:zoom-mesh',
|
icon = IconButton(icon_name='theme:zoom-mesh')
|
||||||
stroke_color=color.BLACK,
|
|
||||||
fill_color=color.WHITE)
|
|
||||||
icon.connect('activated',
|
icon.connect('activated',
|
||||||
self._level_clicked_cb,
|
self._level_clicked_cb,
|
||||||
ShellModel.ZOOM_MESH)
|
ShellModel.ZOOM_MESH)
|
||||||
@ -44,9 +41,7 @@ class ZoomBox(hippo.CanvasBox):
|
|||||||
palette.set_group_id('frame')
|
palette.set_group_id('frame')
|
||||||
icon.set_palette(palette)
|
icon.set_palette(palette)
|
||||||
|
|
||||||
icon = IconButton(icon_name='theme:zoom-friends',
|
icon = IconButton(icon_name='theme:zoom-friends')
|
||||||
stroke_color=color.BLACK,
|
|
||||||
fill_color=color.WHITE)
|
|
||||||
icon.connect('activated',
|
icon.connect('activated',
|
||||||
self._level_clicked_cb,
|
self._level_clicked_cb,
|
||||||
ShellModel.ZOOM_FRIENDS)
|
ShellModel.ZOOM_FRIENDS)
|
||||||
@ -57,9 +52,7 @@ class ZoomBox(hippo.CanvasBox):
|
|||||||
palette.set_group_id('frame')
|
palette.set_group_id('frame')
|
||||||
icon.set_palette(palette)
|
icon.set_palette(palette)
|
||||||
|
|
||||||
icon = IconButton(icon_name='theme:zoom-home',
|
icon = IconButton(icon_name='theme:zoom-home')
|
||||||
stroke_color=color.BLACK,
|
|
||||||
fill_color=color.WHITE)
|
|
||||||
icon.connect('activated',
|
icon.connect('activated',
|
||||||
self._level_clicked_cb,
|
self._level_clicked_cb,
|
||||||
ShellModel.ZOOM_HOME)
|
ShellModel.ZOOM_HOME)
|
||||||
@ -70,9 +63,7 @@ class ZoomBox(hippo.CanvasBox):
|
|||||||
palette.set_group_id('frame')
|
palette.set_group_id('frame')
|
||||||
icon.set_palette(palette)
|
icon.set_palette(palette)
|
||||||
|
|
||||||
icon = IconButton(icon_name='theme:zoom-activity',
|
icon = IconButton(icon_name='theme:zoom-activity')
|
||||||
stroke_color=color.BLACK,
|
|
||||||
fill_color=color.WHITE)
|
|
||||||
icon.connect('activated',
|
icon.connect('activated',
|
||||||
self._level_clicked_cb,
|
self._level_clicked_cb,
|
||||||
ShellModel.ZOOM_ACTIVITY)
|
ShellModel.ZOOM_ACTIVITY)
|
||||||
|
@ -25,7 +25,6 @@ import hippo
|
|||||||
import dbus
|
import dbus
|
||||||
|
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.graphics.xocolor import XoColor
|
from sugar.graphics.xocolor import XoColor
|
||||||
from sugar.graphics.palette import Palette, CanvasInvoker
|
from sugar.graphics.palette import Palette, CanvasInvoker
|
||||||
from sugar import profile
|
from sugar import profile
|
||||||
@ -81,16 +80,9 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
self._remove_device(device)
|
self._remove_device(device)
|
||||||
|
|
||||||
def _shell_state_changed_cb(self, model, pspec):
|
def _shell_state_changed_cb(self, model, pspec):
|
||||||
# FIXME handle all possible mode switches
|
# FIXME implement this
|
||||||
if model.props.state == ShellModel.STATE_SHUTDOWN:
|
if model.props.state == ShellModel.STATE_SHUTDOWN:
|
||||||
if self._donut:
|
pass
|
||||||
self.remove(self._donut)
|
|
||||||
self._donut = None
|
|
||||||
self._my_icon.props.stroke_color = color.ICON_STROKE_INACTIVE
|
|
||||||
self._my_icon.props.fill_color = \
|
|
||||||
color.ICON_FILL_INACTIVE
|
|
||||||
self._my_icon.props.background_color = \
|
|
||||||
color.ICON_FILL_INACTIVE.get_int()
|
|
||||||
|
|
||||||
def do_allocate(self, width, height, origin_changed):
|
def do_allocate(self, width, height, origin_changed):
|
||||||
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
|
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
|
||||||
|
@ -22,7 +22,7 @@ from gettext import gettext as _
|
|||||||
|
|
||||||
from sugar.graphics.spreadlayout import SpreadLayout
|
from sugar.graphics.spreadlayout import SpreadLayout
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
from sugar.graphics import xocolor
|
from sugar.graphics import xocolor
|
||||||
from sugar.graphics import canvasicon
|
from sugar.graphics import canvasicon
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
@ -95,24 +95,24 @@ class AccessPointView(PulsingIcon):
|
|||||||
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
|
if self._model.props.state == accesspointmodel.STATE_CONNECTING:
|
||||||
self.props.pulse_time = 1.0
|
self.props.pulse_time = 1.0
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ],
|
style.Color(self._device_fill) ],
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor('#e2e2e2') ]
|
style.Color('#e2e2e2') ]
|
||||||
]
|
]
|
||||||
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
|
elif self._model.props.state == accesspointmodel.STATE_CONNECTED:
|
||||||
self.props.pulse_time = 2.0
|
self.props.pulse_time = 2.0
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ],
|
style.Color(self._device_fill) ],
|
||||||
[ color.HTMLColor('#ffffff'),
|
[ style.Color('#ffffff'),
|
||||||
color.HTMLColor(self._device_fill) ]
|
style.Color(self._device_fill) ]
|
||||||
]
|
]
|
||||||
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
|
elif self._model.props.state == accesspointmodel.STATE_NOTCONNECTED:
|
||||||
self.props.pulse_time = 0.0
|
self.props.pulse_time = 0.0
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ]
|
style.Color(self._device_fill) ]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -146,24 +146,24 @@ class MeshDeviceView(PulsingIcon):
|
|||||||
if state == nmclient.DEVICE_STATE_ACTIVATING:
|
if state == nmclient.DEVICE_STATE_ACTIVATING:
|
||||||
self.props.pulse_time = 0.75
|
self.props.pulse_time = 0.75
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ],
|
style.Color(self._device_fill) ],
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor('#e2e2e2') ]
|
style.Color('#e2e2e2') ]
|
||||||
]
|
]
|
||||||
elif state == nmclient.DEVICE_STATE_ACTIVATED:
|
elif state == nmclient.DEVICE_STATE_ACTIVATED:
|
||||||
self.props.pulse_time = 1.5
|
self.props.pulse_time = 1.5
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ],
|
style.Color(self._device_fill) ],
|
||||||
[ color.HTMLColor('#ffffff'),
|
[ style.Color('#ffffff'),
|
||||||
color.HTMLColor(self._device_fill) ]
|
style.Color(self._device_fill) ]
|
||||||
]
|
]
|
||||||
elif state == nmclient.DEVICE_STATE_INACTIVE:
|
elif state == nmclient.DEVICE_STATE_INACTIVE:
|
||||||
self.props.pulse_time = 0.0
|
self.props.pulse_time = 0.0
|
||||||
self.props.colors = [
|
self.props.colors = [
|
||||||
[ color.HTMLColor(self._device_stroke),
|
[ style.Color(self._device_stroke),
|
||||||
color.HTMLColor(self._device_fill) ]
|
style.Color(self._device_fill) ]
|
||||||
]
|
]
|
||||||
|
|
||||||
class ActivityView(hippo.CanvasBox):
|
class ActivityView(hippo.CanvasBox):
|
||||||
|
@ -7,7 +7,6 @@ sugar_PYTHON = \
|
|||||||
canvasbutton.py \
|
canvasbutton.py \
|
||||||
canvasicon.py \
|
canvasicon.py \
|
||||||
canvasentry.py \
|
canvasentry.py \
|
||||||
color.py \
|
|
||||||
combobox.py \
|
combobox.py \
|
||||||
frame.py \
|
frame.py \
|
||||||
notebook.py \
|
notebook.py \
|
||||||
|
@ -25,8 +25,8 @@ import rsvg
|
|||||||
import cairo
|
import cairo
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.graphics.xocolor import XoColor
|
from sugar.graphics.xocolor import XoColor
|
||||||
|
from sugar.graphics import style
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics.palette import Palette, CanvasInvoker
|
from sugar.graphics.palette import Palette, CanvasInvoker
|
||||||
|
|
||||||
@ -193,8 +193,8 @@ class CanvasIcon(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
self._handle = None
|
self._handle = None
|
||||||
self.emit_paint_needed(0, 0, -1, -1)
|
self.emit_paint_needed(0, 0, -1, -1)
|
||||||
elif pspec.name == 'xo-color':
|
elif pspec.name == 'xo-color':
|
||||||
self.props.fill_color = color.HTMLColor(value.get_fill_color())
|
self.props.fill_color = style.Color(value.get_fill_color())
|
||||||
self.props.stroke_color = color.HTMLColor(value.get_stroke_color())
|
self.props.stroke_color = style.Color(value.get_stroke_color())
|
||||||
elif pspec.name == 'fill-color':
|
elif pspec.name == 'fill-color':
|
||||||
if self._fill_color != value:
|
if self._fill_color != value:
|
||||||
if not self._cache:
|
if not self._cache:
|
||||||
|
@ -1,121 +0,0 @@
|
|||||||
# Copyright (C) 2006-2007, 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 gtk
|
|
||||||
|
|
||||||
_system_colors = {
|
|
||||||
'toolbar-background' : '#404040',
|
|
||||||
'frame-border' : '#D1D1D2',
|
|
||||||
'entry-background-focused' : '#FFFFFF',
|
|
||||||
'entry-background-unfocused' : '#414141',
|
|
||||||
'entry-selection-focused' : '#D1D1D2',
|
|
||||||
'entry-selection-unfocused' : '#00FF00',
|
|
||||||
'entry-text-focused' : '#000000',
|
|
||||||
'entry-text-unfocused' : '#FFFFFF',
|
|
||||||
'entry-border' : '#D1D1D2',
|
|
||||||
'label-text' : '#FFFFFF',
|
|
||||||
'desktop-background' : '#E2E2E3',
|
|
||||||
'menu-background' : '#000000',
|
|
||||||
'menu-background-hover' : '#404040',
|
|
||||||
'menu-separator' : '#D1D1D2',
|
|
||||||
'menu-border' : '#D1D1D2',
|
|
||||||
'button-normal' : '#FFFFFF',
|
|
||||||
'button-background-normal' : '#404040',
|
|
||||||
'button-hover' : '#808080',
|
|
||||||
'button-background-hover' : '#000000',
|
|
||||||
'icon-stroke-inactive' : '#757575',
|
|
||||||
'icon-fill-inactive' : '#9D9FA1',
|
|
||||||
'toggle-button-background' : '#A1A5A8'
|
|
||||||
}
|
|
||||||
|
|
||||||
def _html_to_rgb(html_color):
|
|
||||||
""" #RRGGBB -> (r, g, b) tuple (in float format) """
|
|
||||||
|
|
||||||
html_color = html_color.strip()
|
|
||||||
if html_color[0] == '#':
|
|
||||||
html_color = html_color[1:]
|
|
||||||
if len(html_color) != 6:
|
|
||||||
raise ValueError, "input #%s is not in #RRGGBB format" % html_color
|
|
||||||
|
|
||||||
r, g, b = html_color[:2], html_color[2:4], html_color[4:]
|
|
||||||
r, g, b = [int(n, 16) for n in (r, g, b)]
|
|
||||||
r, g, b = (r / 255.0, g / 255.0, b / 255.0)
|
|
||||||
|
|
||||||
return (r, g, b)
|
|
||||||
|
|
||||||
def _rgba_to_int(r, g, b, a):
|
|
||||||
color = int(a * 255) + (int(b * 255) << 8) + \
|
|
||||||
(int(g * 255) << 16) + (int(r * 255) << 24)
|
|
||||||
return color
|
|
||||||
|
|
||||||
class RGBColor(object):
|
|
||||||
def __init__(self, r, g, b, a=1.0):
|
|
||||||
self._r = r
|
|
||||||
self._g = g
|
|
||||||
self._b = b
|
|
||||||
self._a = a
|
|
||||||
|
|
||||||
def get_rgba(self):
|
|
||||||
return (self._r, self._g, self._b, self._a)
|
|
||||||
|
|
||||||
def get_int(self):
|
|
||||||
return _rgba_to_int(self._r, self._g, self._b, self._a)
|
|
||||||
|
|
||||||
def get_gdk_color(self):
|
|
||||||
return gtk.gdk.Color(int(self._r * 65535), int(self._g * 65535),
|
|
||||||
int(self._b * 65535))
|
|
||||||
|
|
||||||
def get_html(self):
|
|
||||||
return '#%02x%02x%02x' % (self._r * 255, self._g * 255, self._b * 255)
|
|
||||||
|
|
||||||
class HTMLColor(RGBColor):
|
|
||||||
def __init__(self, html_color):
|
|
||||||
rgb = _html_to_rgb(html_color)
|
|
||||||
RGBColor.__init__(self, *rgb)
|
|
||||||
|
|
||||||
class SystemColor(HTMLColor):
|
|
||||||
def __init__(self, color_id):
|
|
||||||
HTMLColor.__init__(self, _system_colors[color_id])
|
|
||||||
|
|
||||||
RED = RGBColor(1.0, 0.0, 0.0)
|
|
||||||
GREEN = RGBColor(0.0, 1.0, 0.0)
|
|
||||||
BLUE = RGBColor(0.0, 0.0, 1.0)
|
|
||||||
WHITE = RGBColor(1.0, 1.0, 1.0)
|
|
||||||
BLACK = RGBColor(0.0, 0.0, 0.0)
|
|
||||||
|
|
||||||
TOOLBAR_BACKGROUND = SystemColor('toolbar-background')
|
|
||||||
FRAME_BORDER = SystemColor('frame-border')
|
|
||||||
ENTRY_BACKGROUND_FOCUSED = SystemColor('entry-background-focused')
|
|
||||||
ENTRY_BACKGROUND_UNFOCUSED = SystemColor('entry-background-unfocused')
|
|
||||||
ENTRY_SELECTION_FOCUSED = SystemColor('entry-selection-focused')
|
|
||||||
ENTRY_SELECTION_UNFOCUSED = SystemColor('entry-selection-unfocused')
|
|
||||||
ENTRY_TEXT_FOCUSED = SystemColor('entry-text-focused')
|
|
||||||
ENTRY_TEXT_UNFOCUSED = SystemColor('entry-text-unfocused')
|
|
||||||
ENTRY_BORDER = SystemColor('entry-border')
|
|
||||||
LABEL_TEXT = SystemColor('label-text')
|
|
||||||
DESKTOP_BACKGROUND = SystemColor('desktop-background')
|
|
||||||
MENU_BACKGROUND = SystemColor('menu-background')
|
|
||||||
MENU_BACKGROUND_HOVER = SystemColor('menu-background-hover')
|
|
||||||
MENU_SEPARATOR = SystemColor('menu-separator')
|
|
||||||
MENU_BORDER = SystemColor('menu-border')
|
|
||||||
BUTTON_NORMAL = SystemColor('button-normal')
|
|
||||||
BUTTON_BACKGROUND_NORMAL = SystemColor('button-background-normal')
|
|
||||||
BUTTON_HOVER = SystemColor('button-hover')
|
|
||||||
BUTTON_BACKGROUND_HOVER = SystemColor('button-background-hover')
|
|
||||||
ICON_FILL_INACTIVE = SystemColor('icon-fill-inactive')
|
|
||||||
ICON_STROKE_INACTIVE = SystemColor('icon-stroke-inactive')
|
|
||||||
TOGGLE_BUTTON_BACKGROUND = SystemColor('toggle-button-background')
|
|
@ -15,7 +15,7 @@
|
|||||||
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
# Boston, MA 02111-1307, USA.
|
# Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
from sugar.graphics.roundbox import RoundBox
|
from sugar.graphics.roundbox import RoundBox
|
||||||
|
|
||||||
class Frame(RoundBox):
|
class Frame(RoundBox):
|
||||||
@ -23,4 +23,4 @@ class Frame(RoundBox):
|
|||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
RoundBox.__init__(self, **kwargs)
|
RoundBox.__init__(self, **kwargs)
|
||||||
self.props.border_color = color.FRAME_BORDER.get_int()
|
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||||
|
@ -26,7 +26,7 @@ import hippo
|
|||||||
|
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
|
|
||||||
STANDARD_SIZE = 0
|
STANDARD_SIZE = 0
|
||||||
SMALL_SIZE = 1
|
SMALL_SIZE = 1
|
||||||
@ -44,8 +44,8 @@ class IconButton(CanvasIcon, hippo.CanvasItem):
|
|||||||
CanvasIcon.__init__(self, cache=True, **kwargs)
|
CanvasIcon.__init__(self, cache=True, **kwargs)
|
||||||
|
|
||||||
if not self.props.fill_color and not self.props.stroke_color:
|
if not self.props.fill_color and not self.props.stroke_color:
|
||||||
self.props.fill_color = color.BUTTON_BACKGROUND_NORMAL
|
self.props.fill_color = style.Color("#404040")
|
||||||
self.props.stroke_color = color.BUTTON_NORMAL
|
self.props.stroke_color = style.Color("#FFFFFF")
|
||||||
|
|
||||||
self._set_size(STANDARD_SIZE)
|
self._set_size(STANDARD_SIZE)
|
||||||
self.connect('activated', self._icon_clicked_cb)
|
self.connect('activated', self._icon_clicked_cb)
|
||||||
@ -82,10 +82,9 @@ class IconButton(CanvasIcon, hippo.CanvasItem):
|
|||||||
def prelight(self, enter):
|
def prelight(self, enter):
|
||||||
if enter:
|
if enter:
|
||||||
if self.props.active:
|
if self.props.active:
|
||||||
self.props.background_color = color.BLACK.get_int()
|
self.props.background_color = 0x000000FF
|
||||||
else:
|
else:
|
||||||
self.props.background_color = \
|
self.props.background_color = 0x404040FF
|
||||||
color.BUTTON_BACKGROUND_NORMAL.get_int()
|
|
||||||
|
|
||||||
def _icon_clicked_cb(self, button):
|
def _icon_clicked_cb(self, button):
|
||||||
if self._palette:
|
if self._palette:
|
||||||
|
@ -24,7 +24,6 @@ import hippo
|
|||||||
from sugar.graphics.frame import Frame
|
from sugar.graphics.frame import Frame
|
||||||
from sugar.activity.bundle import Bundle
|
from sugar.activity.bundle import Bundle
|
||||||
from sugar.date import Date
|
from sugar.date import Date
|
||||||
from sugar.graphics import color
|
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
@ -43,7 +42,7 @@ class ObjectChooser(gtk.Dialog):
|
|||||||
self._selected_entry = False
|
self._selected_entry = False
|
||||||
|
|
||||||
self._box = hippo.CanvasBox()
|
self._box = hippo.CanvasBox()
|
||||||
self._box.props.background_color = color.DESKTOP_BACKGROUND.get_int()
|
self._box.props.background_color = style.COLOR_PANEL_GREY.get_int()
|
||||||
self._box.props.spacing = units.points_to_pixels(5)
|
self._box.props.spacing = units.points_to_pixels(5)
|
||||||
self._box.props.padding = units.points_to_pixels(5)
|
self._box.props.padding = units.points_to_pixels(5)
|
||||||
|
|
||||||
@ -105,8 +104,8 @@ class CollapsedEntry(Frame):
|
|||||||
Frame.__init__(self)
|
Frame.__init__(self)
|
||||||
self.props.box_height = units.grid_to_pixels(1)
|
self.props.box_height = units.grid_to_pixels(1)
|
||||||
self.props.spacing = units.points_to_pixels(5)
|
self.props.spacing = units.points_to_pixels(5)
|
||||||
self.props.border_color = color.FRAME_BORDER.get_int()
|
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||||
self.props.background_color = color.DESKTOP_BACKGROUND.get_int()
|
self.props.background_color = style.COLOR_PANEL_GREY.get_int()
|
||||||
|
|
||||||
self.jobject = jobject
|
self.jobject = jobject
|
||||||
self._icon_name = None
|
self._icon_name = None
|
||||||
@ -169,8 +168,8 @@ class CollapsedEntry(Frame):
|
|||||||
|
|
||||||
def set_selected(self, selected):
|
def set_selected(self, selected):
|
||||||
if selected:
|
if selected:
|
||||||
self.props.border_color = color.WHITE.get_int()
|
self.props.border_color = style.COLOR_WHITE.get_int()
|
||||||
self.props.background_color = color.WHITE.get_int()
|
self.props.background_color = style.COLOR_WHITE.get_int()
|
||||||
else:
|
else:
|
||||||
self.props.border_color = color.FRAME_BORDER.get_int()
|
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||||
self.props.background_color = color.DESKTOP_BACKGROUND.get_int()
|
self.props.background_color = style.COLOR_PANEL_GREY.get_int()
|
||||||
|
@ -20,7 +20,7 @@ import math
|
|||||||
import hippo
|
import hippo
|
||||||
|
|
||||||
from sugar.graphics import units
|
from sugar.graphics import units
|
||||||
from sugar.graphics import color
|
from sugar.graphics import style
|
||||||
|
|
||||||
class RoundBox(hippo.CanvasBox, hippo.CanvasItem):
|
class RoundBox(hippo.CanvasBox, hippo.CanvasItem):
|
||||||
__gtype_name__ = 'SugarRoundBox'
|
__gtype_name__ = 'SugarRoundBox'
|
||||||
@ -37,7 +37,7 @@ class RoundBox(hippo.CanvasBox, hippo.CanvasItem):
|
|||||||
self.props.border = self._BORDER_DEFAULT
|
self.props.border = self._BORDER_DEFAULT
|
||||||
self.props.border_left = self._radius
|
self.props.border_left = self._radius
|
||||||
self.props.border_right = self._radius
|
self.props.border_right = self._radius
|
||||||
self.props.border_color = color.BLACK.get_int()
|
self.props.border_color = style.COLOR_BLACK.get_int()
|
||||||
|
|
||||||
def do_paint_background(self, cr, damaged_box):
|
def do_paint_background(self, cr, damaged_box):
|
||||||
[width, height] = self.get_allocation()
|
[width, height] = self.get_allocation()
|
||||||
|
@ -103,8 +103,11 @@ TOOLBOX_TAB_VBORDER = int((zoom(36) - FONT_NORMAL_H - _FOCUS_LINE_WIDTH) / 2)
|
|||||||
TOOLBOX_TAB_HBORDER = zoom(15) - _FOCUS_LINE_WIDTH - _TAB_CURVATURE
|
TOOLBOX_TAB_HBORDER = zoom(15) - _FOCUS_LINE_WIDTH - _TAB_CURVATURE
|
||||||
TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
|
TOOLBOX_TAB_LABEL_WIDTH = zoom(150 - 15 * 2)
|
||||||
|
|
||||||
|
COLOR_WHITE = Color('#000000')
|
||||||
COLOR_WHITE = Color('#FFFFFF')
|
COLOR_WHITE = Color('#FFFFFF')
|
||||||
COLOR_PANEL_GREY = Color('#C0C0C0')
|
COLOR_PANEL_GREY = Color('#C0C0C0')
|
||||||
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
COLOR_SELECTION_GREY = Color('#A6A6A6')
|
||||||
|
COLOR_INACTIVE_FILL = Color('#9D9FA1')
|
||||||
|
COLOR_INACTIVE_STROKE = Color('#757575')
|
||||||
|
|
||||||
PALETTE_CURSOR_DISTANCE = zoom(10)
|
PALETTE_CURSOR_DISTANCE = zoom(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user