Browse Source

Big fuckup with reverting commits, but downloading user pics work

master
Julio Biason 16 years ago
parent
commit
3797043d28
  1. 49
      mitterlib/ui/ui_pygtk.py

49
mitterlib/ui/ui_pygtk.py

@ -146,9 +146,9 @@ class _ThreadManager(object):
if self._thread_pool: if self._thread_pool:
if len(self._running) < self._max_threads: if len(self._running) < self._max_threads:
next = self._thread_pool.pop() next = self._thread_pool.pop()
_log.debug('Dequeuing thread %s', thread.name) _log.debug('Dequeuing thread %s', next.name)
self._running.append(thread.name) self._running.append(next.name)
thread.start() next.start()
return return
@ -280,11 +280,10 @@ class Interface(object):
def _create_grid(self): def _create_grid(self):
"""Add the displaying grid.""" """Add the displaying grid."""
# Store NetworkData objects only
grid_store = gtk.ListStore(object) grid_store = gtk.ListStore(object)
# Trying to store the NetworkData object only grid_store.set_sort_column_id(0, gtk.SORT_DESCENDING)
grid_store.set_default_sort_func(self._order_datetime)
# self.grid_store.set_sort_func(0, self._sort_by_time)
# self.grid_store.set_sort_column_id(0, gtk.SORT_DESCENDING)
self._grid = gtk.TreeView(grid_store) self._grid = gtk.TreeView(grid_store)
self._grid.set_property('headers-visible', False) self._grid.set_property('headers-visible', False)
@ -478,7 +477,7 @@ class Interface(object):
# image and force a redraw. # image and force a redraw.
self._avatars[pic] = self._default_pixmap self._avatars[pic] = self._default_pixmap
cell.set_property('pixbuf', self._user_pics[pic]) cell.set_property('pixbuf', self._avatars[pic])
return return
@ -589,6 +588,23 @@ class Interface(object):
return return
def _order_datetime(self, model, iter1, iter2, user_data=None):
"""Used by the ListStore to sort the columns (in our case, "column")
by date."""
message1 = model.get_value(iter1, 0)
message2 = model.get_value(iter2, 0)
if (not message1) or \
(not message1.message_time) or \
(message1.message_time > message2.message_time):
return 1
if (not message2) or \
(not message2.message_time) or \
(message2.message_time > message1.message_time):
return -1
return 0
# ------------------------------------------------------------ # ------------------------------------------------------------
# Network related functions # Network related functions
# ------------------------------------------------------------ # ------------------------------------------------------------
@ -602,6 +618,7 @@ class Interface(object):
for message in results: for message in results:
_log.debug('Data: %s', str(message)) _log.debug('Data: %s', str(message))
store.prepend([message]) store.prepend([message])
store.sort_column_changed()
return return
def _exception_get_messages(self, widget, exception): def _exception_get_messages(self, widget, exception):
@ -671,22 +688,6 @@ class Interface(object):
self._default_pixmap = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, self._default_pixmap = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB,
has_alpha=False, bits_per_sample=8, width=48, height=48) has_alpha=False, bits_per_sample=8, width=48, height=48)
#self._systray_setup()
# self.create_settings_dialog()
# self.username_field.set_text(default_username)
# self.password_field.set_text(default_password)
# self.https_field.set_active(self.https)
# notification helper
# self.notify_broadcast = Notify('mitter').notify
# start auto refresh activity
# self._refresh_id = None
# self.set_auto_refresh()
# self.window.set_focus(self.update_text)
return return
def __call__(self): def __call__(self):

Loading…
Cancel
Save