Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@localhost.localdomain>2006-10-05 15:09:38 (GMT)
committer Marco Pesenti Gritti <marco@localhost.localdomain>2006-10-05 15:09:38 (GMT)
commit6479962ca7740a7784953ffcc6ce00544bd21004 (patch)
treed2e2ccac251bba5300be8c58ebab56b742afdecd /shell
parent847f69fce7fdef17e04d860b845495a49e06dab3 (diff)
Get back presence list to work
Diffstat (limited to 'shell')
-rw-r--r--shell/view/BuddyIcon.py2
-rw-r--r--shell/view/frame/Frame.py8
-rw-r--r--shell/view/frame/FriendsBox.py (renamed from shell/view/frame/RightPanel.py)17
-rw-r--r--shell/view/frame/MenuStrategy.py16
-rw-r--r--shell/view/stylesheet.py10
5 files changed, 38 insertions, 15 deletions
diff --git a/shell/view/BuddyIcon.py b/shell/view/BuddyIcon.py
index 8f875c9..3dec8d8 100644
--- a/shell/view/BuddyIcon.py
+++ b/shell/view/BuddyIcon.py
@@ -4,7 +4,7 @@ from view.BuddyMenu import BuddyMenu
class BuddyIcon(MenuIcon):
def __init__(self, shell, menu_shell, buddy):
MenuIcon.__init__(self, menu_shell, icon_name='stock-buddy',
- color=buddy.get_color(), size=112)
+ color=buddy.get_color())
self._shell = shell
self._buddy = buddy
diff --git a/shell/view/frame/Frame.py b/shell/view/frame/Frame.py
index 9b43fd1..38f0c68 100644
--- a/shell/view/frame/Frame.py
+++ b/shell/view/frame/Frame.py
@@ -5,6 +5,7 @@ import wnck
from view.frame.ActivitiesBox import ActivitiesBox
from view.frame.ZoomBox import ZoomBox
+from view.frame.FriendsBox import FriendsBox
from view.frame.PanelWindow import PanelWindow
from sugar.graphics.timeline import Timeline
from sugar.graphics.menushell import MenuShell
@@ -143,10 +144,13 @@ class Frame:
[x, y] = grid.point(1, 0)
bottom_panel.move(box, x, y)
- left_panel = self._create_panel(grid, 0, 1, 1, 10)
-
right_panel = self._create_panel(grid, 15, 1, 1, 10)
+ box = FriendsBox(self._shell, self._menu_shell)
+ right_panel.append(box)
+
+ left_panel = self._create_panel(grid, 0, 1, 1, 10)
+
def _create_panel(self, grid, x, y, width, height):
panel = PanelWindow()
diff --git a/shell/view/frame/RightPanel.py b/shell/view/frame/FriendsBox.py
index 366dbfd..8d48a0e 100644
--- a/shell/view/frame/RightPanel.py
+++ b/shell/view/frame/FriendsBox.py
@@ -1,15 +1,16 @@
import hippo
-from sugar.graphics.CanvasIcon import CanvasIcon
+from sugar.graphics.canvasicon import CanvasIcon
from sugar.graphics.iconcolor import IconColor
+from sugar.graphics import style
from sugar.presence import PresenceService
from view.BuddyIcon import BuddyIcon
from model.BuddyModel import BuddyModel
from view.frame.MenuStrategy import MenuStrategy
-class RightPanel(hippo.CanvasBox):
+class FriendsBox(hippo.CanvasBox):
def __init__(self, shell, menu_shell):
- CanvasBox.__init__(self)
+ hippo.CanvasBox.__init__(self)
self._shell = shell
self._menu_shell = menu_shell
self._activity_ps = None
@@ -26,18 +27,18 @@ class RightPanel(hippo.CanvasBox):
def add(self, buddy):
model = BuddyModel(buddy=buddy)
icon = BuddyIcon(self._shell, self._menu_shell, model)
+ style.apply_stylesheet(icon, 'frame.BuddyIcon')
icon.set_menu_strategy(MenuStrategy())
- self.append(icon, 0)
+ self.append(icon)
self._buddies[buddy.get_name()] = icon
def remove(self, buddy):
- i = self.find_child(self._buddies[buddy.get_name()])
- self.remove_child(i)
+ self.remove(self._buddies[buddy.get_name()])
def clear(self):
- while (self.get_n_children() > 0):
- self.remove_child(0)
+ for item in self.get_children():
+ self.remove(item)
self._buddies = {}
def __activity_appeared_cb(self, pservice, activity_ps):
diff --git a/shell/view/frame/MenuStrategy.py b/shell/view/frame/MenuStrategy.py
index 0519d23..34353f8 100644
--- a/shell/view/frame/MenuStrategy.py
+++ b/shell/view/frame/MenuStrategy.py
@@ -1,7 +1,21 @@
+import hippo
+
from sugar.graphics.grid import Grid
class MenuStrategy:
- def get_menu_position(self, menu, x, y, width, height):
+ def get_menu_position(self, menu, item):
+ [x, y] = item.get_context().translate_to_widget(item)
+
+ canvas = item
+ while (not isinstance(canvas, hippo.Canvas)):
+ canvas = canvas.get_context()
+
+ [origin_x, origin_y] = canvas.window.get_origin()
+ x += origin_x
+ y += origin_y
+
+ [width, height] = item.get_allocation()
+
grid = Grid()
[grid_x1, grid_y1] = grid.fit_point(x, y)
diff --git a/shell/view/stylesheet.py b/shell/view/stylesheet.py
index bdb5a44..a89d1fd 100644
--- a/shell/view/stylesheet.py
+++ b/shell/view/stylesheet.py
@@ -23,11 +23,11 @@ frame_ActivityIcon = {
'size' : _standard_icon_size
}
-ring_ActivityIcon = {
- 'size' : _medium_icon_size
+frame_ZoomIcon = {
+ 'size' : _standard_icon_size
}
-frame_ZoomIcon = {
+frame_BuddyIcon = {
'size' : _standard_icon_size
}
@@ -55,6 +55,10 @@ home_MyIcon = {
'size' : _xlarge_icon_size
}
+ring_ActivityIcon = {
+ 'size' : _medium_icon_size
+}
+
friends_MyIcon = {
'size' : _large_icon_size
}