Validate options for compose_service_type
This commit is contained in:
parent
e1070a21cb
commit
31e9671190
8
README
8
README
@ -35,11 +35,3 @@ For example:
|
|||||||
sugar/sugar --test my_nick_name1
|
sugar/sugar --test my_nick_name1
|
||||||
sugar/sugar --test my_nick_name2
|
sugar/sugar --test my_nick_name2
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
Key bindings
|
|
||||||
============
|
|
||||||
|
|
||||||
ctrl+Up Toggle chat window visibility
|
|
||||||
ctrl+Left Toggle presence window visibility
|
|
||||||
F11 Toggle activities window fullscreen
|
|
||||||
|
@ -22,7 +22,7 @@ class Chat(gtk.Window):
|
|||||||
SERVICE_PORT = 6100
|
SERVICE_PORT = 6100
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
gtk.Window.__init__(self, gtk.WINDOW_POPUP)
|
gtk.Window.__init__(self)
|
||||||
|
|
||||||
self._stream_writer = None
|
self._stream_writer = None
|
||||||
|
|
||||||
|
@ -42,6 +42,10 @@ def _txt_to_dict(txt):
|
|||||||
return prop_dict
|
return prop_dict
|
||||||
|
|
||||||
def compose_service_type(stype, activity_uid):
|
def compose_service_type(stype, activity_uid):
|
||||||
|
if not activity_uid:
|
||||||
|
return stype
|
||||||
|
if not stype or (type(stype) != type("") and type(stype) != type(u"")):
|
||||||
|
raise ValueError("stype must be a valid string.")
|
||||||
return "_%s_%s" % (activity_uid, stype)
|
return "_%s_%s" % (activity_uid, stype)
|
||||||
|
|
||||||
def _decompose_service_type(stype):
|
def _decompose_service_type(stype):
|
||||||
|
@ -11,7 +11,10 @@ class PresenceWindow(gtk.Window):
|
|||||||
_MODEL_COL_BUDDY = 2
|
_MODEL_COL_BUDDY = 2
|
||||||
|
|
||||||
def __init__(self, activity_container):
|
def __init__(self, activity_container):
|
||||||
gtk.Window.__init__(self, gtk.WINDOW_POPUP)
|
gtk.Window.__init__(self)
|
||||||
|
|
||||||
|
self.set_decorated(False)
|
||||||
|
self.set_skip_taskbar_hint(True)
|
||||||
|
|
||||||
self._activity_container = activity_container
|
self._activity_container = activity_container
|
||||||
|
|
||||||
|
@ -215,6 +215,7 @@ class ActivityHost(dbus.service.Object):
|
|||||||
class ActivityContainer(dbus.service.Object):
|
class ActivityContainer(dbus.service.Object):
|
||||||
|
|
||||||
def __init__(self, service, bus):
|
def __init__(self, service, bus):
|
||||||
|
|
||||||
self.activities = []
|
self.activities = []
|
||||||
|
|
||||||
self.bus = bus
|
self.bus = bus
|
||||||
@ -224,11 +225,7 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
bus.add_signal_receiver(self.name_owner_changed, dbus_interface = "org.freedesktop.DBus", signal_name = "NameOwnerChanged")
|
bus.add_signal_receiver(self.name_owner_changed, dbus_interface = "org.freedesktop.DBus", signal_name = "NameOwnerChanged")
|
||||||
|
|
||||||
self.window = gtk.Window()
|
self.window = gtk.Window()
|
||||||
self.window.connect("key-press-event", self.__key_press_event_cb)
|
|
||||||
self.window.set_title("OLPC Sugar")
|
self.window.set_title("OLPC Sugar")
|
||||||
|
|
||||||
self._fullscreen = False
|
|
||||||
|
|
||||||
self.notebook = gtk.Notebook()
|
self.notebook = gtk.Notebook()
|
||||||
|
|
||||||
tab_label = gtk.Label("Everyone")
|
tab_label = gtk.Label("Everyone")
|
||||||
@ -311,15 +308,6 @@ class ActivityContainer(dbus.service.Object):
|
|||||||
for owner, activity in self.activities:
|
for owner, activity in self.activities:
|
||||||
print " %d: owner=%s activity_object_name=%s" % (i, owner, activity.dbus_object_name)
|
print " %d: owner=%s activity_object_name=%s" % (i, owner, activity.dbus_object_name)
|
||||||
i += 1
|
i += 1
|
||||||
|
|
||||||
def __key_press_event_cb(self, window, event):
|
|
||||||
if event.keyval == gtk.keysyms.F11:
|
|
||||||
if self._fullscreen:
|
|
||||||
window.unfullscreen()
|
|
||||||
self._fullscreen = False
|
|
||||||
else:
|
|
||||||
window.fullscreen()
|
|
||||||
self._fullscreen = True
|
|
||||||
|
|
||||||
class ConsoleLogger(dbus.service.Object):
|
class ConsoleLogger(dbus.service.Object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -395,7 +383,6 @@ def main():
|
|||||||
wm.manage()
|
wm.manage()
|
||||||
|
|
||||||
presence_window = PresenceWindow(activity_container)
|
presence_window = PresenceWindow(activity_container)
|
||||||
presence_window.set_transient_for(activity_container.window)
|
|
||||||
|
|
||||||
wm = WindowManager(presence_window)
|
wm = WindowManager(presence_window)
|
||||||
|
|
||||||
@ -405,7 +392,6 @@ def main():
|
|||||||
wm.manage()
|
wm.manage()
|
||||||
|
|
||||||
group_chat = GroupChat()
|
group_chat = GroupChat()
|
||||||
group_chat.set_transient_for(activity_container.window)
|
|
||||||
group_chat.set_decorated(False)
|
group_chat.set_decorated(False)
|
||||||
group_chat.set_skip_taskbar_hint(True)
|
group_chat.set_skip_taskbar_hint(True)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user