Fix a bunch of bugs
This commit is contained in:
parent
e752cda5e6
commit
2da875af68
@ -163,10 +163,9 @@ 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)
|
||||||
|
if self._model:
|
||||||
self._load_shared_address()
|
self._load_shared_address()
|
||||||
self._model.add_listener(self.__shared_address_changed_cb)
|
self._model.add_listener(self.__shared_address_changed_cb)
|
||||||
|
|
||||||
@ -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):
|
||||||
|
@ -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
|
||||||
|
@ -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]
|
||||||
|
Loading…
Reference in New Issue
Block a user