Hi Josh,

I had a few moments to try it out. It worked very well and I think it
will be useful.
I got a little confused when I cloned the repository because it said
there was no HEAD (or something like that) and the directory was
empty, but I could still checkout to the wip/qtgui/grc branch. I hope
I got the right thing.

You mention engineering notation for the widget. I believe for the
text entry it is quite straightforward (xml attached - I just copied
the code from the gr-qtgui example).

I will do more tests during the coming days.

Alex


On Wed, Mar 2, 2011 at 2:52 AM, Josh Blum <j...@joshknows.com> wrote:
> Hey list,
>
> I have been working on supporting PyQt widgets and the qtgui sinks in
> the Gnuradio Companion. Get the code on my wip/qtgui/grc branch on
> jblum.git http://gnuradio.org/cgit/jblum.git/log/?h=wip/qtgui/grc
>
> Available widgets:
>  * qtgui plotter (dft, scope, etc)
>  * tabbed panel
>  * slider
>  * combo box
>  * radio buttons
>  * text entry
>  * label
>
> 1) The slider adds a new requirement of PyQwt (python Qwt bindings). Qwt
> should already be installed for the qtgui sinks themselves.
>
> 2) The qtgui and wxgui widgets are distinctly separated. Previously, the
> "variable slider" was a wx slider form. Now, there is a WX GUI Slider
> and a QT GUI Slider. And the generate options now have a QT GUI option.
> You cannot mix and match widgets from different graphics libraries.
>
> 3) No attempt was made to make the existence of different graphics
> toolkits transparent to the user. That would have been a huge pain on my
> part and I couldn't try new things. If this Qt thing catches on, I am
> considering a migration script from wx->qt.
>
> 4) The Qt widgets in grc do not have a python wrapper/forms library like
> they do in gnuradio. All the generated code uses the PyQt API directly.
> This is in-part possible because Qwt supplies its own set of useful
> wrappers around Qt widgets. Examples: http://qwt.sourceforge.net/sliders.png
>
> 5) Each widget block in grc has a gui hint parameter. This parameter is
> a combination of the grid parameter and notebook parameter seen in the
> wx widget blocks. It also allowed the implementation code to be a lot
> more generic.
>
> Whats missing?
> I feel that the widgets still need a bit of polishing. Engineering
> notation would be nice. I'd like to see features in the wx scope sink
> brought to the qtgui scope such as trigger modes and multiple channels.
> I think the qt equivalent of the numbersink would be nice too (and that
> could use some of those real fancy qwt widets):
> http://read.pudn.com/downloads186/sourcecode/embed/872381/qwt/doc/images/dials2.png
>
> Why qtgui stuff?
> The WX stuff in gnuradio is fairly polished in comparison; and when it
> works, it works. But we have seen many issues with wx outside of the
> linux+x86 world, not to mention opengl issues on the x86. I hope that
> the qt stuff is a viable, cross platform option for live gnuradio
> plotting and graphical applications.
>
> Please try it out. Feedback is welcome!
> -Josh
>
> _______________________________________________
> Discuss-gnuradio mailing list
> Discuss-gnuradio@gnu.org
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
<?xml version="1.0"?>
<!--
###################################################
##Variable Text Entry:
##	a gui text box form
###################################################
 -->
<block>
	<name>QT GUI Entry</name>
	<key>variable_qtgui_entry</key>
	<category>QT GUI Widgets</category>
	<import>from PyQt4 import Qt</import>
	<var_make>self.$(id) = $(id) = $value</var_make>
	<make>#set $win = 'self._%s_tool_bar'%$id
$win = Qt.QToolBar(self)
#if not $label()
	#set $label = '"%s"'%$id
#end if
$(win).addWidget(Qt.QLabel($label+" ", None))
self._$(id)_line_edit = Qt.QLineEdit(str(self.$id))
self._$(id)_tool_bar.addWidget(self._$(id)_line_edit)
self._$(id)_line_edit.returnPressed.connect(
	lambda: self.set_$(id)(eng_notation.str_to_num(self._$(id)_line_edit.text().toAscii())))
$(gui_hint()($win))</make>
	<callback>self.set_$(id)($value)</callback>
	<callback>self._$(id)_line_edit.setText(eng_notation.num_to_str($id))</callback>
	<param>
		<name>Label</name>
		<key>label</key>
		<value></value>
		<type>string</type>
		<hide>#if $label() then 'none' else 'part'#</hide>
	</param>
	<param>
		<name>Type</name>
		<key>type</key>
		<value>int</value>
		<type>enum</type>
		<hide>part</hide>
		<option><name>Float</name><key>real</key><opt>conv:float</opt></option>
		<option><name>Integer</name><key>int</key><opt>conv:int</opt></option>
		<option><name>String</name><key>string</key><opt>conv:str</opt></option>
		<option><name>Boolean</name><key>bool</key><opt>conv:bool</opt></option>
		<option><name>Any</name><key>raw</key><opt>conv:eval</opt></option>
	</param>
	<param>
		<name>Default Value</name>
		<key>value</key>
		<value>0</value>
		<type>$type</type>
	</param>
	<param>
		<name>GUI Hint</name>
		<key>gui_hint</key>
		<value></value>
		<type>gui_hint</type>
		<hide>part</hide>
	</param>
	<doc>
This block creates a variable with a text entry box. \
Leave the label blank to use the variable id as the label.

The GUI hint can be used to position the widget within the application. \
The hint is of the form [tab_id@tab_index]: [row, col, row_span, col_span]. \
Both the tab specification and the grid position are optional.
	</doc>
</block>
_______________________________________________
Discuss-gnuradio mailing list
Discuss-gnuradio@gnu.org
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Reply via email to