Make CanvasIcon use IconBuffer. Change the API to use

a separate property for icon_name and file_name.
This commit is contained in:
Marco Pesenti Gritti
2007-08-26 14:16:09 +02:00
parent f44c340b3a
commit 98157bbccb
13 changed files with 102 additions and 366 deletions
+1 -1
View File
@@ -47,7 +47,7 @@ class DeviceView(CanvasIcon):
# Update palette
if self._model.props.charging:
status = _STATUS_CHARGING
self.props.badge_name = 'theme:badge-charging'
self.props.badge_name = 'badge-charging'
elif self._model.props.discharging:
status = _STATUS_DISCHARGING
self.props.badge_name = None
+5 -5
View File
@@ -22,7 +22,7 @@ from model.devices import device
class DeviceView(canvasicon.CanvasIcon):
def __init__(self, model):
canvasicon.CanvasIcon.__init__(self, size=style.MEDIUM_ICON_SIZE,
icon_name='theme:network-mesh')
icon_name='network-mesh')
self._model = model
model.connect('notify::state', self._state_changed_cb)
@@ -35,11 +35,11 @@ class DeviceView(canvasicon.CanvasIcon):
# FIXME Change icon colors once we have real icons
state = self._model.props.state
if state == device.STATE_ACTIVATING:
self.props.fill_color = style.COLOR_INACTIVE_FILL
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
elif state == device.STATE_ACTIVATED:
self.props.fill_color = None
self.props.stroke_color = None
elif state == device.STATE_INACTIVE:
self.props.fill_color = style.COLOR_INACTIVE_FILL
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
+1 -1
View File
@@ -19,4 +19,4 @@ from view.devices import deviceview
class DeviceView(deviceview.DeviceView):
def __init__(self, model):
deviceview.DeviceView.__init__(self, model)
self.props.icon_name = 'theme:network-wired'
self.props.icon_name = 'network-wired'
+4 -5
View File
@@ -18,7 +18,6 @@
from sugar.graphics.icon import get_icon_state
from sugar.graphics.icon import CanvasIcon
from sugar.graphics import style
from sugar.graphics import style
from model.devices.network import wireless
from model.devices import device
@@ -56,11 +55,11 @@ class DeviceView(CanvasIcon):
# FIXME Change icon colors once we have real icons
state = self._model.props.state
if state == device.STATE_ACTIVATING:
self.props.fill_color = style.COLOR_INACTIVE_FILL
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()
elif state == device.STATE_ACTIVATED:
self.props.fill_color = None
self.props.stroke_color = None
elif state == device.STATE_INACTIVE:
self.props.fill_color = style.COLOR_INACTIVE_FILL
self.props.stroke_color = style.COLOR_INACTIVE_STROKE
self.props.fill_color = style.COLOR_INACTIVE_FILL.get_svg()
self.props.stroke_color = style.COLOR_INACTIVE_STROKE.get_svg()