Merge branch 'master' of git+ssh://dcbw@crank.laptop.org/git/sugar
This commit is contained in:
commit
48fa6a8934
@ -106,18 +106,11 @@ class BrowserActivity(activity.Activity):
|
|||||||
stype=_BROWSER_ACTIVITY_TYPE, properties=properties)
|
stype=_BROWSER_ACTIVITY_TYPE, properties=properties)
|
||||||
|
|
||||||
# Create our activity-specific browser sharing service
|
# Create our activity-specific browser sharing service
|
||||||
#self._model = self._group.get_store().create_model(url)
|
self._model = LocalModel(stype)
|
||||||
#self._model.set_value('owner', self._pservice.get_owner().get_nick_name())
|
self._model.set_value('owner', self._pservice.get_owner().get_nick_name())
|
||||||
#self._update_shared_location()
|
self._update_shared_location()
|
||||||
#self.set_mode(BrowserActivity.LEADING)
|
self.set_mode(BrowserActivity.LEADING)
|
||||||
|
|
||||||
#bus = dbus.SessionBus()
|
|
||||||
#proxy_obj = bus.get_object('com.redhat.Sugar.Chat', '/com/redhat/Sugar/Chat')
|
|
||||||
#chat_shell = dbus.Interface(proxy_obj, 'com.redhat.Sugar.ChatShell')
|
|
||||||
|
|
||||||
#chat_shell.send_text_message('<richtext><link href="' + escaped_address +
|
|
||||||
# '">' + escaped_title + '</link></richtext>')
|
|
||||||
|
|
||||||
def __title_cb(self, embed):
|
def __title_cb(self, embed):
|
||||||
self.set_tab_text(embed.get_title())
|
self.set_tab_text(embed.get_title())
|
||||||
|
|
||||||
|
@ -19,9 +19,9 @@ class LocalModel(AbstractModel):
|
|||||||
SERVICE_TYPE = "_olpc_model._tcp"
|
SERVICE_TYPE = "_olpc_model._tcp"
|
||||||
SERVICE_PORT = 6300
|
SERVICE_PORT = 6300
|
||||||
|
|
||||||
def __init__(self, group, model_id):
|
def __init__(self, pservice, model_id):
|
||||||
AbstractModel.__init__(self)
|
AbstractModel.__init__(self)
|
||||||
self._group = group
|
self._pservice = pservice
|
||||||
self._model_id = model_id
|
self._model_id = model_id
|
||||||
self._values = {}
|
self._values = {}
|
||||||
|
|
||||||
@ -37,10 +37,11 @@ class LocalModel(AbstractModel):
|
|||||||
self._notifier.notify(key)
|
self._notifier.notify(key)
|
||||||
|
|
||||||
def _setup_service(self):
|
def _setup_service(self):
|
||||||
service = Service(self._model_id, LocalModel.SERVICE_TYPE,
|
self._service = self._pservice.share_activity(self,
|
||||||
LocalModel.SERVICE_PORT)
|
stype=LocalModel.SERVICE_TYPE,
|
||||||
|
'', port=LocalModel.PORT_TYPE
|
||||||
|
properties=properties)
|
||||||
self._setup_server(service)
|
self._setup_server(service)
|
||||||
service.register(self._group)
|
|
||||||
|
|
||||||
# FIXME this is duplicated with StreamReader
|
# FIXME this is duplicated with StreamReader
|
||||||
def _setup_server(self, service):
|
def _setup_server(self, service):
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
from sugar.p2p.model.RemoteModel import RemoteModel
|
|
||||||
from sugar.p2p.model.LocalModel import LocalModel
|
|
||||||
|
|
||||||
class Store:
|
|
||||||
def __init__(self, group):
|
|
||||||
self._group = group
|
|
||||||
self._local_models = {}
|
|
||||||
|
|
||||||
def create_model(self, model_id):
|
|
||||||
model = LocalModel(self._group, model_id)
|
|
||||||
self._local_models[model_id] = model
|
|
||||||
return model
|
|
||||||
|
|
||||||
def get_model(self, model_id):
|
|
||||||
if self._local_models.has_key(model_id):
|
|
||||||
return self._local_models[model_id]
|
|
||||||
else:
|
|
||||||
service = self._group.get_service(model_id, LocalModel.SERVICE_TYPE)
|
|
||||||
if service:
|
|
||||||
return RemoteModel(self._group, service)
|
|
||||||
else:
|
|
||||||
return None
|
|
Loading…
Reference in New Issue
Block a user