From 5137f86445221f802a78bcc393f5c63f3625422f Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Wed, 27 Jan 2010 21:44:48 +0000 Subject: quelques fixs, genre l'historique et les accents et tout ca --- src/client.py | 3 ++- src/gui.py | 6 +++--- src/poezio.cfg | 3 ++- src/window.py | 20 +++++++++++++++----- 4 files changed, 22 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/client.py b/src/client.py index 31792512..df7f62d5 100644 --- a/src/client.py +++ b/src/client.py @@ -25,7 +25,8 @@ from handler import Handler from gui import Gui from curses import wrapper, initscr -sys.stderr = open('/dev/null', 'a') +if len(sys.argv) == 1: # not debug, so hide any error message + sys.stderr = open('/dev/null', 'a') class Client(object): """ diff --git a/src/gui.py b/src/gui.py index b8c7b3f6..0a738577 100644 --- a/src/gui.py +++ b/src/gui.py @@ -145,10 +145,10 @@ class Gui(object): while 1: curses.doupdate() key = stdscr.getkey() - if key == curses.KEY_RESIZE: - self.window.resize(stdscr) - elif str(key) in self.key_func.keys(): + if str(key) in self.key_func.keys(): self.key_func[key]() + elif len(key) >= 4: + continue elif ord(key) == 10: self.execute() else: diff --git a/src/poezio.cfg b/src/poezio.cfg index 1e517db5..4386cbf3 100644 --- a/src/poezio.cfg +++ b/src/poezio.cfg @@ -3,5 +3,6 @@ logfile = logs resource = poezio server = louiz.org port = 5222 -rooms = discussion@kikoo.louiz.org/Poefion:test@chat.jabberfr.org/pd +rooms = discussion@kikoo.louiz.org/poetest + diff --git a/src/window.py b/src/window.py index 97c1f6d0..be9416fd 100644 --- a/src/window.py +++ b/src/window.py @@ -142,9 +142,11 @@ class TextWin(object): break win.addstr('\n['+line[0].strftime("%H:%M:%S") + "] <") length = len('['+line[0].strftime("%H:%M:%S") + "] <") - win.attron(curses.color_pair(user.color)) + try:win.attron(curses.color_pair(user.color)) + except:pass win.addstr(line[1]) - win.attroff(curses.color_pair(user.color)) + try:win.attroff(curses.color_pair(user.color)) + except:pass win.addstr("> ") win.addstr(line[2]) @@ -175,11 +177,19 @@ class Input(Win): self.input.insert_mode = True self.win.clear() + def key_dc(self): + """delete char""" + if self.pos == len(self.text): + return + (y, x) = self.win.getyx() + self.text = self.text[:self.pos]+self.text[self.pos+1:] + self.win.delch(y, x-1) + def key_up(self): self.win.clear() if self.histo_pos >= 0: self.histo_pos -= 1 - self.win.addstr(self.history[self.histo_pos+1]) + self.win.addstr(self.history[self.histo_pos+1].encode('utf-8')) self.text = self.history[self.histo_pos+1] self.pos = len(self.text) self.refresh() @@ -188,7 +198,7 @@ class Input(Win): self.win.clear() if self.histo_pos < len(self.history)-1: self.histo_pos += 1 - self.win.addstr(self.history[self.histo_pos]) + self.win.addstr(self.history[self.histo_pos].encode('utf-8')) self.text = self.history[self.histo_pos] self.pos = len(self.text) else: @@ -242,7 +252,7 @@ class Input(Win): self.pos = 0 self.history.append(txt) self.histo_pos = len(self.history)-1 - return txt + return txt.encode('utf-8') def save_text(self): self.txt = self.input.gather() -- cgit v1.2.3