diff options
author | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-31 23:11:02 +0000 |
---|---|---|
committer | louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13> | 2010-08-31 23:11:02 +0000 |
commit | e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548 (patch) | |
tree | c56b10c3ba46be749755b201ba69a72c1891fb28 /src/poezio.py | |
parent | d2fef9112d71c7cee2b5a29cb5887e37fb3c990e (diff) | |
download | poezio-e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548.tar.gz poezio-e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548.tar.bz2 poezio-e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548.tar.xz poezio-e84b23d1ad7dcb3afa3754ff3b1c1eca27a90548.zip |
Switch to Sleekxmpp. fixed #1768
Diffstat (limited to 'src/poezio.py')
-rw-r--r-- | src/poezio.py | 41 |
1 files changed, 8 insertions, 33 deletions
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() |