commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r9252 - in gnuradio/branches/developers/jblum/glwxgui/


From: jblum
Subject: [Commit-gnuradio] r9252 - in gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python: . plotter
Date: Tue, 12 Aug 2008 11:13:02 -0600 (MDT)

Author: jblum
Date: 2008-08-12 11:13:02 -0600 (Tue, 12 Aug 2008)
New Revision: 9252

Modified:
   
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
   
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
   
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
   
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfall_window.py
   
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfallsink_gl.py
Log:
scope self test, timescale fix

Modified: 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
===================================================================
--- 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
      2008-08-12 17:01:37 UTC (rev 9251)
+++ 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/plotter/plotter_base.py
      2008-08-12 17:13:02 UTC (rev 9252)
@@ -31,6 +31,7 @@
 TICK_TEXT_FONT_SIZE = 9
 TITLE_TEXT_FONT_SIZE = 13
 UNITS_TEXT_FONT_SIZE = 9
+TICK_LABEL_PADDING = 5
 
 ##################################################
 # OpenGL WX Plotter Canvas
@@ -210,7 +211,9 @@
                                (scaled_tick, self.padding_top, 0),
                                (scaled_tick, self.height-self.padding_bottom, 
0),
                        )
-                       self._draw_tick_label(tick, (scaled_tick, 
self.height-.75*self.padding_bottom))
+                       txt = self._get_tick_label(tick)
+                       w, h = txt.get_size()
+                       txt.draw_text(wx.Point(scaled_tick-w/2, 
self.height-self.padding_bottom+TICK_LABEL_PADDING))
                ##################################################
                # Draw Grid Y
                ##################################################
@@ -222,7 +225,9 @@
                                (self.padding_left, scaled_tick, 0),
                                (self.width-self.padding_right, scaled_tick, 0),
                        )
-                       self._draw_tick_label(tick, (.75*self.padding_left, 
scaled_tick))
+                       txt = self._get_tick_label(tick)
+                       w, h = txt.get_size()
+                       
txt.draw_text(wx.Point(self.padding_left-w-TICK_LABEL_PADDING, scaled_tick-h/2))
                ##################################################
                # Draw Title
                ##################################################
@@ -249,12 +254,12 @@
                        ), rotation=90,
                )
 
-       def _draw_tick_label(self, tick, coor):
+       def _get_tick_label(self, tick):
                """!
-               Format the tick value and draw it at the coordinate.
+               Format the tick value greate a gl text.
                Intelligently switch between decimal representations.
                @param tick the floating point tick value
-               @param coor the x, y coordinate
+               @return the tick label text
                """
                #format
                if tick == 0: exp = 0
@@ -263,12 +268,11 @@
                exp_dif = exp - exp_mod
                base = tick/10**exp_dif
                if abs(exp) >= 3:
-                       formatter = '%%.%df'%(2-exp_mod)
+                       formatter = '%%.%dg'%(2-exp_mod)
                        tick_str = '%se%d'%(formatter%base, exp_dif)
                else: tick_str = '%g'%tick
-               #draw
-               txt = gltext.Text(tick_str, font_size=TICK_TEXT_FONT_SIZE, 
centered=True)
-               txt.draw_text(wx.Point(*coor))
+               #text
+               return gltext.Text(tick_str, font_size=TICK_TEXT_FONT_SIZE)
 
        def _get_ticks(self, min, max, step, scalar):
                """!

Modified: 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py  
    2008-08-12 17:01:37 UTC (rev 9251)
+++ 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scope_window.py  
    2008-08-12 17:13:02 UTC (rev 9252)
@@ -218,7 +218,7 @@
                self._register_set_prop(self, X_DIVS_KEY, 8)
                self._register_set_prop(self, Y_DIVS_KEY, 8)
                self._register_set_prop(self, FRAME_RATE_KEY, frame_rate)
-               self._register_set_prop(self, TRIGGER_CHANNEL_KEY, 1)
+               self._register_set_prop(self, TRIGGER_CHANNEL_KEY, 0)
                self._register_set_prop(self, TRIGGER_MODE_KEY, 1)
                self._register_set_prop(self, TRIGGER_LEVEL_KEY, None)
                #register events

Modified: 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py  
    2008-08-12 17:01:37 UTC (rev 9251)
+++ 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/scopesink_gl.py  
    2008-08-12 17:13:02 UTC (rev 9252)
@@ -122,3 +122,56 @@
 class scope_sink_c(_scope_sink_base):
        _item_size = gr.sizeof_gr_complex
        _real = False
+
+# ----------------------------------------------------------------
+# Stand-alone test application
+# ----------------------------------------------------------------
+
+import wx
+from gnuradio.wxgui import stdgui2
+
+class test_top_block (stdgui2.std_top_block):
+    def __init__(self, frame, panel, vbox, argv):
+        stdgui2.std_top_block.__init__ (self, frame, panel, vbox, argv)
+
+        if len(argv) > 1:
+            frame_decim = int(argv[1]) 
+        else:
+            frame_decim = 1
+
+        if len(argv) > 2:
+            v_scale = float(argv[2])  # start up at this v_scale value
+        else:
+            v_scale = None  # start up in autorange mode, default
+
+        if len(argv) > 3:
+            t_scale = float(argv[3])  # start up at this t_scale value
+        else:
+            t_scale = None  # old behavior
+
+        print "frame decim %s  v_scale %s  t_scale %s" % 
(frame_decim,v_scale,t_scale)
+            
+        input_rate = 1e6
+
+        # Generate a complex sinusoid
+        self.src0 = gr.sig_source_c (input_rate, gr.GR_SIN_WAVE, 25.1e3, 1e3)
+
+        # We add this throttle block so that this demo doesn't suck down
+        # all the CPU available.  You normally wouldn't use it...
+        self.thr = gr.throttle(gr.sizeof_gr_complex, input_rate)
+
+        scope = scope_sink_c (panel,"Secret Data",sample_rate=input_rate,
+                              frame_decim=frame_decim,
+                              v_scale=v_scale, t_scale=t_scale)
+        vbox.Add (scope.win, 1, wx.EXPAND)
+
+        # Ultimately this will be
+        # self.connect("src0 throttle scope")
+       self.connect(self.src0, self.thr, scope) 
+
+def main ():
+    app = stdgui2.stdapp (test_top_block, "O'Scope Test App")
+    app.MainLoop ()
+
+if __name__ == '__main__':
+    main ()

Modified: 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfall_window.py
===================================================================
--- 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfall_window.py
  2008-08-12 17:01:37 UTC (rev 9251)
+++ 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfall_window.py
  2008-08-12 17:13:02 UTC (rev 9252)
@@ -97,8 +97,8 @@
                control_box.AddStretchSpacer()
                control_box.Add(common.LabelText(self, 'Set Time Scale'), 0, 
wx.ALIGN_CENTER)
                control_box.AddSpacer(2)
-               self._num_lines_buttons = common.IncrDecrButtons(self, 
self._on_incr_num_lines, self._on_decr_num_lines)
-               control_box.Add(self._num_lines_buttons, 0, wx.ALIGN_CENTER)
+               self._time_scale_buttons = common.IncrDecrButtons(self, 
self._on_incr_time_scale, self._on_decr_time_scale)
+               control_box.Add(self._time_scale_buttons, 0, wx.ALIGN_CENTER)
                #autoscale
                control_box.AddStretchSpacer()
                self.autoscale_button = wx.Button(self, label='Autoscale', 
style=wx.BU_EXACTFIT)
@@ -131,10 +131,16 @@
        def _on_decr_ref_level(self, event):
                self.parent.set_ref_level(
                        self.parent[REF_LEVEL_KEY] - 
self.parent[DYNAMIC_RANGE_KEY]*.1)
-       def _on_incr_num_lines(self, event):
-               self.parent.ext_controller[self.parent.decimation_key] += 1
-       def _on_decr_num_lines(self, event):
-               self.parent.ext_controller[self.parent.decimation_key] -= 1
+       def _on_incr_time_scale(self, event):
+               old_rate = 
self.parent.ext_controller[self.parent.frame_rate_key]
+               self.parent.ext_controller[self.parent.frame_rate_key] *= 0.75
+               if self.parent.ext_controller[self.parent.frame_rate_key] == 
old_rate:
+                       self.parent.ext_controller[self.parent.decimation_key] 
+= 1
+       def _on_decr_time_scale(self, event):
+               old_rate = 
self.parent.ext_controller[self.parent.frame_rate_key]
+               self.parent.ext_controller[self.parent.frame_rate_key] *= 1.25
+               if self.parent.ext_controller[self.parent.frame_rate_key] == 
old_rate:
+                       self.parent.ext_controller[self.parent.decimation_key] 
-= 1
 
 ##################################################
 # Waterfall window with plotter and control panel

Modified: 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfallsink_gl.py
===================================================================
--- 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfallsink_gl.py
  2008-08-12 17:01:37 UTC (rev 9251)
+++ 
gnuradio/branches/developers/jblum/glwxgui/gr-wxgui/src/python/waterfallsink_gl.py
  2008-08-12 17:13:02 UTC (rev 9252)
@@ -85,6 +85,7 @@
                self.controller.publish(SAMPLE_RATE_KEY, fft.sample_rate)
                self.controller.subscribe(DECIMATION_KEY, fft.set_decimation)
                self.controller.publish(DECIMATION_KEY, fft.decimation)
+               self.controller.subscribe(FRAME_RATE_KEY, fft._sd.set_vec_rate)
                self.controller.publish(FRAME_RATE_KEY, fft.frame_rate)
                #start input watcher
                def setter(p, k, x): # lambdas can't have assignments :(





reply via email to

[Prev in Thread] Current Thread [Next in Thread]