Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Berg <benjamin@sipsolutions.net>2009-10-05 11:38:05 (GMT)
committer Benjamin Berg <benjamin@sipsolutions.net>2009-10-05 11:38:05 (GMT)
commitb5a651efd0856a7f7c0268bd49817f668a1a64f8 (patch)
tree4f9763741f65fee36f63f32787d270721e277fdd
parenta76fc1be5521c5f02c672c7b6774bda50aaef162 (diff)
Center the background lines over the height.
-rw-r--r--drawwaveform.py10
1 files changed, 6 insertions, 4 deletions
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