diff --git a/sugar/chat/chat.py b/sugar/chat/chat.py index 31a4f26e..6dd66a4a 100755 --- a/sugar/chat/chat.py +++ b/sugar/chat/chat.py @@ -652,13 +652,18 @@ class ChatShell(dbus.service.Object): def send_text_message(self, message): self._group_chat.send_text_message(message) -if len(sys.argv) > 1 and sys.argv[1] == "--console": - sys.stdout = LogWriter("Chat") - sys.stderr = LogWriter("Chat") -ChatShell.get_instance().open_group_chat() -try: - gtk.threads_init() - gtk.main() -except KeyboardInterrupt: - pass +def main(): + if len(sys.argv) > 1 and sys.argv[1] == "--console": + sys.stdout = LogWriter("Chat") + sys.stderr = LogWriter("Chat") + + ChatShell.get_instance().open_group_chat() + try: + gtk.threads_init() + gtk.main() + except KeyboardInterrupt: + pass + +if __name__ == "__main__": + main()