From ca9a31ddd90915bff853e8084105a60808dd77e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Sun, 6 Nov 2011 13:35:26 +0100 Subject: [PATCH] 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. --- debug-viewer/GstDebugViewer/GUI/columns.py | 10 ++++++++++ debug-viewer/GstDebugViewer/GUI/window.py | 3 +-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/debug-viewer/GstDebugViewer/GUI/columns.py b/debug-viewer/GstDebugViewer/GUI/columns.py index f0f7f3c274..96ea98cdc2 100644 --- a/debug-viewer/GstDebugViewer/GUI/columns.py +++ b/debug-viewer/GstDebugViewer/GUI/columns.py @@ -457,6 +457,16 @@ class ColumnManager (Common.GUI.Manager): 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): action_name = "show-%s-column" % (column_class.name,) diff --git a/debug-viewer/GstDebugViewer/GUI/window.py b/debug-viewer/GstDebugViewer/GUI/window.py index 6372492099..2a82aa928f 100644 --- a/debug-viewer/GstDebugViewer/GUI/window.py +++ b/debug-viewer/GstDebugViewer/GUI/window.py @@ -674,8 +674,7 @@ class Window (object): def handle_set_base_time_action_activate (self, action): row = self.get_active_line () - time_column = self.column_manager.find_item (name = "time") - time_column.set_base_time (row[LogModelBase.COL_TIME]) + self.column_manager.set_base_time (row[LogModelBase.COL_TIME]) def handle_hide_log_level_action_activate (self, action):