|
|
@ -32,8 +32,6 @@ from mitterlib.ui.helpers.image_helpers import find_image |
|
|
|
from mitterlib import htmlize |
|
|
|
from mitterlib import htmlize |
|
|
|
|
|
|
|
|
|
|
|
from mitterlib.constants import gpl_3, version |
|
|
|
from mitterlib.constants import gpl_3, version |
|
|
|
#from mitterlib.ui.helpers.utils import str_len |
|
|
|
|
|
|
|
#from mitterlib.ui.helpers.notify import Notify |
|
|
|
|
|
|
|
from mitterlib.ui.helpers import timesince |
|
|
|
from mitterlib.ui.helpers import timesince |
|
|
|
|
|
|
|
|
|
|
|
# Constants |
|
|
|
# Constants |
|
|
@ -183,75 +181,6 @@ class _ThreadManager(object): |
|
|
|
self._thread_id += 1 |
|
|
|
self._thread_id += 1 |
|
|
|
return |
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
|
|
|
|
# Custom cell renderer |
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
|
|
|
|
#class CellRendererNetworkData(gtk.GenericCellRenderer): |
|
|
|
|
|
|
|
# """A customized cell renderer for messages.""" |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# __gproperties__ = { |
|
|
|
|
|
|
|
# 'message': (gobject.TYPE_PYOBJECT, |
|
|
|
|
|
|
|
# 'message', |
|
|
|
|
|
|
|
# 'A NetworkData object to be rendered', |
|
|
|
|
|
|
|
# '', |
|
|
|
|
|
|
|
# gobject.PARAM_WRITABLE) |
|
|
|
|
|
|
|
# } |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# def __init__(self): |
|
|
|
|
|
|
|
# super(CellrendererNetworkData, self).__init__(self) |
|
|
|
|
|
|
|
# self.set_property('mode', gtk.CELL_RENDERER_MODE_ACTIVATABLE) |
|
|
|
|
|
|
|
# return |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# def on_render(self, window, widget, bg_area, cell_area, exp_area, flags): |
|
|
|
|
|
|
|
# """The render() method invokes the virtual render function of the |
|
|
|
|
|
|
|
# gtk.CellRenderer. The three passed-in rectangles are areas of window. |
|
|
|
|
|
|
|
# Most renderers will draw within cell_area; the xalign, yalign, xpad, |
|
|
|
|
|
|
|
# and ypad properties of the gtk.CellRenderer should be honored with |
|
|
|
|
|
|
|
# respect to cell_area. background_area includes the blank space around |
|
|
|
|
|
|
|
# the cell, and also the area containing the tree expander; so the |
|
|
|
|
|
|
|
# background_area rectangles for all cells tile to cover the entire |
|
|
|
|
|
|
|
# window. expose_area is a clip rectangle. |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# # The flags value is one of: gtk.CELL_RENDERER_SELECTED, |
|
|
|
|
|
|
|
# gtk.CELL_RENDERER_PRELIT, gtk.CELL_RENDERER_INSENSITIVE or |
|
|
|
|
|
|
|
# gtk.CELL_RENDERER_SORTED""" |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# layout = self.get_layout(widget) |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# if flags & gtk.CELL_RENDERER_SELECTED: |
|
|
|
|
|
|
|
# if widget.get_property('has-focus'): |
|
|
|
|
|
|
|
# state = gtk.STATE_SELECTED |
|
|
|
|
|
|
|
# else: |
|
|
|
|
|
|
|
# satte = gtk.STATE_ACTIVE |
|
|
|
|
|
|
|
# else: |
|
|
|
|
|
|
|
# state = gtk.STATE_NORMAL |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# widget.style.paint_layout( |
|
|
|
|
|
|
|
# window, |
|
|
|
|
|
|
|
# state, |
|
|
|
|
|
|
|
# True, |
|
|
|
|
|
|
|
# cell_area, |
|
|
|
|
|
|
|
# widget, |
|
|
|
|
|
|
|
# 'foo', |
|
|
|
|
|
|
|
# cell_area.x + x_offset, |
|
|
|
|
|
|
|
# cell_area.y + y_offset, |
|
|
|
|
|
|
|
# layout |
|
|
|
|
|
|
|
# ) |
|
|
|
|
|
|
|
# return |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
# def on_get_size(sel, widget, cell_area): |
|
|
|
|
|
|
|
# """The get_size() method obtains the width and height needed to render |
|
|
|
|
|
|
|
# the cell. These values are returned as part of a tuple containing the |
|
|
|
|
|
|
|
# x_offset, y_offset, width and height. get_size() is used by view |
|
|
|
|
|
|
|
# widgets to determine the appropriate size for the cell_area to be |
|
|
|
|
|
|
|
# passed to the gtk.CellRenderer.render() method. If cell_area is not |
|
|
|
|
|
|
|
# None, the x and y offsets of the cell relative to this location are |
|
|
|
|
|
|
|
# returned. Please note that the values set in the returned width and |
|
|
|
|
|
|
|
# height, as well as those in x_offset and y_offset are inclusive of the |
|
|
|
|
|
|
|
# xpad and ypad properties.""" |
|
|
|
|
|
|
|
# return (x_offset, y_offset, width, height) |
|
|
|
|
|
|
|
# |
|
|
|
|
|
|
|
#gobject.type_register(CellRendererNetworkData) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# ---------------------------------------------------------------------- |
|
|
|
# Mitter interface object |
|
|
|
# Mitter interface object |
|
|
@ -334,18 +263,7 @@ class Interface(object): |
|
|
|
message_column.set_cell_data_func(message_renderer, |
|
|
|
message_column.set_cell_data_func(message_renderer, |
|
|
|
self._cell_renderer_message) |
|
|
|
self._cell_renderer_message) |
|
|
|
|
|
|
|
|
|
|
|
#options_renderer = gtk.CellRendererPixbuf() |
|
|
|
|
|
|
|
#options_renderer.set_fixed_size(16, 16) |
|
|
|
|
|
|
|
#options_column = gtk.TreeViewColumn('Options', options_renderer) |
|
|
|
|
|
|
|
#options_column.set_cell_data_func(options_renderer, |
|
|
|
|
|
|
|
# self._cell_renderer_options) |
|
|
|
|
|
|
|
#options_column.set_fixed_width(16) # icon size |
|
|
|
|
|
|
|
#options_column.set_max_width(16) |
|
|
|
|
|
|
|
#options_column.set_expand(False) |
|
|
|
|
|
|
|
#options_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
self._grid.append_column(user_column) |
|
|
|
self._grid.append_column(user_column) |
|
|
|
#self._grid.append_column(options_column) |
|
|
|
|
|
|
|
self._grid.append_column(message_column) |
|
|
|
self._grid.append_column(message_column) |
|
|
|
|
|
|
|
|
|
|
|
self._grid.set_resize_mode(gtk.RESIZE_IMMEDIATE) |
|
|
|
self._grid.set_resize_mode(gtk.RESIZE_IMMEDIATE) |
|
|
@ -683,8 +601,9 @@ class Interface(object): |
|
|
|
path = model.get_path(iter) |
|
|
|
path = model.get_path(iter) |
|
|
|
|
|
|
|
|
|
|
|
cell_rectangle = self._grid.get_cell_area(path, column) |
|
|
|
cell_rectangle = self._grid.get_cell_area(path, column) |
|
|
|
#width = cell_rectangle.width |
|
|
|
|
|
|
|
width = win_width - 70 # 48 = icon size |
|
|
|
width = win_width - 70 # 48 = icon size |
|
|
|
|
|
|
|
# TODO: Find out where those 12 pixels came from and/or if they |
|
|
|
|
|
|
|
# are platform specific. |
|
|
|
|
|
|
|
|
|
|
|
for renderer in column.get_cell_renderers(): |
|
|
|
for renderer in column.get_cell_renderers(): |
|
|
|
renderer.set_property('wrap-width', width) |
|
|
|
renderer.set_property('wrap-width', width) |
|
|
|