add prelight on mouse enter to activity icons
* prelight uses profile.get_color()
This commit is contained in:
parent
4853f68eaa
commit
4869f74642
@ -20,6 +20,7 @@ import logging
|
|||||||
from sugar.graphics.canvasicon import CanvasIcon
|
from sugar.graphics.canvasicon import CanvasIcon
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
from sugar.graphics import style
|
from sugar.graphics import style
|
||||||
|
from sugar import profile
|
||||||
|
|
||||||
class ActivityItem(CanvasIcon):
|
class ActivityItem(CanvasIcon):
|
||||||
def __init__(self, activity):
|
def __init__(self, activity):
|
||||||
@ -27,6 +28,16 @@ class ActivityItem(CanvasIcon):
|
|||||||
CanvasIcon.__init__(self, icon_name=icon_name)
|
CanvasIcon.__init__(self, icon_name=icon_name)
|
||||||
style.apply_stylesheet(self, 'frame.ActivityIcon')
|
style.apply_stylesheet(self, 'frame.ActivityIcon')
|
||||||
self._activity = activity
|
self._activity = activity
|
||||||
|
self._normal_color = self.get_property('color')
|
||||||
|
self._prelight_color = profile.get_color()
|
||||||
|
|
||||||
|
self.connect('motion-notify-event', self._mouse_motion_event_cb)
|
||||||
|
|
||||||
|
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):
|
def get_bundle_id(self):
|
||||||
return self._activity.get_service_name()
|
return self._activity.get_service_name()
|
||||||
|
@ -26,6 +26,8 @@ from sugar.graphics import colors
|
|||||||
from sugar.graphics import iconcolor
|
from sugar.graphics import iconcolor
|
||||||
from sugar import profile
|
from sugar import profile
|
||||||
|
|
||||||
|
# TODO: rgb_to_html and html_to_rgb are useful elsewhere
|
||||||
|
# we should put this in a common module
|
||||||
def rgb_to_html(r, g, b):
|
def rgb_to_html(r, g, b):
|
||||||
""" (r, g, b) tuple (in float format) -> #RRGGBB """
|
""" (r, g, b) tuple (in float format) -> #RRGGBB """
|
||||||
return '#%02x%02x%02x' % (int(r * 255), int(g * 255), int(b * 255))
|
return '#%02x%02x%02x' % (int(r * 255), int(g * 255), int(b * 255))
|
||||||
|
Loading…
Reference in New Issue
Block a user