[Urwid] radio button magic

Eric S. Johansson esj at harvee.org
Mon Jul 17 21:50:55 EDT 2006


I'm getting closer, honest I am.


< toss and exit  >  < save and exit  >  < swap red, aux  >  < activate >

green, red modem or isdn, alt: 7

(X) GREEN   ( ) ORANGE  ( ) BLUE    ( ) RED     ( ) ALT

ADDRESS                  -->  172.20.0.10
BROADCAST                -->  172.20.0.255
DEV                      -->  eth0
DISPLAYDRIVER            -->  ne2k-pci
DRIVER                   -->  ne2k-pci
DRIVER_OPTIONS           -->
NETADDRESS               -->  172.20.0.0
NETMASK                  -->  255.255.255.0

this is the basic screen layout.  So far, everything is looking better 
and I can change fields but I haven't fully tested saving yet.  That's 
coming up.

The magic trick is that every time I change the digit in the line that 
starts with green, red modem etc. it selects a different configuration 
of interfaces and redisplays that line and changes the number of radio 
buttons on the screen.  So file is to choose configuration three, you 
would just see green, orange, red, alt.  The problem is that I was 
having problems with the selection staying with the right color when I 
selected that radio button.  Finally was able to get it to stick by 
using a set_state when creating a new radio button sequence.

Now you'll probably tell me I'm doing it wrong but I'm currently 
rebuilding the entire list of radio buttons because the number of active 
network elements change with a configuration change. (brute force, 
bloody ignorance)

the current quandary is after I select a radio button, the cursor moves 
back to the green radio button no matter which radio button I select. 
How I get the cursor to stay in the same position as the radio button 
selection or maybe I should say forced reselection.




More information about the Urwid mailing list