commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11284 - gnuradio/trunk/grc/blocks


From: jblum
Subject: [Commit-gnuradio] r11284 - gnuradio/trunk/grc/blocks
Date: Thu, 25 Jun 2009 16:48:04 -0600 (MDT)

Author: jblum
Date: 2009-06-25 16:48:04 -0600 (Thu, 25 Jun 2009)
New Revision: 11284

Modified:
   gnuradio/trunk/grc/blocks/variable_check_box.xml
   gnuradio/trunk/grc/blocks/variable_chooser.xml
   gnuradio/trunk/grc/blocks/variable_config.xml
   gnuradio/trunk/grc/blocks/variable_slider.xml
   gnuradio/trunk/grc/blocks/variable_static_text.xml
   gnuradio/trunk/grc/blocks/variable_text_box.xml
Log:
Made the form instances in the gui variables "private", ie, added an underscore.
The generated code looks makes more sense, and it may avoid a possible variable 
collision.

Fixed up variable config to re-read the config file before writing,
so 2 or more variables using the same config file cant "fight".



Modified: gnuradio/trunk/grc/blocks/variable_check_box.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_check_box.xml    2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_check_box.xml    2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -10,7 +10,7 @@
        <key>variable_check_box</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self.$(id)_check_box = forms.check_box(
+       <make>self._$(id)_check_box = forms.check_box(
        parent=self.GetWin(),
        value=self.$id,
        callback=self.set_$(id),
@@ -24,12 +24,12 @@
 )
 #set $grid_pos = $grid_pos()
 #if not grid_pos
-self.Add(self.$(id)_check_box)
+self.Add(self._$(id)_check_box)
 #else
-self.GridAdd(self.$(id)_check_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
+self.GridAdd(self._$(id)_check_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
-       <callback>self.$(id)_check_box.set_value($id)</callback>
+       <callback>self._$(id)_check_box.set_value($id)</callback>
        <param>
                <name>Label</name>
                <key>label</key>

Modified: gnuradio/trunk/grc/blocks/variable_chooser.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_chooser.xml      2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_chooser.xml      2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -11,7 +11,7 @@
        <key>variable_chooser</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self.$(id)_chooser = forms.$(type)(
+       <make>self._$(id)_chooser = forms.$(type)(
        parent=self.GetWin(),
        value=self.$id,
        callback=self.set_$(id),
@@ -28,12 +28,12 @@
 )
 #set $grid_pos = $grid_pos()
 #if not grid_pos
-self.Add(self.$(id)_chooser)
+self.Add(self._$(id)_chooser)
 #else
-self.GridAdd(self.$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
+self.GridAdd(self._$(id)_chooser, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
-       <callback>self.$(id)_chooser.set_value($id)</callback>
+       <callback>self._$(id)_chooser.set_value($id)</callback>
        <param>
                <name>Label</name>
                <key>label</key>

Modified: gnuradio/trunk/grc/blocks/variable_config.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_config.xml       2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_config.xml       2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -11,14 +11,16 @@
        <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))
+       <callback>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)
+self._$(id)_config.set($section, $option, str($writeback))
 self._$(id)_config.write(open($config_file, 'w'))</callback>
        <param>
                <name>Default Value</name>

Modified: gnuradio/trunk/grc/blocks/variable_slider.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_slider.xml       2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_slider.xml       2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -11,7 +11,7 @@
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
        <make>_$(id)_sizer = wx.BoxSizer(wx.VERTICAL)
-self.$(id)_text_box = forms.text_box(
+self._$(id)_text_box = forms.text_box(
        parent=self.GetWin(),
        sizer=_$(id)_sizer,
        value=self.$id,
@@ -24,7 +24,7 @@
        converter=forms.$(converver)(),
        proportion=0,
 )
-self.$(id)_slider = forms.slider(
+self._$(id)_slider = forms.slider(
        parent=self.GetWin(),
        sizer=_$(id)_sizer,
        value=self.$id,
@@ -43,8 +43,8 @@
 self.GridAdd(_$(id)_sizer, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
-       <callback>self.$(id)_slider.set_value($id)</callback>
-       <callback>self.$(id)_text_box.set_value($id)</callback>
+       <callback>self._$(id)_slider.set_value($id)</callback>
+       <callback>self._$(id)_text_box.set_value($id)</callback>
        <param>
                <name>Label</name>
                <key>label</key>

Modified: gnuradio/trunk/grc/blocks/variable_static_text.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_static_text.xml  2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_static_text.xml  2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -10,7 +10,7 @@
        <key>variable_static_text</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self.$(id)_static_text = forms.static_text(
+       <make>self._$(id)_static_text = forms.static_text(
        parent=self.GetWin(),
        value=self.$id,
        callback=self.set_$(id),
@@ -27,12 +27,12 @@
 )
 #set $grid_pos = $grid_pos()
 #if not grid_pos
-self.Add(self.$(id)_static_text)
+self.Add(self._$(id)_static_text)
 #else
-self.GridAdd(self.$(id)_static_text, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
+self.GridAdd(self._$(id)_static_text, $grid_pos[0], $grid_pos[1], 
$grid_pos[2], $grid_pos[3])
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
-       <callback>self.$(id)_static_text.set_value($id)</callback>
+       <callback>self._$(id)_static_text.set_value($id)</callback>
        <param>
                <name>Label</name>
                <key>label</key>

Modified: gnuradio/trunk/grc/blocks/variable_text_box.xml
===================================================================
--- gnuradio/trunk/grc/blocks/variable_text_box.xml     2009-06-25 17:59:26 UTC 
(rev 11283)
+++ gnuradio/trunk/grc/blocks/variable_text_box.xml     2009-06-25 22:48:04 UTC 
(rev 11284)
@@ -10,7 +10,7 @@
        <key>variable_text_box</key>
        <import>from gnuradio.wxgui import forms</import>
        <var_make>self.$(id) = $(id) = $value</var_make>
-       <make>self.$(id)_text_box = forms.text_box(
+       <make>self._$(id)_text_box = forms.text_box(
        parent=self.GetWin(),
        value=self.$id,
        callback=self.set_$(id),
@@ -27,12 +27,12 @@
 )
 #set $grid_pos = $grid_pos()
 #if not grid_pos
-self.Add(self.$(id)_text_box)
+self.Add(self._$(id)_text_box)
 #else
-self.GridAdd(self.$(id)_text_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
+self.GridAdd(self._$(id)_text_box, $grid_pos[0], $grid_pos[1], $grid_pos[2], 
$grid_pos[3])
 #end if</make>
        <callback>self.set_$(id)($value)</callback>
-       <callback>self.$(id)_text_box.set_value($id)</callback>
+       <callback>self._$(id)_text_box.set_value($id)</callback>
        <param>
                <name>Label</name>
                <key>label</key>





reply via email to

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