discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] wxPython programming


From: James Cooley
Subject: Re: [Discuss-gnuradio] wxPython programming
Date: Wed, 23 Feb 2005 17:58:08 -0500
User-agent: Mozilla Thunderbird 1.0 (X11/20041206)

Hi Chuck/All

I have a rough version of exactly what you seek that I did today! See attached. Not cleaned, no guarantees, but suggestions/improvements welcome. I have a wrapper class, gr_powermate which wraps the standard python powermate lib posted recently.

Also, I got tired of setting and calculating a separate front-end freq. So with this, there is ONE notion of freq. THere's a func that sets the front end and usrp accordingly.

This amounts to a nearly full featured scanner.


The gist of your problem was solved by using a wx EVT_IDLE, like so:

       # add an idle handler
       self.frame.Bind(wx.EVT_IDLE, self.onIdle)

Be careful. So the onIdle handler is called when ever wx isn't busy. wx is busy a lot, so make sure you don't block for too long. There's probably a more elegant way to not block. For me, I just made sure the powermate stuff was quick! It scans for 50ms at a time then gives up.

See

http://wiki.wxpython.org/index.cgi/LongRunningTasks

for some discussion. Enjoy!

-jamie

By the way, I guess squelch can't be changed on the fly? That would be nice. So, the control does nothing right now.






cswiger wrote:

Gang - I'm paradigm shifting from python to wxpython and having
a terrible time of it, but it must be done.

Basically, where do you put an input processing loop in wxpython?
Or will it have to be changed to event driven somehow?

I tried putting a loop at the end of:


class app_flow_graph (stdgui.gui_flow_graph):
   def __init__(self, frame, panel, vbox, argv):
       stdgui.gui_flow_graph.__init__ (self, frame, panel, vbox, argv)

        [create windows, connect blocks and handle events]

        while 1:
                process input


but that, naturally, blocks the window from ever being drawn.
Shouldn't it go in app.MainLoop() somewhere?

I've been able to create a frame, play a file and change freq with
a text control a-ok. Basically I want to control the radio with a
knob and display the status in a window.

TIA.

--Chuck



_______________________________________________
Discuss-gnuradio mailing list
address@hidden
http://lists.gnu.org/mailman/listinfo/discuss-gnuradio

Attachment: gr_powermate.py
Description: application/python

Attachment: nbfm_rcv_ctrl.py
Description: application/python


reply via email to

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