From 58ed74bae6df469742f0e282946b4d614865b464 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 22 May 2006 11:47:59 -0400 Subject: [PATCH] Stick main code into main() --- sugar/chat/chat.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) 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()