[H-GEN] pygtk/bonobo query
Peter Robinson
pjr at itee.uq.edu.au
Wed Apr 11 00:52:31 EDT 2007
I am writing a simple applet in Python to manage an sshfs mount and I
have struck a problem I can't find an answer for (I am a pygtk newbie)
I have set up the right button menu as follows
# Right button menu
MENU_XML = '''\
<popup name="button3">
<menuitem name="Mounted" verb="Mounted" _label="Mounted"
type = "radio" group = "choice"/>
<menuitem name="Unmounted" verb="Unmounted" _label="Unmounted"
type = "radio" group = "choice"/>
<separator/>
<menuitem name="Preferences" verb="Preferences" _label="_Preferences"
pixtype="stock" pixname="gtk-properties"/>
<menuitem name="About" verb="About" _label="_About"
pixtype="stock" pixname="gtk-about"/>
</popup>
'''
and later did the following to set up the callback for the radio buttons
and other menu items
popup = self.applet.get_popup_component()
popup.connect('ui-event', self.mounted)
verbs = [("Preferences", self.on_prefs), ("About", self.on_about)]
self.applet.setup_menu(MENU_XML, verbs, None)
That works fine - the initial position of the radio buttons is with
mounted set and my callback manages the toggle OK
My question is how can I set the initial settings of the radio buttons
based on a test - specifically if the sshfs fails then
I want to set the unmounted radio button.
After many frustrating hours of google'ing I can't find a solution - I
assume it is possible (and probably easy :( )
Peter Robinson
More information about the General
mailing list