|
|
@ -21,11 +21,14 @@ import gobject |
|
|
|
import gtk |
|
|
|
import gtk |
|
|
|
import logging |
|
|
|
import logging |
|
|
|
import pango |
|
|
|
import pango |
|
|
|
|
|
|
|
import re |
|
|
|
|
|
|
|
|
|
|
|
from cgi import escape as html_escape |
|
|
|
from cgi import escape as html_escape |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import timesince |
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# String with the format to the message |
|
|
|
# Constants for the message |
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
MESSAGE_FORMAT = ('%(favourite_star)s' |
|
|
|
MESSAGE_FORMAT = ('%(favourite_star)s' |
|
|
|
'<b>%(full_name)s</b> ' |
|
|
|
'<b>%(full_name)s</b> ' |
|
|
@ -37,6 +40,7 @@ MESSAGE_FORMAT = ('%(favourite_star)s' |
|
|
|
'\n' |
|
|
|
'\n' |
|
|
|
'%(message)s\n' |
|
|
|
'%(message)s\n' |
|
|
|
'<small>%(message_age)s</small>') |
|
|
|
'<small>%(message_age)s</small>') |
|
|
|
|
|
|
|
URL_RE = re.compile(r'(https?://[^\s\n\r]+)', re.I) |
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# Logging |
|
|
|
# Logging |
|
|
@ -316,7 +320,7 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): |
|
|
|
iter = model.get_iter_first() |
|
|
|
iter = model.get_iter_first() |
|
|
|
path = model.get_path(iter) |
|
|
|
path = model.get_path(iter) |
|
|
|
|
|
|
|
|
|
|
|
width = win_width - 85 # 48 = icon size |
|
|
|
width = size - 85 # 48 = icon size |
|
|
|
# TODO: Find out where those 37 pixels came from and/or if they |
|
|
|
# TODO: Find out where those 37 pixels came from and/or if they |
|
|
|
# are platform specific. |
|
|
|
# are platform specific. |
|
|
|
|
|
|
|
|
|
|
@ -331,13 +335,13 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): |
|
|
|
|
|
|
|
|
|
|
|
def update(self, messages): |
|
|
|
def update(self, messages): |
|
|
|
"""Update the grid with new messages.""" |
|
|
|
"""Update the grid with new messages.""" |
|
|
|
self._grid.freeze() |
|
|
|
self._grid.freeze_notify() |
|
|
|
store = self._grid.get_model() |
|
|
|
store = self._grid.get_model() |
|
|
|
for message in messages: |
|
|
|
for message in messages: |
|
|
|
message.read = False |
|
|
|
message.read = False |
|
|
|
store.prepend([message]) |
|
|
|
store.prepend([message]) |
|
|
|
store.sort_column_changed() |
|
|
|
store.sort_column_changed() |
|
|
|
self._grid.thaw() |
|
|
|
self._grid.thaw_notify() |
|
|
|
self._grid.queue_draw() |
|
|
|
self._grid.queue_draw() |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
@ -363,3 +367,8 @@ class MessageGrid(gtk.ScrolledWindow, gobject.GObject): |
|
|
|
|
|
|
|
|
|
|
|
self.count = 0 |
|
|
|
self.count = 0 |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def queue_draw(self): |
|
|
|
|
|
|
|
"""Make the grid to be redraw when possible.""" |
|
|
|
|
|
|
|
# we need this 'cause _grid is not exposed. |
|
|
|
|
|
|
|
self._grid.queue_draw() |
|
|
|