From 6ae5e4111a76f9cb8f59ae6dfc9123365df39467 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Sat, 01 Sep 2007 09:11:36 +0000 Subject: Merge branch 'master' into json Conflicts: model.py webactivity.py --- (limited to 'model.py') diff --git a/model.py b/model.py index 6bdb94e..fdb8ff9 100644 --- a/model.py +++ b/model.py @@ -18,22 +18,32 @@ import os import logging -import base64 import json - -from xpcom import components -from xpcom.components import interfaces +import sha +import gobject _logger = logging.getLogger('model') -class Model(object): +class Model(gobject.GObject): ''' The model of the activity which uses json to serialize its data to a file and deserelize from it. ''' + __gsignals__ = { + 'add_link': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([int])) + } def __init__(self): + gobject.GObject.__init__(self) + self.data = {} self.links = [] + self.data['shared_links'] = self.links + + def add_link(self, url, title, thumb, owner, color): + self.links.append( {'hash':sha.new(url).hexdigest(), 'url':url, 'title':title, 'thumb':thumb, + 'owner':owner, 'color':color, 'deleted':0} ) + self.emit('add_link', len(self.links)-1) def serialize(self): self.get_session() -- cgit v0.9.1