summaryrefslogtreecommitdiff
path: root/src/poezio.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-20 17:25:41 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-20 17:25:41 +0000
commitbb92c63a2c050ec9042327ba62ea5b9e06b45720 (patch)
tree4bc2f3760fc5bd03e04ed612c878ab6df8011b59 /src/poezio.py
parenta63c733d6915cf9ffecac519a997bf341101178a (diff)
downloadpoezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.gz
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.bz2
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.xz
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.zip
fix backspace key, error messages not displayed, and other stuff
Diffstat (limited to 'src/poezio.py')
-rw-r--r--src/poezio.py32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/poezio.py b/src/poezio.py
index 6a5dc435..a73924d8 100644
--- a/src/poezio.py
+++ b/src/poezio.py
@@ -24,10 +24,40 @@ Starting point of poezio. Launches both the Connection and Gui
import sys
import traceback
import curses
-from common import MyStdErr, exception_handler
+
+class MyStdErr(object):
+ def __init__(self, fd):
+ """
+ Change sys.stderr to something like /dev/null
+ to disable any printout on the screen that would
+ mess everything
+ """
+ self.old_stderr = sys.stderr
+ sys.stderr = fd
+ def restaure(self):
+ """
+ Restaure the good ol' sys.stderr, because we need
+ it in order to print the tracebacks
+ """
+ sys.stderr = self.old_stderr
+
+my_stderr = MyStdErr(open('/dev/null', 'a'))
+
+def exception_handler(type_, value, trace):
+ """
+ on any traceback: exit ncurses and print the traceback
+ then exit the program
+ """
+ my_stderr.restaure()
+ curses.endwin()
+ curses.echo()
+ traceback.print_exception(type_, value, trace, None, sys.stderr)
+ sys.exit(2)
sys.excepthook = exception_handler
+import common
+
from connection import Connection
from multiuserchat import MultiUserChat
from config import config