s/FriendIcon/BuddyIcon since that is generic now
This commit is contained in:
parent
844216585a
commit
16574cbfcc
@ -1,6 +1,6 @@
|
|||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
from sugar.canvas.Grid import Grid
|
from sugar.canvas.Grid import Grid
|
||||||
from view.FriendPopup import FriendPopup
|
from view.BuddyPopup import BuddyPopup
|
||||||
|
|
||||||
class _PopupShell:
|
class _PopupShell:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -11,7 +11,7 @@ class _PopupShell:
|
|||||||
self._popup_controller._popdown()
|
self._popup_controller._popdown()
|
||||||
self._popup_controller = controller
|
self._popup_controller = controller
|
||||||
|
|
||||||
class FriendIcon(IconItem):
|
class BuddyIcon(IconItem):
|
||||||
_popup_shell = _PopupShell()
|
_popup_shell = _PopupShell()
|
||||||
|
|
||||||
def __init__(self, shell, friend):
|
def __init__(self, shell, friend):
|
||||||
@ -42,10 +42,10 @@ class FriendIcon(IconItem):
|
|||||||
def _popup_cb(self, icon, x1, y1, x2, y2):
|
def _popup_cb(self, icon, x1, y1, x2, y2):
|
||||||
self._popdown()
|
self._popdown()
|
||||||
|
|
||||||
FriendIcon._popup_shell.set_active(None)
|
BuddyIcon._popup_shell.set_active(None)
|
||||||
|
|
||||||
grid = self._shell.get_grid()
|
grid = self._shell.get_grid()
|
||||||
self._popup = FriendPopup(self._shell, icon.get_friend())
|
self._popup = BuddyPopup(self._shell, icon.get_friend())
|
||||||
self._popup.connect('action', self._popup_action_cb)
|
self._popup.connect('action', self._popup_action_cb)
|
||||||
self._popup.connect('enter-notify-event',
|
self._popup.connect('enter-notify-event',
|
||||||
self._popup_enter_notify_event_cb)
|
self._popup_enter_notify_event_cb)
|
||||||
@ -73,7 +73,7 @@ class FriendIcon(IconItem):
|
|||||||
|
|
||||||
self._popup.show()
|
self._popup.show()
|
||||||
|
|
||||||
FriendIcon._popup_shell.set_active(self)
|
BuddyIcon._popup_shell.set_active(self)
|
||||||
|
|
||||||
def _popup_action_cb(self, popup, action):
|
def _popup_action_cb(self, popup, action):
|
||||||
self._popdown()
|
self._popdown()
|
||||||
@ -83,10 +83,10 @@ class FriendIcon(IconItem):
|
|||||||
return
|
return
|
||||||
|
|
||||||
model = self._shell.get_model()
|
model = self._shell.get_model()
|
||||||
if action == FriendPopup.ACTION_INVITE:
|
if action == BuddyPopup.ACTION_INVITE:
|
||||||
activity = model.get_current_activity()
|
activity = model.get_current_activity()
|
||||||
activity.invite(buddy)
|
activity.invite(buddy)
|
||||||
elif action == FriendPopup.ACTION_MAKE_FRIEND:
|
elif action == BuddyPopup.ACTION_MAKE_FRIEND:
|
||||||
friends = model.get_friends()
|
friends = model.get_friends()
|
||||||
friends.add_buddy(buddy)
|
friends.add_buddy(buddy)
|
||||||
|
|
@ -6,7 +6,7 @@ from sugar.canvas.CanvasView import CanvasView
|
|||||||
from sugar.canvas.CanvasBox import CanvasBox
|
from sugar.canvas.CanvasBox import CanvasBox
|
||||||
from sugar.canvas.IconItem import IconItem
|
from sugar.canvas.IconItem import IconItem
|
||||||
|
|
||||||
class FriendPopup(gtk.Window):
|
class BuddyPopup(gtk.Window):
|
||||||
ACTION_MAKE_FRIEND = 0
|
ACTION_MAKE_FRIEND = 0
|
||||||
ACTION_INVITE = 1
|
ACTION_INVITE = 1
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class FriendPopup(gtk.Window):
|
|||||||
|
|
||||||
icon = IconItem(icon_name='stock-make-friend')
|
icon = IconItem(icon_name='stock-make-friend')
|
||||||
icon.connect('clicked', self._action_clicked_cb,
|
icon.connect('clicked', self._action_clicked_cb,
|
||||||
FriendPopup.ACTION_MAKE_FRIEND)
|
BuddyPopup.ACTION_MAKE_FRIEND)
|
||||||
box.set_constraints(icon, 3, 3)
|
box.set_constraints(icon, 3, 3)
|
||||||
box.add_child(icon)
|
box.add_child(icon)
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ class FriendPopup(gtk.Window):
|
|||||||
|
|
||||||
icon = IconItem(icon_name='stock-invite')
|
icon = IconItem(icon_name='stock-invite')
|
||||||
icon.connect('clicked', self._action_clicked_cb,
|
icon.connect('clicked', self._action_clicked_cb,
|
||||||
FriendPopup.ACTION_INVITE)
|
BuddyPopup.ACTION_INVITE)
|
||||||
box.set_constraints(icon, 3, 3)
|
box.set_constraints(icon, 3, 3)
|
||||||
box.add_child(icon)
|
box.add_child(icon)
|
||||||
|
|
@ -4,7 +4,7 @@ from sugar.canvas.IconItem import IconItem
|
|||||||
from sugar.canvas.IconColor import IconColor
|
from sugar.canvas.IconColor import IconColor
|
||||||
from sugar.canvas.CanvasBox import CanvasBox
|
from sugar.canvas.CanvasBox import CanvasBox
|
||||||
from sugar.presence import PresenceService
|
from sugar.presence import PresenceService
|
||||||
from view.FriendIcon import FriendIcon
|
from view.BuddyIcon import BuddyIcon
|
||||||
from model.Friends import Friend
|
from model.Friends import Friend
|
||||||
|
|
||||||
class RightPanel(CanvasBox):
|
class RightPanel(CanvasBox):
|
||||||
@ -25,7 +25,7 @@ class RightPanel(CanvasBox):
|
|||||||
|
|
||||||
def add(self, buddy):
|
def add(self, buddy):
|
||||||
friend = Friend(buddy.get_name(), buddy.get_color())
|
friend = Friend(buddy.get_name(), buddy.get_color())
|
||||||
icon = FriendIcon(self._shell, friend)
|
icon = BuddyIcon(self._shell, friend)
|
||||||
icon.set_popup_distance(1)
|
icon.set_popup_distance(1)
|
||||||
self.set_constraints(icon, 3, 3)
|
self.set_constraints(icon, 3, 3)
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
|
@ -4,7 +4,7 @@ import goocanvas
|
|||||||
|
|
||||||
from view.home.IconLayout import IconLayout
|
from view.home.IconLayout import IconLayout
|
||||||
from view.home.MyIcon import MyIcon
|
from view.home.MyIcon import MyIcon
|
||||||
from view.FriendIcon import FriendIcon
|
from view.BuddyIcon import BuddyIcon
|
||||||
|
|
||||||
class FriendsGroup(goocanvas.Group):
|
class FriendsGroup(goocanvas.Group):
|
||||||
def __init__(self, shell):
|
def __init__(self, shell):
|
||||||
@ -26,7 +26,7 @@ class FriendsGroup(goocanvas.Group):
|
|||||||
friends.connect('friend-added', self._friend_added_cb)
|
friends.connect('friend-added', self._friend_added_cb)
|
||||||
|
|
||||||
def add_friend(self, friend):
|
def add_friend(self, friend):
|
||||||
icon = FriendIcon(self._shell, friend)
|
icon = BuddyIcon(self._shell, friend)
|
||||||
self.add_child(icon)
|
self.add_child(icon)
|
||||||
self._icon_layout.add_icon(icon)
|
self._icon_layout.add_icon(icon)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user