Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/activities/web/linksview.py
diff options
context:
space:
mode:
Diffstat (limited to 'activities/web/linksview.py')
-rw-r--r--activities/web/linksview.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/activities/web/linksview.py b/activities/web/linksview.py
index 3c8e3df..1afd651 100644
--- a/activities/web/linksview.py
+++ b/activities/web/linksview.py
@@ -6,10 +6,11 @@ from sugar.graphics.iconcolor import IconColor
from sugar.graphics import style
class LinksView(hippo.Canvas):
- def __init__(self, model):
+ def __init__(self, model, browser):
hippo.Canvas.__init__(self)
self._bubbles = {}
+ self._browser = browser
self._box = hippo.CanvasBox(background_color=0x414141ff)
self.set_root(self._box)
@@ -22,10 +23,16 @@ class LinksView(hippo.Canvas):
def _add_link(self, link):
color = IconColor(link.buddy.get_color())
+
bubble = Bubble(color=color)
- style.apply_stylesheet(bubble, 'bubble.Box')
+ style.apply_stylesheet(bubble, 'bubble.Bubble')
self._box.append(bubble)
+ text = hippo.CanvasLink(text=link.title)
+ text.connect('activated', self._link_activated_cb, link)
+ style.apply_stylesheet(text, 'bubble.Text')
+ bubble.append(text, hippo.PACK_EXPAND)
+
self._bubbles[link] = bubble
def _remove_link(self, link):
@@ -39,3 +46,6 @@ class LinksView(hippo.Canvas):
def _link_removed_cb(self, model, link):
self._removed_link(link)
+
+ def _link_activated_cb(self, link_item, link):
+ self._browser.load_url(link.url)