diff options
author | jblum | 2009-06-23 20:38:18 +0000 |
---|---|---|
committer | jblum | 2009-06-23 20:38:18 +0000 |
commit | 9988664127b367fa8fee4409f8460673d6f265e1 (patch) | |
tree | 96752c15b7f1447e5e78a7282d1de141f9e0000b /grc/blocks/variable_config.xml | |
parent | 885e6fe1fd0e06476511c79515f34ffcef50287d (diff) | |
download | gnuradio-9988664127b367fa8fee4409f8460673d6f265e1.tar.gz gnuradio-9988664127b367fa8fee4409f8460673d6f265e1.tar.bz2 gnuradio-9988664127b367fa8fee4409f8460673d6f265e1.zip |
Merging r11186:11273 from grc branch.
Fixes, features, and reorganization for grc.
Minor fixes and features for wxgui forms.
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11274 221aa14e-8319-0410-a670-987f0aec2ac5
Diffstat (limited to 'grc/blocks/variable_config.xml')
-rw-r--r-- | grc/blocks/variable_config.xml | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/grc/blocks/variable_config.xml b/grc/blocks/variable_config.xml new file mode 100644 index 000000000..f62a3def1 --- /dev/null +++ b/grc/blocks/variable_config.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<!-- +################################################### +##Variable Config block: +## a variable that reads and writes to a config file +################################################### + --> +<block> + <name>Variable Config</name> + <key>variable_config</key> + <import>import ConfigParser</import> + <var_make>self._$(id)_config = ConfigParser.ConfigParser() +self._$(id)_config.read($config_file) +if not self._$(id)_config.has_section($section): + self._$(id)_config.add_section($section) +try: $(id) = self._$(id)_config.$(type.get)($section, $option) +except: $(id) = $value +self.$(id) = $(id)</var_make> + <make></make> + <callback>self.set_$(id)($value)</callback> + <callback>self._$(id)_config.set($section, $option, str($writeback)) +self._$(id)_config.write(open($config_file, 'w'))</callback> + <param> + <name>Default Value</name> + <key>value</key> + <value>0</value> + <type>$type</type> + </param> + <param> + <name>Type</name> + <key>type</key> + <value>real</value> + <type>enum</type> + <option> + <name>Float</name> + <key>real</key> + <opt>get:getfloat</opt> + </option> + <option> + <name>Int</name> + <key>int</key> + <opt>get:getint</opt> + </option> + <option> + <name>Bool</name> + <key>bool</key> + <opt>get:getbool</opt> + </option> + <option> + <name>String</name> + <key>string</key> + <opt>get:get</opt> + </option> + </param> + <param> + <name>Config File</name> + <key>config_file</key> + <value>default</value> + <type>file_open</type> + </param> + <param> + <name>Section</name> + <key>section</key> + <value>main</value> + <type>string</type> + </param> + <param> + <name>Option</name> + <key>option</key> + <value>key</value> + <type>string</type> + </param> + <param> + <name>WriteBack</name> + <key>writeback</key> + <value>None</value> + <type>raw</type> + </param> + <doc> +This block represents a variable that can be read from a config file. + +To save the value back into the config file: \ +enter the name of another variable into the writeback param. \ +When the other variable is changed at runtime, the config file will be re-written. + </doc> +</block> |