Code changed and results in error of my programm


#1

Hi All,

one of my gnuradio programms do not work anymore, because
some changed the code.

My error Message is:
self._variable_text_box_0_control = grc_wxgui.text_box_control(
AttributeError: ‘module’ object has no attribute ‘text_box_control’

What is the new name ?

regards Markus


#2

feldmaus <feldmann_markus gmx.de> writes:

What is the new name ?

Forget this message. I do not need this Program anymore.

Regards Markus


#3

The callback controls module in grc was replaced with the forms module
http://gnuradio.org/trac/browser/gnuradio/trunk/grc/src/grc_gnuradio/wxgui/forms

The idea is that this forms module will get merged into wxgui and used
by wxgui applications other than grc. This is a step in that direction.

You should be able to change the import statement and constructor, and
everything will work with the forms module.

-Josh


#4

Josh B. <josh joshknows.com> writes:

-Josh

Thanks for your Answer,

i changed from,
self._variable_text_box_0_control = grc_wxgui.text_box_control(
window=self.GetWin(),
callback=self.set_decim,
label=‘decim’,
value=self.usrp_source.decim_rate(),
)

to,
self._variable_text_box_0_control = grc_wxgui.forms.text_box(
window=self.GetWin(),
callback=self.set_decim,
label=‘decim’,
value=self.usrp_source.decim_rate(),
)

But this results in an error:
TypeError: init() got an unexpected keyword argument ‘window’

How should it look like now ?

Regards Markus


#5

After 3.2, this stuff will get merged in officially to wxgui, for now,
your on the bleeding edge!

Look at the source code to get the parameters:
http://gnuradio.org/trac/browser/gnuradio/trunk/grc/src/grc_gnuradio/wxgui/forms/forms.py

Or, generate a flow graph in grc with the various gui controls, and see
what parameters are used.

-Josh

feldmaus wrote:

self._variable_text_box_1_control = grc_wxgui.forms.text_box(
  value=262,
  #window=self.GetWin(),
  choices=[1, 2, 3, 4, 5],
  callback=self.set_usrp_freq,
  style=wx.SL_VERTICAL

And there seems to be some more bugs:
callback=self.set_gain_usrp_source,
^
SyntaxError: invalid syntax

Any Ideas ?

missing a comma
style=wx.SL_VERTICAL,


#6

I still got some more errors:

i defined this elements:
self._variable_text_box_0_control = grc_wxgui.forms.text_box(
#window=self.GetWin(),
callback=self.set_decim,
label=‘decim’,
value=self.usrp_source.decim_rate(),
)
self.Add(self._variable_text_box_0_control)
self._variable_text_box_1_control = grc_wxgui.forms.text_box(
#window=self.GetWin(),
callback=self.set_dc_offset_adc_0,
label=‘DC-Offset(ADC_0)’,
value=262,
)
self.Add(self._variable_text_box_1_control)
self._variable_text_box_2_control = grc_wxgui.forms.text_box(
#window=self.GetWin(),
callback=self.set_dc_offset_adc_1,
label=‘DC-Offset(ADC_1)’,
value=262,
)
self.Add(self._variable_text_box_2_control)
self._variable_text_box_3_control = grc_wxgui.forms.text_box(
#window=self.GetWin(),
callback=self.set_dc_offset_adc_2,
label=‘DC-Offset(ADC_2)’,
value=-586,
)
self.Add(self._variable_text_box_3_control)
self._variable_text_box_4_control = grc_wxgui.forms.text_box(
#window=self.GetWin(),
callback=self.set_dc_offset_adc_3,
label=‘DC-Offset(ADC_3)’,
value=-663,
)
self.Add(self._variable_text_box_4_control)
self._variable_chooser_filter = grc_wxgui.forms.drop_down(
#window=self.GetWin(),
callback=self.change_filter,
label=‘Choose Filter’,
index=0,
choices=[1, 2, 3, 4, 5],
labels=[‘No Filter’,
‘FIR frequency translating LP’,
‘FIR frequency translating BP’,
‘Analysis Filterbank+LP’,
‘Analysis Filterbank+BP’],
)
self.Add(self._variable_chooser_filter)
self._usrp_freq_control = grc_wxgui.forms.slider(
#window=self.GetWin(),
style=wx.SL_HORIZONTAL,
callback=self.set_usrp_freq,
label=“Oszillatorfrequenz”,
value=self.usrp_freq,
min=self.usrp_freq_min,
max=self.usrp_freq_max,
num_steps=1e3,
slider_length=1024,
)
self.Add(self._usrp_freq_control)
self._gain_usrp_source_control = grc_wxgui.forms.slider(
#window=self.GetWin(),
style=wx.SL_VERTICAL
callback=self.set_gain_usrp_source,
label=“Gain Usrp Source”,
value=self.gain_usrp_source,
min=0,
max=20,
num_steps=100,
slider_length=200,
)
self.GridAdd(self._gain_usrp_source_control, 4, 0, 2, 1)

And there seems to be some more bugs:
callback=self.set_gain_usrp_source,
^
SyntaxError: invalid syntax

Any Ideas ?

Regards Markus