From e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Tue, 31 Aug 2010 23:11:02 +0000 Subject: Switch to Sleekxmpp. fixed #1768 --- src/poezio.py | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) (limited to 'src/poezio.py') diff --git a/src/poezio.py b/src/poezio.py index a37e28b3..22af358e 100644 --- a/src/poezio.py +++ b/src/poezio.py @@ -25,26 +25,6 @@ import threading import sys import traceback -def installThreadExcepthook(): - """ - Workaround for sys.excepthook thread bug - See http://bugs.python.org/issue1230540 - Python, you made me sad :( - """ - init_old = threading.Thread.__init__ - def init(self, *args, **kwargs): - init_old(self, *args, **kwargs) - run_old = self.run - def run_with_except_hook(*args, **kw): - try: - run_old(*args, **kw) - except (KeyboardInterrupt, SystemExit): - raise - except: - sys.excepthook(*sys.exc_info()) - self.run = run_with_except_hook - threading.Thread.__init__ = init - class MyStdErr(object): def __init__(self, fd): """ @@ -59,6 +39,7 @@ class MyStdErr(object): Restaure the good ol' sys.stderr, because we need it in order to print the tracebacks """ + sys.stderr.close() sys.stderr = self.old_stderr my_stderr = MyStdErr(open('/dev/null', 'a')) @@ -77,30 +58,24 @@ def exception_handler(type_, value, trace): sys.excepthook = exception_handler -import sys -import curses import signal from connection import Connection -from multiuserchat import MultiUserChat from config import config from gui import Gui -from curses import initscr signal.signal(signal.SIGINT, signal.SIG_IGN) # ignore ctrl-c def main(): """ - main function + The main function consist of the Connection initialization + then the gui (ncurses) init, connection handlers and then the + connection is "started" """ - resource = config.get('resource', 'poezio') - server = config.get('server', 'anon.louiz.org:jeproteste.info') - connection = Connection(server, resource) - connection.start() - stdscr = initscr() - gui = Gui(stdscr, MultiUserChat(connection.client)) - gui.main_loop(stdscr) + xmpp = Connection() # Connection init + gui = Gui(xmpp) # Gui init. + xmpp.start() # Connect to remote server + gui.main_loop() # Refresh the screen, wait for user events etc if __name__ == '__main__': - installThreadExcepthook() main() -- cgit v1.2.3