Browse Source

Finally, showing something. Time to work on toolbars and menus.

master
Julio Biason 15 years ago
parent
commit
7343688b2e
  1. 32
      mitterlib/ui/ui_pygtk.py

32
mitterlib/ui/ui_pygtk.py

@ -334,18 +334,18 @@ 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 = gtk.CellRendererPixbuf()
options_renderer.set_fixed_size(16, 16) #options_renderer.set_fixed_size(16, 16)
options_column = gtk.TreeViewColumn('Options', options_renderer) #options_column = gtk.TreeViewColumn('Options', options_renderer)
options_column.set_cell_data_func(options_renderer, #options_column.set_cell_data_func(options_renderer,
self._cell_renderer_options) # self._cell_renderer_options)
#options_column.set_fixed_width(16) # icon size #options_column.set_fixed_width(16) # icon size
#options_column.set_max_width(16) #options_column.set_max_width(16)
#options_column.set_expand(False) #options_column.set_expand(False)
#options_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) #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(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)
@ -578,7 +578,7 @@ class Interface(object):
# unescape escaped entities that pango is not okay with # unescape escaped entities that pango is not okay with
message = re.sub(r'&', r'&', message) message = re.sub(r'&', r'&', message)
_log.debug('Rendering message: %s', message) #_log.debug('Rendering message: %s', message)
# highlight URLs # highlight URLs
mask = r'<span foreground="%s">\1</span>' % ( mask = r'<span foreground="%s">\1</span>' % (
@ -586,6 +586,7 @@ class Interface(object):
message = URL_RE.sub(mask, message) message = URL_RE.sub(mask, message)
# use a different highlight for the current user # use a different highlight for the current user
# TODO: How to handle this with several networks?
#message = re.sub(r'(@'+self.twitter.username+')', #message = re.sub(r'(@'+self.twitter.username+')',
# r'<span foreground="#FF6633">\1</span>', # r'<span foreground="#FF6633">\1</span>',
# message) # message)
@ -664,7 +665,7 @@ class Interface(object):
gtk.main_quit() gtk.main_quit()
return return
def _grid_resize(self, widget, allocation, data=None): def _grid_resize(self, widget, requisition, data=None):
"""Called when the window is resized. We use it to set the proper """Called when the window is resized. We use it to set the proper
word-wrapping in the message column.""" word-wrapping in the message column."""
@ -674,24 +675,19 @@ class Interface(object):
# wrapping # wrapping
return return
_log.debug('Widget size: %d', allocation.width) (win_width, win_height) = self._main_window.get_size()
#_log.debug('Widget size: %d', win_width)
column = self._grid.get_column(2) column = self._grid.get_column(1)
iter = model.get_iter_first() iter = model.get_iter_first()
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)
# x_padding #width = cell_rectangle.width
width = win_width - 70 # 48 = icon size
# focus-line-width
focus_line_width = self._grid.style_get_property('focus-line-width')
#rectangle_width = column_rectangle.width
width = cell_rectangle.width - focus_line_width
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)
renderer.set_property('width', width)
while iter: while iter:
path = model.get_path(iter) path = model.get_path(iter)

Loading…
Cancel
Save