From cda1eb013192f90e7fb11da28d8e11ec2053b65c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Stadler?= Date: Thu, 22 Nov 2007 10:29:23 +0200 Subject: [PATCH] Display timeline by default --- debug-viewer/GstDebugViewer/GUI.py | 7 +++++ .../GstDebugViewer/Plugins/Timeline.py | 26 ++++++++++++++----- .../GstDebugViewer/Plugins/__init__.py | 4 +++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/debug-viewer/GstDebugViewer/GUI.py b/debug-viewer/GstDebugViewer/GUI.py index dc6ab21a76..780fc331d4 100755 --- a/debug-viewer/GstDebugViewer/GUI.py +++ b/debug-viewer/GstDebugViewer/GUI.py @@ -1040,6 +1040,7 @@ class Window (object): self.dispatcher.cancel () self.dispatcher = None self.log_file = None + self.have_log_file_changed () else: self.logger.debug ("setting log file %r", filename) @@ -1048,6 +1049,11 @@ class Window (object): self.log_file.consumers.append (self) self.log_file.start_loading () + def have_log_file_changed (self): + + for feature in self.features: + feature.handle_log_file_changed () + def handle_log_view_button_press_event (self, view, event): if event.button != 3: @@ -1110,6 +1116,7 @@ class Window (object): def idle_set (): ##self.log_view.props.model = self.log_model self.log_view.props.model = self.log_filter + self.have_log_file_changed () return False gobject.idle_add (idle_set) diff --git a/debug-viewer/GstDebugViewer/Plugins/Timeline.py b/debug-viewer/GstDebugViewer/Plugins/Timeline.py index 39b107d33e..71e1379949 100644 --- a/debug-viewer/GstDebugViewer/Plugins/Timeline.py +++ b/debug-viewer/GstDebugViewer/Plugins/Timeline.py @@ -268,6 +268,16 @@ class TimelineWidget (gtk.DrawingArea): gc = gtk.gdk.GC (self.window) self.window.draw_drawable (gc, self.__offscreen, 0, 0, 0, 0, -1, -1) + def update (self): + + width = self.get_allocation ()[2] + + self.process.abort () + self.freq_sentinel.clear () + self.dist_sentinel.clear () + self.freq_sentinel.run_for (width) + self.process.run () + def update_position (self, start_ts, end_ts): if not self.freq_sentinel.data: @@ -411,11 +421,7 @@ class TimelineWidget (gtk.DrawingArea): if event.width < 16: return False - self.process.abort () - self.freq_sentinel.clear () - self.dist_sentinel.clear () - self.freq_sentinel.run_for (event.width) - self.process.run () + self.update () return False @@ -432,7 +438,7 @@ class TimelineFeature (FeatureBase): self.action_group = gtk.ActionGroup ("TimelineActions") self.action_group.add_toggle_actions ([("show-timeline", - None, _("_Timeline"))]) + None, _("_Timeline"),)]) def attach (self, window): @@ -462,7 +468,9 @@ class TimelineFeature (FeatureBase): self.handle_log_view_adjustment_value_changed) handler = self.handle_show_action_toggled - self.action_group.get_action ("show-timeline").connect ("toggled", handler) + action = self.action_group.get_action ("show-timeline") + action.connect ("toggled", handler) + action.activate () def detach (self, window): @@ -474,6 +482,10 @@ class TimelineFeature (FeatureBase): self.timeline.destroy () self.timeline = None + def handle_log_file_changed (self): + + self.timeline.update () + def handle_log_view_adjustment_value_changed (self, adj): # FIXME: If not visible, disconnect this handler! diff --git a/debug-viewer/GstDebugViewer/Plugins/__init__.py b/debug-viewer/GstDebugViewer/Plugins/__init__.py index 1429e7b869..7c370ccc3b 100644 --- a/debug-viewer/GstDebugViewer/Plugins/__init__.py +++ b/debug-viewer/GstDebugViewer/Plugins/__init__.py @@ -29,6 +29,10 @@ class FeatureBase (object): state_section_name = None + def handle_log_file_changed (self): + + pass + def register_lazy_sentinel (self, sentinel): pass