More work on the chat. Fix terminal api
This commit is contained in:
@@ -2,16 +2,27 @@ from gettext import gettext as _
|
||||
|
||||
from sugar.activity.Activity import Activity
|
||||
from sugar.chat.BuddyChat import BuddyChat
|
||||
from sugar.presence.PresenceService import PresenceService
|
||||
|
||||
class ChatActivity(Activity):
|
||||
def __init__(self, service):
|
||||
def __init__(self):
|
||||
Activity.__init__(self)
|
||||
self.set_title(_('Private chat'))
|
||||
|
||||
self._service = service
|
||||
self._chat = BuddyChat(self._service)
|
||||
def cmd_connect(self, args):
|
||||
pservice = PresenceService()
|
||||
service = pservice.get(args[0])
|
||||
|
||||
self._chat = BuddyChat(service)
|
||||
self.add(self._chat)
|
||||
self._chat.show()
|
||||
|
||||
def recv_message(self, message):
|
||||
self._chat.recv_message(message)
|
||||
def cmd_message(self, args):
|
||||
self._chat.recv_message(args[0])
|
||||
|
||||
def execute(self, command, args):
|
||||
if command == 'connect':
|
||||
self.cmd_connect(args)
|
||||
elif command == 'message':
|
||||
self.cmd_mesage(args)
|
||||
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
name = Chat
|
||||
id = com.redhat.Sugar.ChatActivity
|
||||
python_module = chat.ChatActivity.ChatActivity
|
||||
default_type = _chat_activity._tcp
|
||||
|
||||
@@ -51,8 +51,8 @@ class Terminal(gtk.HBox):
|
||||
pass
|
||||
|
||||
class TerminalActivity(Activity):
|
||||
def __init__(self, service):
|
||||
Activity.__init__(self, service)
|
||||
def __init__(self):
|
||||
Activity.__init__(self)
|
||||
|
||||
self.set_title("Terminal")
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
[Activity]
|
||||
name = Terminal
|
||||
id = org.sugar.Terminal
|
||||
default_type = _terminal_olpc._udp
|
||||
python_module = terminal.TerminalActivity.TerminalActivity
|
||||
|
||||
Reference in New Issue
Block a user