diff --git a/sugar/browser/browser.py b/sugar/browser/browser.py index 02af2e52..fc5ce0a1 100755 --- a/sugar/browser/browser.py +++ b/sugar/browser/browser.py @@ -163,12 +163,11 @@ class BrowserActivity(activity.Activity): self.uri = uri self._group = group - self._setup_shared(uri) - def _setup_shared(self, uri): self._model = self._group.get_store().get_model(uri) - self._load_shared_address() - self._model.add_listener(self.__shared_address_changed_cb) + if self._model: + self._load_shared_address() + self._model.add_listener(self.__shared_address_changed_cb) def activity_on_connected_to_shell(self): self.activity_set_ellipsize_tab(True) @@ -195,6 +194,8 @@ class BrowserActivity(activity.Activity): plug.show() vbox.show() + + self._setup_shared(uri) def get_embed(self): return self.embed @@ -218,7 +219,7 @@ class BrowserActivity(activity.Activity): def _load_shared_address(self): address = self._model.get_value("current_address") - if (address != self.embed.get_address()): + if address != self.embed.get_address(): self.embed.load_address(address) def __shared_address_changed_cb(self, model, key): diff --git a/sugar/p2p/Group.py b/sugar/p2p/Group.py index 50aed46b..faa6041c 100644 --- a/sugar/p2p/Group.py +++ b/sugar/p2p/Group.py @@ -2,7 +2,7 @@ from Buddy import Buddy from Buddy import Owner from Buddy import PRESENCE_SERVICE_TYPE from Service import Service -import Model +from sugar.p2p.model.Store import Store import presence class Group: @@ -15,7 +15,7 @@ class Group: def __init__(self): self._service_listeners = [] self._presence_listeners = [] - self._store = Model.Store(self) + self._store = Store(self) def get_store(self): return self._store diff --git a/sugar/p2p/model/LocalModel.py b/sugar/p2p/model/LocalModel.py index f8192cc3..89171924 100644 --- a/sugar/p2p/model/LocalModel.py +++ b/sugar/p2p/model/LocalModel.py @@ -2,7 +2,7 @@ import socket from sugar.p2p.Service import Service from sugar.p2p.model.AbstractModel import AbstractModel -import network +from sugar.p2p import network class ModelRequestHandler(object): def __init__(self, model): @@ -25,7 +25,6 @@ class LocalModel(AbstractModel): self._values = {} self._setup_service() - self._setup_notification() def get_value(self, key): return self._values[key]