Fix a bunch of bugs

This commit is contained in:
Marco Pesenti Gritti 2006-05-15 14:24:31 -04:00
parent e752cda5e6
commit 2da875af68
3 changed files with 9 additions and 9 deletions

View File

@ -163,12 +163,11 @@ class BrowserActivity(activity.Activity):
self.uri = uri self.uri = uri
self._group = group self._group = group
self._setup_shared(uri)
def _setup_shared(self, uri): def _setup_shared(self, uri):
self._model = self._group.get_store().get_model(uri) self._model = self._group.get_store().get_model(uri)
self._load_shared_address() if self._model:
self._model.add_listener(self.__shared_address_changed_cb) self._load_shared_address()
self._model.add_listener(self.__shared_address_changed_cb)
def activity_on_connected_to_shell(self): def activity_on_connected_to_shell(self):
self.activity_set_ellipsize_tab(True) self.activity_set_ellipsize_tab(True)
@ -196,6 +195,8 @@ class BrowserActivity(activity.Activity):
vbox.show() vbox.show()
self._setup_shared(uri)
def get_embed(self): def get_embed(self):
return self.embed return self.embed
@ -218,7 +219,7 @@ class BrowserActivity(activity.Activity):
def _load_shared_address(self): def _load_shared_address(self):
address = self._model.get_value("current_address") address = self._model.get_value("current_address")
if (address != self.embed.get_address()): if address != self.embed.get_address():
self.embed.load_address(address) self.embed.load_address(address)
def __shared_address_changed_cb(self, model, key): def __shared_address_changed_cb(self, model, key):

View File

@ -2,7 +2,7 @@ from Buddy import Buddy
from Buddy import Owner from Buddy import Owner
from Buddy import PRESENCE_SERVICE_TYPE from Buddy import PRESENCE_SERVICE_TYPE
from Service import Service from Service import Service
import Model from sugar.p2p.model.Store import Store
import presence import presence
class Group: class Group:
@ -15,7 +15,7 @@ class Group:
def __init__(self): def __init__(self):
self._service_listeners = [] self._service_listeners = []
self._presence_listeners = [] self._presence_listeners = []
self._store = Model.Store(self) self._store = Store(self)
def get_store(self): def get_store(self):
return self._store return self._store

View File

@ -2,7 +2,7 @@ import socket
from sugar.p2p.Service import Service from sugar.p2p.Service import Service
from sugar.p2p.model.AbstractModel import AbstractModel from sugar.p2p.model.AbstractModel import AbstractModel
import network from sugar.p2p import network
class ModelRequestHandler(object): class ModelRequestHandler(object):
def __init__(self, model): def __init__(self, model):
@ -25,7 +25,6 @@ class LocalModel(AbstractModel):
self._values = {} self._values = {}
self._setup_service() self._setup_service()
self._setup_notification()
def get_value(self, key): def get_value(self, key):
return self._values[key] return self._values[key]