b = 1
[two]
b = 2
This works for the first read. I can set the GUI Chooser default value to 0,1 or 2 and it will read the variable from the expected section. However, when I change the GUI Chooser, the writeback value gets overwritten, even if I set the writeback to None. That's not the problem though. I have created another version of the variable_config xml file, modifying the callback method to stop writing to the file (I don't need that) and trying to set the new value to the variable at runtime. This is the modified, non working version of the callback. Note that I don't create a new instance of ConfigParser (not sure if it's needed).
<callback>self.set_$(id)($value)</callback>
<callback>self._$(id)_config.read($config_file)
try: $(id) = self._$(id)_config.$(type.get)($section, $option)
except: $(id) = $value
self.$(id) = $(id)
self._$(id)_config.set($section, $option, $id)
print 'self._$(id)_config: ' + str(self._$(id)_config)
print 'section: ' + str($section)
print 'option: ' + str($option)
print 'value: ' + str($value)
print 'id: ' + str($id)
print 'self.$(id): ' + str(self.$(id))
print 'writeback: ' + str($writeback)</callback>
The output of the console is
self._b_config: <ConfigParser.ConfigParser instance at 0x7fee30cd23b0>
section: two
option: b
value: 1
id: 2
self.b: 2
writeback: 2
When I use this variable to change the amplitude of a sine wave at runtime, it doesn't change. What am I doing wrong?
3) I have tried changing the name of the configuration file in a similar way, but I had the same problem.
Cheers,
Murray