#NEWLINE# def __init__( self , parent , tool_bar , image_cache , item , controller , show_labels ) : #NEWLINE# #INDENT# ' Creates a new tool bar tool for an action item. ' #NEWLINE# self . item = item #NEWLINE# self . tool_bar = tool_bar #NEWLINE# action = item . action #NEWLINE# self . control_id = None #NEWLINE# if ( action . image is None ) : #NEWLINE# #INDENT# self . control = tool_bar . addAction ( action . name ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# size = tool_bar . iconSize ( ) #NEWLINE# image = action . image . create_icon ( ( size . width ( ) , size . height ( ) ) ) #NEWLINE# self . control = tool_bar . addAction ( image , action . name ) #NEWLINE# #UNINDENT# QtCore . QObject . connect ( self . control , QtCore . SIGNAL ( 'triggered()' ) , self . _qt4_on_triggered ) #NEWLINE# self . control . setToolTip ( action . tooltip ) #NEWLINE# self . control . setWhatsThis ( action . description ) #NEWLINE# self . control . setEnabled ( action . enabled ) #NEWLINE# self . control . setVisible ( action . visible ) #NEWLINE# if ( action . style == 'toggle' ) : #NEWLINE# #INDENT# self . control . setCheckable ( True ) #NEWLINE# self . control . setChecked ( action . checked ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( action . style == 'radio' ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# ag = item . parent . _qt4_ag #NEWLINE# #UNINDENT# except AttributeError : #NEWLINE# #INDENT# ag = item . parent . _qt4_ag = QtGui . QActionGroup ( parent ) #NEWLINE# #UNINDENT# self . control . setActionGroup ( ag ) #NEWLINE# self . control . setCheckable ( True ) #NEWLINE# self . control . setChecked ( action . checked ) #NEWLINE# #UNINDENT# #UNINDENT# self . control . _tool_instance = self #NEWLINE# action . on_trait_change ( self . _on_action_enabled_changed , 'enabled' ) #NEWLINE# action . on_trait_change ( self . _on_action_visible_changed , 'visible' ) #NEWLINE# action . on_trait_change ( self . _on_action_checked_changed , 'checked' ) #NEWLINE# action . on_trait_change ( self . _on_action_name_changed , 'name' ) #NEWLINE# action . on_trait_change ( self . _on_action_accelerator_changed , 'accelerator' ) #NEWLINE# self . control . destroyed . connect ( self . _qt4_on_destroyed ) #NEWLINE# if ( controller is not None ) : #NEWLINE# #INDENT# self . controller = controller #NEWLINE# controller . add_to_toolbar ( self )