From e724584faa026c95362d85500351668b0d21290c Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Wed, 27 Jan 2010 23:02:12 +0000 Subject: [PATCH] corrige la deconnexion sur les conneries du genre ctrl+x. Et desactive C-c en mode pas-debug --- src/client.py | 4 +++- src/connection.py | 6 ++++++ src/gui.py | 4 ++-- src/window.py | 2 -- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/client.py b/src/client.py index df7f62d5..db1af8fe 100644 --- a/src/client.py +++ b/src/client.py @@ -25,8 +25,10 @@ from handler import Handler from gui import Gui from curses import wrapper, initscr -if len(sys.argv) == 1: # not debug, so hide any error message +if len(sys.argv) == 1: # not debug, so hide any error message and disable C-c + import signal sys.stderr = open('/dev/null', 'a') + signal.signal(signal.SIGINT, signal.SIG_IGN) class Client(object): """ diff --git a/src/connection.py b/src/connection.py index f586eb01..94167c75 100644 --- a/src/connection.py +++ b/src/connection.py @@ -77,6 +77,7 @@ class Connection(Thread): self.client.RegisterHandler('message', self.handler_message) self.client.RegisterHandler('presence', self.handler_presence) self.client.RegisterHandler('iq', self.handler_iq) + self.client.RegisterHandler('error', self.handler_error) def handler_presence(self, connection, presence): fro = presence.getFrom() @@ -94,6 +95,11 @@ class Connection(Thread): def handler_iq(self, connection, iq): pass + def handler_error(self, connection, error): + import sys + print "TOUCHE FION" + sys.exit() + def process(self, timeout=10): if self.online: try:self.client.Process(timeout) diff --git a/src/gui.py b/src/gui.py index 5845999b..fd47e4e5 100644 --- a/src/gui.py +++ b/src/gui.py @@ -154,6 +154,8 @@ class Gui(object): self.execute() elif ord(key) == 8 or ord(key) == 127: self.window.input.key_backspace() + elif ord(key) < 32: + continue else: if ord(key) == 27 and ord(stdscr.getkey()) == 91 \ and ord(stdscr.getkey()) == 51: # FIXME: ugly ugly workaroung. @@ -202,12 +204,10 @@ class Gui(object): def rotate_rooms_left(self, args): self.rooms.append(self.rooms.pop(0)) - self.stdscr.touchwin() self.window.refresh(self.current_room()) def rotate_rooms_right(self, args): self.rooms.insert(0, self.rooms.pop()) -# self.stdscr.touchwin() self.window.refresh(self.current_room()) def room_message(self, stanza): diff --git a/src/window.py b/src/window.py index 382e88de..1baefa42 100644 --- a/src/window.py +++ b/src/window.py @@ -164,8 +164,6 @@ class Input(Win): """ def __init__(self, height, width, y, x, stdscr): Win.__init__(self, height, width, y, x, stdscr) - # self.input = curses.textpad.Textbox(self.win) - # self.input.insert_mode = True self.history = [] self.text = u'' self.pos = 0