[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] r8443 - in grc/trunk/src/grc_gnuradio: blks2 data
From: |
jblum |
Subject: |
[Commit-gnuradio] r8443 - in grc/trunk/src/grc_gnuradio: blks2 data |
Date: |
Mon, 19 May 2008 01:10:32 -0600 (MDT) |
Author: jblum
Date: 2008-05-19 01:10:32 -0600 (Mon, 19 May 2008)
New Revision: 8443
Modified:
grc/trunk/src/grc_gnuradio/blks2/packet.py
grc/trunk/src/grc_gnuradio/data/no_gui.tmpl
grc/trunk/src/grc_gnuradio/data/wx_gui.tmpl
Log:
cleaned callback/control generation in template
Modified: grc/trunk/src/grc_gnuradio/blks2/packet.py
===================================================================
--- grc/trunk/src/grc_gnuradio/blks2/packet.py 2008-05-19 03:01:08 UTC (rev
8442)
+++ grc/trunk/src/grc_gnuradio/blks2/packet.py 2008-05-19 07:10:32 UTC (rev
8443)
@@ -104,9 +104,9 @@
self.connect(self, msg_sink)
self.connect(msg_source, self)
#start thread
- _packet_encoder_thread(self._msgq_in, self._payload_length,
self.send_pkt)
+ _packet_encoder_thread(self._msgq_in, self._payload_length,
self._send_packet)
- def send_pkt(self, payload):
+ def _send_packet(self, payload):
"""!
Wrap the payload in a packet and push onto the message queue.
@param payload string, data to send
Modified: grc/trunk/src/grc_gnuradio/data/no_gui.tmpl
===================================================================
--- grc/trunk/src/grc_gnuradio/data/no_gui.tmpl 2008-05-19 03:01:08 UTC (rev
8442)
+++ grc/trunk/src/grc_gnuradio/data/no_gui.tmpl 2008-05-19 07:10:32 UTC (rev
8443)
@@ -9,13 +9,13 @@
address@hidden connections the connections
########################################################
#import time
-$('#'*40)
+$('#'*50)
# Gnuradio Python Flow Graph (no gui)
$('# Title: %s'%$flow_graph.get_option('title'))
$('# Author: %s'%$flow_graph.get_option('author'))
$('# Description: %s'%$flow_graph.get_option('description'))
$('# Generated: %s'%time.ctime())
-$('#'*40)
+$('#'*50)
#for $imp in $imports
$imp
Modified: grc/trunk/src/grc_gnuradio/data/wx_gui.tmpl
===================================================================
--- grc/trunk/src/grc_gnuradio/data/wx_gui.tmpl 2008-05-19 03:01:08 UTC (rev
8442)
+++ grc/trunk/src/grc_gnuradio/data/wx_gui.tmpl 2008-05-19 07:10:32 UTC (rev
8443)
@@ -22,30 +22,15 @@
#if sys.platform == 'cygwin'
#set $WX_APP_ICON = None
#end if
-$('#'*40)
+$('#'*50)
# Gnuradio Python Flow Graph (wx gui)
$('# Title: %s'%$flow_graph.get_option('title'))
$('# Author: %s'%$flow_graph.get_option('author'))
$('# Description: %s'%$flow_graph.get_option('description'))
$('# Generated: %s'%time.ctime())
-$('#'*40)
+$('#'*50)
########################################################
-## Create a callback function
-########################################################
-#def make_callback($id)
- #set $my_callbacks = filter(lambda c: id in c, $callbacks)
- #if $my_callbacks
-def _callback(_val):
- globals()["$id"] = _val
- #for $callback in $my_callbacks
- exec("""$callback""")
- #end for
- #else
-def _callback(_val): pass#slurp
- #end if
-#end def
-########################################################
## Create Imports
########################################################
#for $imp in $imports
@@ -94,45 +79,50 @@
tb.GridAdd($(graphical_sink.get_id()).win, $grid_pos[0], $grid_pos[1],
$grid_pos[2], $grid_pos[3])
#end for
########################################################
-## Create Sliders
+## Create Controls
########################################################
-#for $slider in $sliders
-$make_callback($slider.get_id())
-slider = grc_wxgui.slider_control(
+#for $control in $sliders + $choosers
+ #set $id = $control.get_id()
+ #set $my_callbacks = filter(lambda c: id in ''.join(c.split('(')[1:]),
$callbacks)
+
+$('#'*50)
+# Create control for $id
+$('#'*50)
+def _set_$(id)(_$id):
+ $id = _$id
+ #for $callback in $my_callbacks
+ $callback
+ #end for
+ #if $control in $sliders
+_$(id)_control = grc_wxgui.slider_control(
window=tb.GetWin(),
- callback=_callback,
-#if $slider.get_param('label').evaluate()
- label=$slider.get_param('label').to_code(),
-#else
- label="$slider.get_id()",
-#end if
- value=$slider.get_param('value').to_code(),
- min=$slider.get_param('min').to_code(),
- max=$slider.get_param('max').to_code(),
- num_steps=$slider.get_param('num_steps').to_code(),
+ callback=_set_$(id),
+ #if $control.get_param('label').evaluate()
+ label=$control.get_param('label').to_code(),
+ #else
+ label="$id",
+ #end if
+ value=$control.get_param('value').to_code(),
+ min=$control.get_param('min').to_code(),
+ max=$control.get_param('max').to_code(),
+ num_steps=$control.get_param('num_steps').to_code(),
)
-#set $grid_pos = $slider.get_param('grid_pos').evaluate()
-tb.GridAdd(slider, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
-#end for
-########################################################
-## Create Chooser
-########################################################
-#for $chooser in $choosers
-$make_callback($chooser.get_id())
-chooser = grc_wxgui.$(chooser.get_param('chooser_type').to_code())_control(
+ #elif $control in $choosers
+_$(id)_control =
grc_wxgui.$(control.get_param('chooser_type').to_code())_control(
window=tb.GetWin(),
- callback=_callback,
-#if $chooser.get_param('label').evaluate()
- label=$chooser.get_param('label').to_code(),
-#else
- label="$chooser.get_id()",
-#end if
- index=$chooser.get_param('value_index').to_code(),
- choices=$chooser.get_param('choices').to_code(),
- labels=$chooser.get_param('labels').to_code(),
-)
-#set $grid_pos = $chooser.get_param('grid_pos').evaluate()
-tb.GridAdd(chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], $grid_pos[3])
+ callback=_set_$(id),
+ #if $control.get_param('label').evaluate()
+ label=$control.get_param('label').to_code(),
+ #else
+ label="$id",
+ #end if
+ index=$control.get_param('value_index').to_code(),
+ choices=$control.get_param('choices').to_code(),
+ labels=$control.get_param('labels').to_code(),
+)
+ #end if
+#set $grid_pos = $control.get_param('grid_pos').evaluate()
+tb.GridAdd(_$(id)_control, $grid_pos[0], $grid_pos[1], $grid_pos[2],
$grid_pos[3])
#end for
tb.Run()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Commit-gnuradio] r8443 - in grc/trunk/src/grc_gnuradio: blks2 data,
jblum <=