Rename color property in CanvasIcon to xo-color and added properties fill-color and stroke-color.

This commit is contained in:
Tomeu Vizoso
2007-02-23 17:08:37 +01:00
parent 97e64751cc
commit a2e5b9308e
15 changed files with 108 additions and 69 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ from view.BuddyMenu import BuddyMenu
class BuddyIcon(CanvasIcon):
def __init__(self, shell, menu_shell, buddy):
CanvasIcon.__init__(self, icon_name='theme:stock-buddy',
color=buddy.get_color())
xo_color=buddy.get_color())
self._shell = shell
self._buddy = buddy
@@ -30,7 +30,7 @@ class BuddyIcon(CanvasIcon):
def _buddy_presence_change_cb(self, buddy, color=None):
# Update the icon's color when the buddy comes and goes
self.set_property('color', buddy.get_color())
self.props.xo_color = buddy.get_color()
def set_popup_distance(self, distance):
self._popup_distance = distance
+1 -7
View File
@@ -31,12 +31,6 @@ class ActivityButton(IconButton):
self._activity = activity
self._popup_context = popup_context
def _mouse_motion_event_cb(self, item, event):
if event.detail == hippo.MOTION_DETAIL_ENTER:
self.set_property('color', self._prelight_color)
elif event.detail == hippo.MOTION_DETAIL_LEAVE:
self.set_property('color', self._normal_color)
def get_bundle_id(self):
return self._activity.get_service_name()
@@ -47,7 +41,7 @@ class InviteButton(IconButton):
def __init__(self, activity, invite):
IconButton.__init__(self, icon_name=activity.get_icon())
self.props.color = activity.get_color()
self.props.xo_color = activity.get_color()
self._invite = invite
def get_activity_id(self):
+1 -1
View File
@@ -48,7 +48,7 @@ class ActivityButton(IconButton):
icon_name = self._activity_model.get_icon_name()
icon_color = self._activity_model.get_icon_color()
IconButton.__init__(self, icon_name=icon_name, color=icon_color)
IconButton.__init__(self, icon_name=icon_name, xo_color=icon_color)
def get_popup(self):
menu = ActivityMenu(self._activity_model)
+2 -2
View File
@@ -70,7 +70,7 @@ class FriendView(hippo.CanvasBox):
name = self._get_new_icon_name(activity)
if name:
self._activity_icon.props.icon_name = name
self._activity_icon.props.color = buddy.get_color()
self._activity_icon.props.xo_color = buddy.get_color()
if not self._activity_icon_visible:
self.append(self._activity_icon, hippo.PACK_EXPAND)
self._activity_icon_visible = True
@@ -85,4 +85,4 @@ class FriendView(hippo.CanvasBox):
self._buddy_activity_changed_cb(buddy, None)
def _buddy_color_changed_cb(self, buddy, color):
self._activity_icon.props.color = buddy.get_color()
self._activity_icon.props.xo_color = buddy.get_color()
+6 -1
View File
@@ -19,6 +19,7 @@ import math
import hippo
from sugar.graphics import units
from sugar.graphics import color
from sugar.graphics.xocolor import XoColor
from view.home.activitiesdonut import ActivitiesDonut
@@ -59,7 +60,11 @@ class HomeBox(hippo.CanvasBox, hippo.CanvasItem):
if self._donut:
self.remove(self._donut)
self._donut = None
self._my_icon.props.color = XoColor('insensitive')
self._my_icon.props.stroke_color = color.BUTTON_INACTIVE
self._my_icon.props.fill_color = \
color.BUTTON_INACTIVE_BACKGROUND
self._my_icon.props.background_color = \
color.BUTTON_INACTIVE_BACKGROUND
def do_allocate(self, width, height, origin_changed):
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
+1 -1
View File
@@ -33,7 +33,7 @@ class ActivityView(SnowflakeBox):
self._icons = {}
icon = CanvasIcon(icon_name=model.get_icon_name(),
color=model.get_color(), box_width=80)
xo_color=model.get_color(), box_width=80)
icon.connect('activated', self._clicked_cb)
self.append(icon, hippo.PACK_FIXED)
self.set_root(icon)
+1 -1
View File
@@ -21,4 +21,4 @@ class MyIcon(CanvasIcon):
def __init__(self, scale):
CanvasIcon.__init__(self, scale=scale,
icon_name='theme:stock-buddy',
color=profile.get_color())
xo_color=profile.get_color())
+3 -3
View File
@@ -55,7 +55,7 @@ class ActivityIcon(CanvasIcon):
self._level = self._level_max
color = self._icon_colors[self._level]
CanvasIcon.__init__(self, icon_name=icon_name, color=color,
CanvasIcon.__init__(self, icon_name=icon_name, xo_color=color,
scale=units.MEDIUM_ICON_SCALE, cache=True)
self._activity = activity
@@ -103,7 +103,7 @@ class ActivityIcon(CanvasIcon):
self._direction = 1
self._level = 0
self.props.color = self._icon_colors[self._level]
self.props.xo_color = self._icon_colors[self._level]
self.emit_paint_needed(0, 0, -1, -1)
return True
@@ -113,7 +113,7 @@ class ActivityIcon(CanvasIcon):
self._launched = True
self.cleanup()
self._level = 100.0
self.props.color = self._orig_color
self.props.xo_color = self._orig_color
self.emit_paint_needed(0, 0, -1, -1)
def get_launched(self):