From a14611dbde118b1ffa6f66eb7237ddc0c3c61508 Mon Sep 17 00:00:00 2001 From: "louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13" Date: Tue, 11 May 2010 10:38:57 +0000 Subject: Fix the resize bug and avoid some blinking on resize \o/ fixed #1153 --- src/client.py | 7 ++----- src/common.py | 7 ++++++- src/connection.py | 4 ++-- src/gui.py | 11 +++++++---- src/window.py | 18 +++++++++++++----- 5 files changed, 30 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/client.py b/src/client.py index 9616be1c..3480907b 100644 --- a/src/client.py +++ b/src/client.py @@ -21,7 +21,7 @@ import sys # disable any printout (this would mess the display) # sys.stdout = open('/dev/null', 'w') -# sys.stderr = open('/dev/null', 'w') +sys.stderr = open('debug', 'w') from connection import Connection from multiuserchat import MultiUserChat @@ -49,16 +49,13 @@ class Client(object): self.resource = config.get('resource', 'poezio') self.server = config.get('server', 'louiz.org') self.connection = Connection(self.server, self.resource) - # self.connection.demon = True self.connection.start() - # self.connection.run() self.stdscr = initscr() self.gui = Gui(self.stdscr, MultiUserChat(self.connection.client)) - # thread.start_new_thread(self.launch, ()) def launch(self): """ - launch + launch the gui """ self.gui.main_loop(self.stdscr) diff --git a/src/common.py b/src/common.py index 340eb213..1c119c1e 100644 --- a/src/common.py +++ b/src/common.py @@ -30,7 +30,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# various useful functions +__doc__ = "various useful functions" import base64 import os @@ -41,6 +41,11 @@ import curses import traceback import sys +def debug(s): + f = open("debug", 'a') + f.write(s+'\n') + f.close() + def exception_handler(type_, value, trace): """ on any traceback: exit ncurses and print the traceback diff --git a/src/connection.py b/src/connection.py index bc4928e7..a95191ba 100644 --- a/src/connection.py +++ b/src/connection.py @@ -45,7 +45,7 @@ class Connection(threading.Thread): def __init__(self, server, resource): threading.Thread.__init__(self) self.handler = Handler() - self.daemon = True # exit the program when this exits + self.daemon = True # exit the program when this thread exits self.server = server self.resource = resource self.online = 0 # 1:connected, 2:auth confirmed @@ -66,7 +66,7 @@ class Connection(threading.Thread): self.handler.emit('error', msg='Could not authenticate to server') sys.exit(-1) self.client.sendInitPresence(requestRoster=0) - self.online = 1 # 2 when confirmation of auth is received + self.online = 1 # 2 when confirmation of our auth is received self.register_handlers() while 1: self.process() diff --git a/src/gui.py b/src/gui.py index 7ec1ab73..b3964354 100644 --- a/src/gui.py +++ b/src/gui.py @@ -17,6 +17,8 @@ # You should have received a copy of the GNU General Public License # along with Poezio. If not, see . +from common import debug + from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) @@ -77,7 +79,7 @@ class Gui(object): 'away': (self.command_away, _('Usage: /away [message]\nAway: Sets your availability to away and (optional) sets your status message. This is equivalent to "/show away [message]"')), 'busy': (self.command_busy, _('Usage: /busy [message]\nBusy: Sets your availability to busy and (optional) sets your status message. This is equivalent to "/show busy [message]"')), 'avail': (self.command_avail, _('Usage: /avail [message]\nAvail: Sets your availability to available and (optional) sets your status message. This is equivalent to "/show available [message]"')), - 'available': (self.command_avail, _('Usage: /available [message]\nAvailable: Sets your availability to available and (optional) sets your status message. This is equivalent to "/show available [message]"')), + 'available': (self.command_avail, _('Usage: /available [message]\nAvailable: Sets your availability to available and (optional) sets your status message. This is equivalent to "/show available [message]"')), 'bookmark': (self.command_bookmark, _('Usage: /bookmark [roomname][/nick]\nBookmark: Bookmark the specified room (you will then auto-join it on each poezio start). This commands uses the same syntaxe as /join. Type /help join for syntaxe examples. Note that when typing "/bookmark" on its own, the room will be bookmarked with the nickname you\'re currently using in this room (instead of default_nick)')), 'set': (self.command_set, _('Usage: /set