summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
authorJosh Blum2009-09-25 00:24:48 -0700
committerJosh Blum2009-10-03 23:28:53 -0700
commit02a14678e889b09d41eaf903962733c47791c9cb (patch)
tree7e1f55be562124f51b87c89a565cc270df4d3351 /grc
parent74fbff0ed3e93b8103eb01640329a9a37ebe5de2 (diff)
downloadgnuradio-02a14678e889b09d41eaf903962733c47791c9cb.tar.gz
gnuradio-02a14678e889b09d41eaf903962733c47791c9cb.tar.bz2
gnuradio-02a14678e889b09d41eaf903962733c47791c9cb.zip
Added a run options to the "no gui" generate options.
The user can select between run to completion and prompt for exit. Also fixed the props dialog is changed function to have better hashes. Now we hash a tuple of all "relevant" items which is "order aware". Since xoring the individual hashes proved faulty when 2 params alternated hiding. (cherry picked from commit fd37328c778ea8014e9ea9d932e61e5d229dd012)
Diffstat (limited to 'grc')
-rw-r--r--grc/blocks/options.xml29
-rw-r--r--grc/gui/PropsDialog.py11
-rw-r--r--grc/python/flow_graph.tmpl5
3 files changed, 33 insertions, 12 deletions
diff --git a/grc/blocks/options.xml b/grc/blocks/options.xml
index 1798a69f8..4d0dd2899 100644
--- a/grc/blocks/options.xml
+++ b/grc/blocks/options.xml
@@ -78,19 +78,36 @@ else: self.stop(); self.wait()</callback>
<hide>#if $generate_options() == 'hb' then 'none' else 'all'#</hide>
</param>
<param>
+ <name>Run Options</name>
+ <key>run_options</key>
+ <value>prompt</value>
+ <type>enum</type>
+ <hide>#if $generate_options() == 'no_gui' then 'none' else 'all'#</hide>
+ <option>
+ <name>Run to Completion</name>
+ <key>run</key>
+ </option>
+ <option>
+ <name>Prompt for Exit</name>
+ <key>prompt</key>
+ </option>
+ </param>
+ <param>
<name>Run</name>
<key>run</key>
<value>True</value>
<type>bool</type>
- <hide>#if $generate_options() == 'wx_gui'
- #if str($run) == 'True'
-part#slurp
+ <hide>
+#if $generate_options() == 'wx_gui'
+ #if $run()
+ part
#else
-none#slurp
+ none
#end if
#else
-all#slurp
-#end if</hide>
+ all
+#end if
+ </hide>
<option>
<name>Autostart</name>
<key>True</key>
diff --git a/grc/gui/PropsDialog.py b/grc/gui/PropsDialog.py
index a7822b228..cc84fd088 100644
--- a/grc/gui/PropsDialog.py
+++ b/grc/gui/PropsDialog.py
@@ -93,15 +93,14 @@ class PropsDialog(gtk.Dialog):
Ex: Added, removed, type change, hide change...
To the props dialog, the hide setting of 'none' and 'part' are identical.
Therfore, the props dialog only cares if the hide setting is/not 'all'.
- Make a hash that uniquely represents the params state.
+ Make a hash that uniquely represents the params' state.
@return true if changed
"""
old_hash = self._hash
- self._hash = 0
- for param in self._block.get_params():
- self._hash ^= hash(param)
- self._hash ^= hash(param.get_type())
- self._hash ^= hash(param.get_hide() == 'all')
+ #create a tuple of things from each param that affects the params box
+ self._hash = hash(tuple([(
+ hash(param), param.get_type(), param.get_hide() == 'all',
+ ) for param in self._block.get_params()]))
return self._hash != old_hash
def _handle_changed(self, *args):
diff --git a/grc/python/flow_graph.tmpl b/grc/python/flow_graph.tmpl
index dce4037d5..31d99a61c 100644
--- a/grc/python/flow_graph.tmpl
+++ b/grc/python/flow_graph.tmpl
@@ -233,9 +233,14 @@ if __name__ == '__main__':
#if $generate_options == 'wx_gui'
tb.Run($flow_graph.get_option('run'))
#elif $generate_options == 'no_gui'
+ #set $run_options = $flow_graph.get_option('run_options')
+ #if $run_options == 'prompt'
tb.start()
raw_input('Press Enter to quit: ')
tb.stop()
+ #elif $run_options == 'run'
+ tb.run()
+ #end if
#end if
#end if