columns: auto size time column when setting base time

Base time formatting adds + or - in front of the timestamp, so the column has
to grow a little to not hide the last digit.

Also fixes a crash when setting the base time while the time column is hidden.
This commit is contained in:
René Stadler 2011-11-06 13:35:26 +01:00 committed by Stefan Sauer
parent 265cc8afdf
commit ca9a31ddd9
2 changed files with 11 additions and 2 deletions

View file

@ -457,6 +457,16 @@ class ColumnManager (Common.GUI.Manager):
self.zoom = scale self.zoom = scale
def set_base_time (self, base_time):
try:
time_column = self.find_item (name = TimeColumn.name)
except KeyError:
return
time_column.set_base_time (base_time)
self.size_column (time_column)
def get_toggle_action (self, column_class): def get_toggle_action (self, column_class):
action_name = "show-%s-column" % (column_class.name,) action_name = "show-%s-column" % (column_class.name,)

View file

@ -674,8 +674,7 @@ class Window (object):
def handle_set_base_time_action_activate (self, action): def handle_set_base_time_action_activate (self, action):
row = self.get_active_line () row = self.get_active_line ()
time_column = self.column_manager.find_item (name = "time") self.column_manager.set_base_time (row[LogModelBase.COL_TIME])
time_column.set_base_time (row[LogModelBase.COL_TIME])
def handle_hide_log_level_action_activate (self, action): def handle_hide_log_level_action_activate (self, action):