From b5a651efd0856a7f7c0268bd49817f668a1a64f8 Mon Sep 17 00:00:00 2001 From: Benjamin Berg Date: Mon, 05 Oct 2009 11:38:05 +0000 Subject: Center the background lines over the height. --- diff --git a/drawwaveform.py b/drawwaveform.py index 6d0a784..2b27c96 100644 --- a/drawwaveform.py +++ b/drawwaveform.py @@ -234,6 +234,8 @@ class DrawWaveform(gtk.DrawingArea): def do_size_allocate(self, allocation): gtk.DrawingArea.do_size_allocate(self, allocation) self._update_mode() + if self.window is not None: + self._create_background_pixmap() def _indirect_queue_draw(self): if self.window == None: @@ -272,10 +274,10 @@ class DrawWaveform(gtk.DrawingArea): self._trigger_line_gc.set_foreground(clr) + self._create_background_pixmap() + def _create_background_pixmap(self): # Background pixmap - clr = colormap.alloc_color(0, 65535, 0, False, False) - back_surf = gdk.Pixmap(self.window, self._tick_size, self._tick_size) cr = back_surf.cairo_create() @@ -296,9 +298,9 @@ class DrawWaveform(gtk.DrawingArea): x = x + self._tick_size x = 0 - y = 0 + y = (self.allocation.height % self._tick_size) / 2 - self._tick_size - for j in range(0, 2): + for j in range(0, 3): cr.move_to(x, y) cr.rel_line_to(self._tick_size, 0) y = y + self._tick_size -- cgit v0.9.1