corrige la deconnexion sur les conneries du genre ctrl+x. Et desactive C-c en mode pas-debug

parent 40f3dad5
...@@ -25,8 +25,10 @@ from handler import Handler ...@@ -25,8 +25,10 @@ from handler import Handler
from gui import Gui from gui import Gui
from curses import wrapper, initscr 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') sys.stderr = open('/dev/null', 'a')
signal.signal(signal.SIGINT, signal.SIG_IGN)
class Client(object): class Client(object):
""" """
......
...@@ -77,6 +77,7 @@ class Connection(Thread): ...@@ -77,6 +77,7 @@ class Connection(Thread):
self.client.RegisterHandler('message', self.handler_message) self.client.RegisterHandler('message', self.handler_message)
self.client.RegisterHandler('presence', self.handler_presence) self.client.RegisterHandler('presence', self.handler_presence)
self.client.RegisterHandler('iq', self.handler_iq) self.client.RegisterHandler('iq', self.handler_iq)
self.client.RegisterHandler('error', self.handler_error)
def handler_presence(self, connection, presence): def handler_presence(self, connection, presence):
fro = presence.getFrom() fro = presence.getFrom()
...@@ -94,6 +95,11 @@ class Connection(Thread): ...@@ -94,6 +95,11 @@ class Connection(Thread):
def handler_iq(self, connection, iq): def handler_iq(self, connection, iq):
pass pass
def handler_error(self, connection, error):
import sys
print "TOUCHE FION"
sys.exit()
def process(self, timeout=10): def process(self, timeout=10):
if self.online: if self.online:
try:self.client.Process(timeout) try:self.client.Process(timeout)
......
...@@ -154,6 +154,8 @@ class Gui(object): ...@@ -154,6 +154,8 @@ class Gui(object):
self.execute() self.execute()
elif ord(key) == 8 or ord(key) == 127: elif ord(key) == 8 or ord(key) == 127:
self.window.input.key_backspace() self.window.input.key_backspace()
elif ord(key) < 32:
continue
else: else:
if ord(key) == 27 and ord(stdscr.getkey()) == 91 \ if ord(key) == 27 and ord(stdscr.getkey()) == 91 \
and ord(stdscr.getkey()) == 51: # FIXME: ugly ugly workaroung. and ord(stdscr.getkey()) == 51: # FIXME: ugly ugly workaroung.
...@@ -202,12 +204,10 @@ class Gui(object): ...@@ -202,12 +204,10 @@ class Gui(object):
def rotate_rooms_left(self, args): def rotate_rooms_left(self, args):
self.rooms.append(self.rooms.pop(0)) self.rooms.append(self.rooms.pop(0))
self.stdscr.touchwin()
self.window.refresh(self.current_room()) self.window.refresh(self.current_room())
def rotate_rooms_right(self, args): def rotate_rooms_right(self, args):
self.rooms.insert(0, self.rooms.pop()) self.rooms.insert(0, self.rooms.pop())
# self.stdscr.touchwin()
self.window.refresh(self.current_room()) self.window.refresh(self.current_room())
def room_message(self, stanza): def room_message(self, stanza):
......
...@@ -164,8 +164,6 @@ class Input(Win): ...@@ -164,8 +164,6 @@ class Input(Win):
""" """
def __init__(self, height, width, y, x, stdscr): def __init__(self, height, width, y, x, stdscr):
Win.__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.history = []
self.text = u'' self.text = u''
self.pos = 0 self.pos = 0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment