diff options
author | Josh Blum | 2009-10-08 20:12:34 -0700 |
---|---|---|
committer | Josh Blum | 2009-10-08 20:12:34 -0700 |
commit | 23fa9183aca592865c0652f87709950af5ccd011 (patch) | |
tree | b51ea2896461b0d86ba266ce0c9a6ae674d6f592 /gr-wxgui/src/python | |
parent | dfa5e0a5bccb6b3539c1230281b5bec60196f8a2 (diff) | |
download | gnuradio-23fa9183aca592865c0652f87709950af5ccd011.tar.gz gnuradio-23fa9183aca592865c0652f87709950af5ccd011.tar.bz2 gnuradio-23fa9183aca592865c0652f87709950af5ccd011.zip |
point label transpareny, horizontal offset, and toggle on/off capability
Diffstat (limited to 'gr-wxgui/src/python')
-rw-r--r-- | gr-wxgui/src/python/plotter/common.py | 1 | ||||
-rw-r--r-- | gr-wxgui/src/python/plotter/grid_plotter_base.py | 11 |
2 files changed, 9 insertions, 3 deletions
diff --git a/gr-wxgui/src/python/plotter/common.py b/gr-wxgui/src/python/plotter/common.py index 7699986aa..4c50cd787 100644 --- a/gr-wxgui/src/python/plotter/common.py +++ b/gr-wxgui/src/python/plotter/common.py @@ -102,6 +102,7 @@ class point_label_thread(threading.Thread, mutex): #bind plotter mouse events self._plotter.Bind(wx.EVT_MOTION, lambda evt: self.enqueue(evt.GetPosition())) self._plotter.Bind(wx.EVT_LEAVE_WINDOW, lambda evt: self.enqueue(None)) + self._plotter.Bind(wx.EVT_RIGHT_DOWN, lambda evt: plotter.enable_point_label(not plotter.enable_point_label())) #start the thread threading.Thread.__init__(self) self.start() diff --git a/gr-wxgui/src/python/plotter/grid_plotter_base.py b/gr-wxgui/src/python/plotter/grid_plotter_base.py index 39bed1811..a9bd02731 100644 --- a/gr-wxgui/src/python/plotter/grid_plotter_base.py +++ b/gr-wxgui/src/python/plotter/grid_plotter_base.py @@ -36,8 +36,9 @@ AXIS_LABEL_PADDING = 5 TICK_LABEL_PADDING = 5 TITLE_LABEL_PADDING = 7 POINT_LABEL_FONT_SIZE = 8 -POINT_LABEL_COLOR_SPEC = (1, 1, .5) +POINT_LABEL_COLOR_SPEC = (1, 1, 0.5, 0.75) POINT_LABEL_PADDING = 3 +POINT_LABEL_OFFSET = 10 GRID_LINE_DASH_LEN = 4 ################################################## @@ -395,8 +396,12 @@ class grid_plotter_base(plotter_base): if not label_str: return txt = gltext.Text(label_str, font_size=POINT_LABEL_FONT_SIZE) w, h = txt.get_size() + #enable transparency + GL.glEnable(GL.GL_BLEND) + GL.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA) #draw rect + text - GL.glColor3f(*POINT_LABEL_COLOR_SPEC) - if x > self.width/2: x -= w+2*POINT_LABEL_PADDING + GL.glColor4f(*POINT_LABEL_COLOR_SPEC) + if x > self.width/2: x -= w+2*POINT_LABEL_PADDING + POINT_LABEL_OFFSET + else: x += POINT_LABEL_OFFSET self._draw_rect(x, y-h-2*POINT_LABEL_PADDING, w+2*POINT_LABEL_PADDING, h+2*POINT_LABEL_PADDING) txt.draw_text(wx.Point(x+POINT_LABEL_PADDING, y-h-POINT_LABEL_PADDING)) |