summaryrefslogtreecommitdiff
path: root/src/client.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-02-10 16:47:43 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-02-10 16:47:43 +0000
commitd2a4ecf9a5214b784720dd6a7b2ad79c298a05b9 (patch)
treed32bb1b64829405677d7a5fc5fbc0bc12cb7b3b8 /src/client.py
parentb9a05fe48a4a5221ff0e09d86268ef75ffb17baf (diff)
downloadpoezio-d2a4ecf9a5214b784720dd6a7b2ad79c298a05b9.tar.gz
poezio-d2a4ecf9a5214b784720dd6a7b2ad79c298a05b9.tar.bz2
poezio-d2a4ecf9a5214b784720dd6a7b2ad79c298a05b9.tar.xz
poezio-d2a4ecf9a5214b784720dd6a7b2ad79c298a05b9.zip
little cleanup
Diffstat (limited to 'src/client.py')
-rw-r--r--src/client.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/client.py b/src/client.py
index 0d81e0f2..f64dc5e6 100644
--- a/src/client.py
+++ b/src/client.py
@@ -19,7 +19,7 @@
import sys
# disable any printout (this would mess the display)
-stderr = sys.stderr
+STDERR = sys.stderr
sys.stderr = open('/dev/null', 'w')
sys.stdout = open('/dev/null', 'w')
@@ -28,21 +28,22 @@ from multiuserchat import MultiUserChat
from config import config
from handler import Handler
from gui import Gui
-from curses import wrapper, initscr
+from curses import initscr
import curses
import signal
signal.signal(signal.SIGINT, signal.SIG_IGN)
import traceback
-def exception_handler(type_, value, tb):
+
+def exception_handler(type_, value, trace):
"""
on any traceback: exit ncurses and print the traceback
then exit the program
"""
curses.echo()
curses.endwin()
- traceback.print_exception(type_, value, tb, None, stderr)
+ traceback.print_exception(type_, value, trace, None, STDERR)
sys.exit()
sys.excepthook = exception_handler
@@ -63,9 +64,18 @@ class Client(object):
self.connection.start()
self.gui = Gui(self.stdscr, MultiUserChat(self.connection.client))
+ def launch(self):
+ """
+ launch
+ """
+ self.gui.main_loop(self.stdscr)
+
def main():
+ """
+ main function
+ """
client = Client()
- client.gui.main_loop(client.stdscr)
+ client.launch()
sys.exit()
if __name__ == '__main__':