Add zoom in/out actions, reduce vertical row padding

Add two actions to shrink and enlarge the text in the log pane. Add a theme
overide to set expander size to 1 (see bug #615985) and also turn focus lines
off. Remove extra ypadding on cells.
This commit is contained in:
Stefan Kost 2010-04-16 18:26:26 +03:00 committed by Stefan Sauer
parent 17894c705b
commit aa9db8ef8e
4 changed files with 38 additions and 2 deletions

View file

@ -81,6 +81,19 @@ class App (object):
self.windows = [] self.windows = []
# we override expander size because of:
# https://bugzilla.gnome.org/show_bug.cgi?id=615985
rcstring = """
style "no-expander-treeview-style" {
GtkTreeView::expander_size = 1
#GtkTreeView::vertical-separator = 0
GtkWidget::focus-line-width = 0
}
widget "*.log_view" style "no-expander-treeview-style"
"""
gtk.rc_parse_string (rcstring)
self.open_window () self.open_window ()
def detach (self): def detach (self):

View file

@ -72,6 +72,7 @@ class TextColumn (SizedColumn):
column.pack_start (cell) column.pack_start (cell)
cell.props.yalign = 0. cell.props.yalign = 0.
cell.props.ypad = 0
if self.font_family: if self.font_family:
cell.props.family = self.font_family cell.props.family = self.font_family

View file

@ -215,7 +215,9 @@ class Window (object):
("close-window", gtk.STOCK_CLOSE, _("Close _Window"), "<Ctrl>W"), ("close-window", gtk.STOCK_CLOSE, _("Close _Window"), "<Ctrl>W"),
("cancel-load", gtk.STOCK_CANCEL, None,), ("cancel-load", gtk.STOCK_CANCEL, None,),
("clear-line-view", gtk.STOCK_CLEAR, None), ("clear-line-view", gtk.STOCK_CLEAR, None),
("show-about", gtk.STOCK_ABOUT, None)]) ("show-about", gtk.STOCK_ABOUT, None),
("enlarge-text", gtk.STOCK_ZOOM_IN, _("Enlarge Text"), "<Ctrl>plus"),
("shrink-text", gtk.STOCK_ZOOM_OUT, _("Shrink Text"), "<Ctrl>minus")])
self.actions.add_group (group) self.actions.add_group (group)
self.actions.reload_file.props.sensitive = False self.actions.reload_file.props.sensitive = False
@ -295,7 +297,7 @@ class Window (object):
"hide-before-line", "hide-after-line", "show-hidden-lines", "hide-before-line", "hide-after-line", "show-hidden-lines",
"edit-copy-line", "edit-copy-message", "set-base-time", "edit-copy-line", "edit-copy-message", "set-base-time",
"hide-log-level", "hide-log-category", "hide-log-object", "hide-log-level", "hide-log-category", "hide-log-object",
"hide-filename", "show-about",): "hide-filename", "show-about", "enlarge-text", "shrink-text"):
name = action_name.replace ("-", "_") name = action_name.replace ("-", "_")
action = getattr (self.actions, name) action = getattr (self.actions, name)
handler = getattr (self, "handle_%s_action_activate" % (name,)) handler = getattr (self, "handle_%s_action_activate" % (name,))
@ -574,6 +576,20 @@ class Window (object):
col_id = LogModelBase.COL_MESSAGE col_id = LogModelBase.COL_MESSAGE
self.clipboard.set_text (self.get_active_line ()[col_id]) self.clipboard.set_text (self.get_active_line ()[col_id])
def handle_enlarge_text_action_activate (self, action):
for col in self.column_manager.columns:
cell = col.view_column.get_cell_renderers ()[0]
cell.props.scale *= 1.15
col.view_column.queue_resize ()
self.widgets.log_view_scrolled_window.props.vadjustment.emit ("value-changed")
def handle_shrink_text_action_activate (self, action):
for col in self.column_manager.columns:
cell = col.view_column.get_cell_renderers ()[0]
cell.props.scale /= 1.15
col.view_column.queue_resize ()
self.widgets.log_view_scrolled_window.props.vadjustment.emit ("value-changed")
def add_model_filter (self, filter): def add_model_filter (self, filter):
self.progress_dialog = ProgressDialog (self, _("Filtering")) self.progress_dialog = ProgressDialog (self, _("Filtering"))

View file

@ -34,6 +34,9 @@
<separator/> <separator/>
<menuitem name="ViewContextMenuCopyMessage" action="edit-copy-message"/> <menuitem name="ViewContextMenuCopyMessage" action="edit-copy-message"/>
<menuitem name="ViewContextMenuCopyLine" action="edit-copy-line"/> <menuitem name="ViewContextMenuCopyLine" action="edit-copy-line"/>
<separator/>
<menuitem name="ZoomInMessage" action="enlarge-text"/>
<menuitem name="ZoomOutMessage" action="shrink-text"/>
</menu> </menu>
<menu name="HelpMenu" action="HelpMenuAction"> <menu name="HelpMenu" action="HelpMenuAction">
<placeholder name="HelpMenuAdditions"/> <placeholder name="HelpMenuAdditions"/>
@ -66,6 +69,9 @@
<separator/> <separator/>
<menuitem name="ViewContextMenuCopyMessage" action="edit-copy-message"/> <menuitem name="ViewContextMenuCopyMessage" action="edit-copy-message"/>
<menuitem name="ViewContextMenuCopyLine" action="edit-copy-line"/> <menuitem name="ViewContextMenuCopyLine" action="edit-copy-line"/>
<separator/>
<menuitem name="ZoomInMessage" action="enlarge-text"/>
<menuitem name="ZoomOutMessage" action="shrink-text"/>
</menu> </menu>
<menu name="LineViewContextMenu" action="LineViewContextMenuAction"> <menu name="LineViewContextMenu" action="LineViewContextMenuAction">
<menuitem name="LineViewContextMenuClear" action="clear-line-view"/> <menuitem name="LineViewContextMenuClear" action="clear-line-view"/>