Add hover to BuddyIcon in the Frame.

This commit is contained in:
Tomeu Vizoso 2007-02-24 14:58:38 +01:00
parent 940b50b4e6
commit ce800fbc66
4 changed files with 22 additions and 5 deletions

View File

@ -35,6 +35,8 @@ class BuddyMenu(Menu):
self._shell = shell
Menu.__init__(self, buddy.get_name())
self.props.border = 0
self.props.padding = units.points_to_pixels(5)
pixbuf = self._get_buddy_icon_pixbuf()
if pixbuf:
icon_item = hippo.CanvasImage()

View File

@ -17,15 +17,30 @@
import hippo
from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics import color
from sugar.presence import PresenceService
from view.BuddyIcon import BuddyIcon
from model.BuddyModel import BuddyModel
class FriendIcon(BuddyIcon):
def __init__(self, shell, popup_context, buddy):
BuddyIcon.__init__(self, shell, popup_context, buddy)
self._popup_context = popup_context
def get_popup_context(self):
return self._popup_context
def prelight(self, enter):
if enter:
self.props.background_color = color.BLACK.get_int()
else:
self.props.background_color = color.TOOLBAR_BACKGROUND.get_int()
class FriendsBox(hippo.CanvasBox):
def __init__(self, shell, menu_shell):
def __init__(self, shell, popup_context):
hippo.CanvasBox.__init__(self)
self._shell = shell
self._menu_shell = menu_shell
self._popup_context = popup_context
self._activity_ps = None
self._joined_hid = -1
self._left_hid = -1
@ -48,7 +63,7 @@ class FriendsBox(hippo.CanvasBox):
return
model = BuddyModel(buddy=buddy)
icon = BuddyIcon(self._shell, self._menu_shell, model)
icon = FriendIcon(self._shell, self._popup_context, model)
self.append(icon)
self._buddies[buddy.get_name()] = icon

View File

@ -36,7 +36,7 @@ class FramePopupContext(PopupContext):
left_x = item_x + item_w
left_y = item_y
right_x = item_x + item_w
right_x = item_x - popup_w
right_y = item_y
top_x = item_x
top_y = item_y + item_h

View File

@ -85,7 +85,7 @@ class SnowflakeBox(hippo.CanvasBox, hippo.CanvasItem):
return width
def do_allocate(self, width, height, origin_changed):
hippo.CanvasBox.do_allocate(self, width, height)
hippo.CanvasBox.do_allocate(self, width, height, origin_changed)
self._layout_root()