<s> import pygtk <EOL> pygtk . require ( '<STR_LIT>' ) <EOL> import gtk <EOL> class UIManagerExample : <EOL> ui = '''<STR_LIT>''' <EOL> def __init__ ( self ) : <EOL> window = gtk . Window ( ) <EOL> window . connect ( '<STR_LIT>' , lambda w : gtk . main_quit ( ) ) <EOL> window . set_size_request ( <NUM_LIT> , - <NUM_LIT:1> ) <EOL> vbox = gtk . VBox ( ) <EOL> window . add ( vbox ) <EOL> uimanager = gtk . UIManager ( ) <EOL> accelgroup = uimanager . get_accel_group ( ) <EOL> window . add_accel_group ( accelgroup ) <EOL> actiongroup = gtk . ActionGroup ( '<STR_LIT>' ) <EOL> self . actiongroup = actiongroup <EOL> actiongroup . add_toggle_actions ( [ ( '<STR_LIT>' , None , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , self . mute_cb ) ] ) <EOL> actiongroup . add_actions ( [ ( '<STR_LIT>' , gtk . STOCK_QUIT , '<STR_LIT>' , None , <EOL> '<STR_LIT>' , self . quit_cb ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' ) ] ) <EOL> actiongroup . get_action ( '<STR_LIT>' ) . set_property ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> actiongroup . add_radio_actions ( [ ( '<STR_LIT>' , None , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <NUM_LIT:0> ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <NUM_LIT:1> ) , <EOL> ( '<STR_LIT>' , None , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , <NUM_LIT:2> ) , <EOL> ] , <NUM_LIT:0> , self . radioband_cb ) <EOL> uimanager . insert_action_group ( actiongroup , <NUM_LIT:0> ) <EOL> uimanager . add_ui_from_string ( self . ui ) <EOL> menubar = uimanager . get_widget ( '<STR_LIT>' ) <EOL> vbox . pack_start ( menubar , False ) <EOL> toolbar = uimanager . get_widget ( '<STR_LIT>' ) <EOL> vbox . pack_start ( toolbar , False ) <EOL> label = gtk . Label ( '<STR_LIT>' ) <EOL> vbox . pack_start ( label ) <EOL> self . mutelabel = label <EOL> label = gtk . Label ( '<STR_LIT>' ) <EOL> vbox . pack_start ( label ) <EOL> self . bandlabel = label <EOL> buttonbox = gtk . HButtonBox ( ) <EOL> sensitivebutton = gtk . CheckButton ( '<STR_LIT>' ) <EOL> sensitivebutton . set_active ( True ) <EOL> sensitivebutton . connect ( '<STR_LIT>' , self . toggle_sensitivity ) <EOL> visiblebutton = gtk . CheckButton ( '<STR_LIT>' ) <EOL> visiblebutton . set_active ( True ) <EOL> visiblebutton . connect ( '<STR_LIT>' , self . toggle_visibility ) <EOL> buttonbox . pack_start ( sensitivebutton , False ) <EOL> buttonbox . pack_start ( visiblebutton , False ) <EOL> vbox . pack_start ( buttonbox ) <EOL> window . show_all ( ) <EOL> return <EOL> def mute_cb ( self , action ) : <EOL> text = ( '<STR_LIT>' , '<STR_LIT>' ) [ action . get_active ( ) == False ] <EOL> self . mutelabel . set_text ( '<STR_LIT>' % text ) <EOL> return <EOL> def radioband_cb ( self , action , current ) : <EOL> text = ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) [ action . get_current_value ( ) ] <EOL> self . bandlabel . set_text ( '<STR_LIT>' % text ) <EOL> return <EOL> def quit_cb ( self , b ) : <EOL> print '<STR_LIT>' <EOL> gtk . main_quit ( ) <EOL> def toggle_sensitivity ( self , b ) : <EOL> self . actiongroup . set_sensitive ( b . get_active ( ) ) <EOL> return <EOL> def toggle_visibility ( self , b ) : <EOL> self . actiongroup . set_visible ( b . get_active ( ) ) <EOL> return <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> ba = UIManagerExample ( ) <EOL> gtk . main ( ) </s>
