From 0d6c7276b19fff2cdfb7b2f252fefa1b338f63af Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Thu, 16 Sep 2010 17:55:38 +0000 Subject: fixes a crash on shlex. --- src/gui.py | 3 ++- src/tab.py | 2 +- src/window.py | 30 ++++++++---------------------- 3 files changed, 11 insertions(+), 24 deletions(-) diff --git a/src/gui.py b/src/gui.py index 5f3b1323..b62be3d2 100644 --- a/src/gui.py +++ b/src/gui.py @@ -38,6 +38,7 @@ from config import config from tab import MucTab, InfoTab, PrivateTab, RosterInfoTab from user import User from room import Room +from roster import Roster from message import Message from text_buffer import TextBuffer from keyboard import read_char @@ -74,7 +75,7 @@ class Gui(object): self.init_curses(self.stdscr) self.xmpp = xmpp default_tab = InfoTab(self.stdscr, "Info") if self.xmpp.anon\ - else RosterInfoTab(self.stdscr, "Roster") + else RosterInfoTab(self.stdscr, self.xmpp.roster) self.tabs = [default_tab] # a unique buffer used to store global informations # that are displayed in almost all tabs, in an diff --git a/src/tab.py b/src/tab.py index c26b6aee..64c3c788 100644 --- a/src/tab.py +++ b/src/tab.py @@ -384,8 +384,8 @@ class RosterInfoTab(Tab): self.input.resize(1, self.width, self.height-1, 0, stdscr, self.visible) def refresh(self, tabs, informations): - self.v_separator.refresh() self.roster_win.refresh(self.roster) + self.v_separator.refresh() self.info_win.refresh(informations) self.tab_win.refresh(tabs, tabs[0]) self.input.refresh() diff --git a/src/window.py b/src/window.py index 5671de44..e92fdc5b 100644 --- a/src/window.py +++ b/src/window.py @@ -439,8 +439,9 @@ class TextWin(Win): try: splitted = shlex.split(txt) except ValueError: - txt = txt.replace('"', '') - splitted = shlex.split(txt) + from common import debug + debug('SHLEX FAILED on: [%s]\n' % (txt,)) + splitted = 'shlex failed here. See debug'.split() for word in splitted: if word in list(special_words.keys()): self.addstr(word, curses.color_pair(special_words[word])) @@ -876,22 +877,6 @@ class Input(Win): def clear_text(self): self.win.erase() -# class RosterWin(Win): -# def __init__(self, height, width, y, x, parent_win, visible): -# Win.__init__(self, height, width, y, x, parent_win) -# self.visible = visible - -# def resize(self, height, width, y, x, stdscr, visible): -# self._resize(height, width, y, x, stdscr) -# self.visible = visible - -# def refresh(self, roster): -# g_lock.acquire() -# self.win.erase() -# self.addnstr('teub', 4) -# self.win.refresh() -# g_lock.release() - class VerticalSeparator(Win): """ Just a one-column window, with just a line in it, that is @@ -919,8 +904,6 @@ class VerticalSeparator(Win): self.rewrite_line() class RosterWin(Win): - """ - """ def __init__(self, height, width, y, x, parent_win, visible): self.visible = visible Win.__init__(self, height, width, y, x, parent_win) @@ -928,12 +911,15 @@ class RosterWin(Win): def resize(self, height, width, y, x, stdscr, visible): self._resize(height, width, y, x, stdscr) + self.visible = visible - def refresh(self, roster=None): + def refresh(self, roster): """ We get the roster object """ - if not self.visible or not roster: + from common import debug + debug('anus%s, %s' % (roster, self.visible)) + if not self.visible: return g_lock.acquire() self.win.erase() -- cgit v1.2.3