From 0278d4707ed5f9967427181cb76c4d70557b902b Mon Sep 17 00:00:00 2001 From: Julio Biason Date: Sun, 4 Apr 2010 19:56:13 -0300 Subject: [PATCH] Proper name for the window resize event callback; when an avatar is available, redraw only the visible grid (the other one will be queue for redraw anyway when the user change tabs.) --- mitterlib/ui/ui_pygtk.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mitterlib/ui/ui_pygtk.py b/mitterlib/ui/ui_pygtk.py index d9f5919..2793fbc 100644 --- a/mitterlib/ui/ui_pygtk.py +++ b/mitterlib/ui/ui_pygtk.py @@ -33,12 +33,12 @@ from mitterlib.ui.helpers.gtk_threading import ThreadManager from mitterlib.ui.helpers.gtk_updatebox import UpdateBox from mitterlib.ui.helpers.gtk_messagegrid import MessageGrid from mitterlib.constants import gpl_3, version -from mitterlib.ui.helpers import timesince +# ---------------------------------------------------------------------- # Constants +# ---------------------------------------------------------------------- _log = logging.getLogger('ui.pygtk') -URL_RE = re.compile(r'(https?://[^\s\n\r]+)', re.I) # ---------------------------------------------------------------------- # I18n bits @@ -121,7 +121,7 @@ class Interface(object): # now that all elements are created, connect the signals main_window.connect('destroy', self._quit_app) main_window.connect('delete-event', self._quit_app) - main_window.connect('size-request', self._grid_resize) + main_window.connect('size-request', self._window_resize) self._update_field.connect('focus-in-event', self._on_textarea_focus) @@ -467,7 +467,7 @@ class Interface(object): gtk.main_quit() return - def _grid_resize(self, widget, requisition, data=None): + def _window_resize(self, widget, requisition, data=None): """Called when the window is resized. We use it to set the proper word-wrapping in the message column.""" (win_width, win_height) = self._main_window.get_size() @@ -759,7 +759,8 @@ class Interface(object): user_pic = user_pic.scale_simple(48, 48, gtk.gdk.INTERP_BILINEAR) self._avatars[url] = user_pic - (grid, _) = self._grids[0] + page = self._main_tabs.get_current_page() + grid = self._main_tabs.get_nth_page(page) grid.queue_draw() return