From a073b11f635f863d3c4cc5c34b841d5d92d4985d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ren=C3=A9=20Stadler?= Date: Fri, 7 Dec 2007 14:10:03 +0200 Subject: [PATCH] Cleanup timeline warning/error triangle drawing, add TODOs --- debug-viewer/GstDebugViewer/Plugins/Timeline.py | 37 +++++++++++++++++++------ 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/debug-viewer/GstDebugViewer/Plugins/Timeline.py b/debug-viewer/GstDebugViewer/Plugins/Timeline.py index 5676ca7..5a437db 100644 --- a/debug-viewer/GstDebugViewer/Plugins/Timeline.py +++ b/debug-viewer/GstDebugViewer/Plugins/Timeline.py @@ -524,16 +524,19 @@ class TimelineWidget (gtk.DrawingArea): # Draw error and warning triangle indicators: + def triangle (ctx, size = 8): + ctx.move_to (-size // 2, 0) + ctx.line_to ((size + 1) // 2, 0) + ctx.line_to (0, size / 1.41) + ctx.close_path () + for level in (Data.debug_level_warning, Data.debug_level_error,): ctx.set_source_rgb (*(theme.colors_float (level)[1])) for i, counts in enumerate (dist_data): if counts[level] == 0: continue - SIZE = 8 - ctx.move_to (i - SIZE // 2, 0) - ctx.line_to (i + SIZE // 2, 0) - ctx.line_to (i, SIZE / 1.41) - ctx.close_path () + ctx.translate (i, 0) + triangle (ctx) ctx.fill () def __draw_graph (self, ctx, w, h, maximum, data): @@ -809,18 +812,34 @@ class TimelineFeature (FeatureBase): if event.button != 1: return True + # TODO: Check if clicked inside a warning/error indicator triangle and + # navigate there. + pos = int (event.x) self.goto_time_position (pos) return False def handle_timeline_motion_notify_event (self, widget, event): - if not event.state & gtk.gdk.BUTTON1_MASK: + x = event.x + y = event.y + + if event.state & gtk.gdk.BUTTON1_MASK: + self.handle_timeline_motion_button1 (x, y) return True + else: + self.handle_timeline_motion (x, y) + return False - pos = int (event.x) - self.goto_time_position (pos) - return False + def handle_timeline_motion (self, x, y): + + # TODO: Prelight warning and error indicator triangles. + + pass + + def handle_timeline_motion_button1 (self, x, y): + + self.goto_time_position (int (x)) def goto_time_position (self, pos): -- 2.7.4