diff options
author | Simon Schampijer <simon@schampijer.de> | 2007-09-01 09:11:36 (GMT) |
---|---|---|
committer | Simon Schampijer <simon@schampijer.de> | 2007-09-01 09:11:36 (GMT) |
commit | 6ae5e4111a76f9cb8f59ae6dfc9123365df39467 (patch) | |
tree | ad8f96e324175591b9122980d87db95535d93637 /model.py | |
parent | 67ef2bd8e5d9beab0f5dcf0a54567590350ad26c (diff) | |
parent | 632354861696311d758b35e8d7c7888b47a2f7b4 (diff) |
Merge branch 'master' into json
Conflicts:
model.py
webactivity.py
Diffstat (limited to 'model.py')
-rw-r--r-- | model.py | 20 |
1 files changed, 15 insertions, 5 deletions
@@ -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() |