diff options
Diffstat (limited to 'GstDebugViewer/GUI')
-rw-r--r-- | GstDebugViewer/GUI/columns.py | 50 | ||||
-rw-r--r-- | GstDebugViewer/GUI/window.py | 9 |
2 files changed, 45 insertions, 14 deletions
diff --git a/GstDebugViewer/GUI/columns.py b/GstDebugViewer/GUI/columns.py index 522285d..29f37d7 100644 --- a/GstDebugViewer/GUI/columns.py +++ b/GstDebugViewer/GUI/columns.py @@ -96,14 +96,18 @@ class TextColumn (SizedColumn): elif not self.get_modify_func: column.add_attribute (cell, "text", self.id) else: - modify_func = self.get_modify_func () - id_ = self.id - def cell_data_func (column, cell, model, tree_iter): - cell.props.text = modify_func (model.get (tree_iter, id_)[0]) - column.set_cell_data_func (cell, cell_data_func) + self.update_modify_func (column, cell) column.props.resizable = True + def update_modify_func (self, column, cell): + + modify_func = self.get_modify_func () + id_ = self.id + def cell_data_func (column, cell, model, tree_iter): + cell.props.text = modify_func (model.get (tree_iter, id_)[0]) + column.set_cell_data_func (cell, cell_data_func) + def compute_default_size (self, view, model): values = self.get_values_for_size () @@ -137,15 +141,27 @@ class TimeColumn (TextColumn): id = LazyLogModel.COL_TIME font_family = "monospace" - @staticmethod - def get_modify_func (): + def __init__ (self, *a, **kw): - time_args = Data.time_args - def format_time (value): - # TODO: This is hard coded to omit hours as well as the last 3 - # digits at the end, since current gst uses g_get_current_time, - # which has microsecond precision only. - return time_args (value)[2:-3] + self.base_time = 0 + + TextColumn.__init__ (self, *a, **kw) + + def get_modify_func (self): + + if self.base_time: + time_diff_args = Data.time_diff_args + base_time = self.base_time + def format_time (value): + # TODO: Hard coded to omit trailing zeroes, see below. + return time_diff_args (value - base_time)[:-3] + else: + time_args = Data.time_args + def format_time (value): + # TODO: This is hard coded to omit hours as well as the last 3 + # digits at the end, since current gst uses g_get_current_time, + # which has microsecond precision only. + return time_args (value)[2:-3] return format_time @@ -155,6 +171,14 @@ class TimeColumn (TextColumn): return values + def set_base_time (self, base_time): + + self.base_time = base_time + + column = self.view_column + cell = column.get_cell_renderers ()[0] + self.update_modify_func (column, cell) + class LevelColumn (TextColumn): name = "level" diff --git a/GstDebugViewer/GUI/window.py b/GstDebugViewer/GUI/window.py index b8320d9..9291d84 100644 --- a/GstDebugViewer/GUI/window.py +++ b/GstDebugViewer/GUI/window.py @@ -225,6 +225,7 @@ class Window (object): ("show-hidden-lines", None, _("Show hidden lines")), ("edit-copy-line", gtk.STOCK_COPY, _("Copy line"), "<Ctrl>C"), ("edit-copy-message", gtk.STOCK_COPY, _("Copy message"), ""), + ("set-base-time", None, _("Set base time")), ("hide-log-level", None, _("Hide log level")), ("hide-log-category", None, _("Hide log category")), ("hide-log-object", None, _("Hide object")), @@ -292,7 +293,7 @@ class Window (object): for action_name in ("new-window", "open-file", "reload-file", "close-window", "cancel-load", "hide-before-line", "hide-after-line", "show-hidden-lines", - "edit-copy-line", "edit-copy-message", + "edit-copy-line", "edit-copy-message", "set-base-time", "hide-log-level", "hide-log-category", "hide-log-object", "hide-filename", "show-about",): name = action_name.replace ("-", "_") @@ -627,6 +628,12 @@ class Window (object): self.actions.show_hidden_lines.props.sensitive = True + 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]) + def handle_hide_log_level_action_activate (self, action): row = self.get_active_line () |