From 62c03953e87719bb80e0e32c9bfb09147052dc4b Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Fri, 31 Aug 2007 19:29:18 +0000 Subject: Fixed the fixed size issue of the link toolbar Use the sugar tray now --- (limited to 'model.py') diff --git a/model.py b/model.py index 284cb7f..e10774c 100644 --- a/model.py +++ b/model.py @@ -20,17 +20,25 @@ import libxml2 import os import logging import base64 - +import sha +import gobject _logger = logging.getLogger('model') -class Model(object): +class Model(gobject.GObject): + #__gtype_name__ = 'Model' + __gsignals__ = { + 'add_link': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([int])) + } + ''' The model of the activity. Contains methods to read and write the configuration for a browser session to and from xml. ''' def __init__(self, dtdpath): + gobject.GObject.__init__(self) self.links = [] self.data = {} self.dtdpath = dtdpath @@ -44,6 +52,12 @@ class Model(object): self.dtd = None self.ctxt = libxml2.newValidCtxt() + def add_link(self, url, title, thumb, owner, color): + print 'model: add link' + 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 read(self, filepath): ''' reads the configuration from an xml file ''' -- cgit v0.9.1