From 11a013aff2c21ac75d76b492acb848dad9976776 Mon Sep 17 00:00:00 2001 From: Marco Pesenti Gritti Date: Sat, 16 Sep 2006 10:46:10 +0200 Subject: [PATCH] For the owner show only nick name --- shell/model/Owner.py | 3 +++ shell/view/BuddyPopup.py | 30 ++++++++++++++++++++---------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/shell/model/Owner.py b/shell/model/Owner.py index 24004f0b..c49810e9 100644 --- a/shell/model/Owner.py +++ b/shell/model/Owner.py @@ -44,6 +44,9 @@ class ShellOwner(object): def get_invites(self): return self._invites + def get_name(self): + return self._nick + def announce(self): # Create and announce our presence color = conf.get_profile().get_color() diff --git a/shell/view/BuddyPopup.py b/shell/view/BuddyPopup.py index 4aab3f6b..018e7fa8 100644 --- a/shell/view/BuddyPopup.py +++ b/shell/view/BuddyPopup.py @@ -23,7 +23,8 @@ class BuddyPopup(gtk.Window): self._hover = False self._popdown_on_leave = False self._width = 13 - self._height = 10 + self._shell = shell + self._buddy = buddy grid = shell.get_grid() @@ -31,23 +32,32 @@ class BuddyPopup(gtk.Window): self.add(canvas) canvas.show() - grid.set_constraints(canvas, 0, 0, self._width, self._height) - model = goocanvas.CanvasModelSimple() root = model.get_root_item() - color = buddy.get_color() + color = self._buddy.get_color() rect = goocanvas.Rect(fill_color=color.get_fill_color(), stroke_color=color.get_stroke_color(), line_width=3) - grid.set_constraints(rect, 0, 0, self._width, self._height) root.add_child(rect) - text = goocanvas.Text(text=buddy.get_name(), font="Sans bold 18", + text = goocanvas.Text(text=self._buddy.get_name(), font="Sans bold 18", fill_color='black', anchor=gtk.ANCHOR_SW) - grid.set_constraints(text, 1, 3, self._width, self._height) + grid.set_constraints(text, 1, 3, self._width, 2) root.add_child(text) + self._height = 4 + + owner = shell.get_model().get_owner() + if buddy.get_name() != owner.get_name(): + self._add_actions(grid, root) + + grid.set_constraints(canvas, 0, 0, self._width, self._height) + grid.set_constraints(rect, 0, 0, self._width, self._height) + + canvas.set_model(model) + + def _add_actions(self, grid, root): separator = goocanvas.Path(data='M 15 0 L 185 0', line_width=3, fill_color='black') grid.set_constraints(separator, 0, 4) @@ -56,8 +66,8 @@ class BuddyPopup(gtk.Window): box = CanvasBox(grid, CanvasBox.HORIZONTAL, 1) grid.set_constraints(box, 0, 5) - friends = shell.get_model().get_friends() - if friends.has_buddy(buddy): + friends = self._shell.get_model().get_friends() + if friends.has_buddy(self._buddy): icon = IconItem(icon_name='stock-remove-friend') icon.connect('clicked', self._action_clicked_cb, BuddyPopup.ACTION_REMOVE_FRIEND) @@ -81,7 +91,7 @@ class BuddyPopup(gtk.Window): root.add_child(box) - canvas.set_model(model) + self._height = 10 def _action_clicked_cb(self, icon, action): self.emit('action', action)