Fix up focus handling some
This commit is contained in:
parent
5fa4d3426e
commit
a929dc0b46
@ -33,6 +33,8 @@ class ActivityHostSignalHelper(gobject.GObject):
|
|||||||
|
|
||||||
class ActivityHost(dbus.service.Object):
|
class ActivityHost(dbus.service.Object):
|
||||||
def __init__(self, activity_container, activity_name, default_type, activity_id = None):
|
def __init__(self, activity_container, activity_name, default_type, activity_id = None):
|
||||||
|
self.peer_service = None
|
||||||
|
|
||||||
self.activity_name = activity_name
|
self.activity_name = activity_name
|
||||||
self.ellipsize_tab = False
|
self.ellipsize_tab = False
|
||||||
self._shared = False
|
self._shared = False
|
||||||
@ -99,6 +101,13 @@ class ActivityHost(dbus.service.Object):
|
|||||||
def _create_chat(self):
|
def _create_chat(self):
|
||||||
self._activity_chat = ActivityChat(self)
|
self._activity_chat = ActivityChat(self)
|
||||||
|
|
||||||
|
def got_focus(self):
|
||||||
|
if self.peer_service != None:
|
||||||
|
self.peer_service.got_focus()
|
||||||
|
|
||||||
|
def lost_focus(self):
|
||||||
|
self.peer_service.lost_focus()
|
||||||
|
|
||||||
def get_chat(self):
|
def get_chat(self):
|
||||||
return self._activity_chat
|
return self._activity_chat
|
||||||
|
|
||||||
@ -365,12 +374,6 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
def show(self):
|
def show(self):
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
def __focus_reply_cb(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def __focus_error_cb(self, error):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_current_activity(self, activity):
|
def set_current_activity(self, activity):
|
||||||
self.current_activity = activity
|
self.current_activity = activity
|
||||||
self._presence_window.set_activity(activity)
|
self._presence_window.set_activity(activity)
|
||||||
@ -388,23 +391,12 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity")
|
new_activity = notebook.get_nth_page(page_number).get_data("sugar-activity")
|
||||||
|
|
||||||
if self.current_activity != None:
|
if self.current_activity != None:
|
||||||
if self.has_activity(self.current_activity):
|
self.current_activity.lost_focus()
|
||||||
self.current_activity.peer_service.lost_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb)
|
|
||||||
|
|
||||||
#if self.has_activity(new_activity):
|
|
||||||
self.set_current_activity(new_activity)
|
self.set_current_activity(new_activity)
|
||||||
|
|
||||||
if self.current_activity != None:
|
if self.current_activity != None:
|
||||||
if self.has_activity(self.current_activity):
|
self.current_activity.got_focus()
|
||||||
self.current_activity.peer_service.got_focus(reply_handler = self.__focus_reply_cb, error_handler = self.__focus_error_cb)
|
|
||||||
|
|
||||||
|
|
||||||
def has_activity(self, activity_to_check_for):
|
|
||||||
for owner, activity in self.activities[:]:
|
|
||||||
if activity_to_check_for == activity:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def name_owner_changed(self, service_name, old_service_name, new_service_name):
|
def name_owner_changed(self, service_name, old_service_name, new_service_name):
|
||||||
#print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name)
|
#print "in name_owner_changed: svc=%s oldsvc=%s newsvc=%s"%(service_name, old_service_name, new_service_name)
|
||||||
|
Loading…
Reference in New Issue
Block a user