#NEWLINE# def add_combo( self , layout , field , config_key , config_desc , config_val ) : #NEWLINE# #INDENT# options = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( field . widget_options is not None ) : #NEWLINE# #INDENT# options = field . widget_options #NEWLINE# #UNINDENT# if ( 'label' in options ) : #NEWLINE# #INDENT# label_text = options [ 'label' ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# label_text = config_desc #NEWLINE# #UNINDENT# label = QtGui . QLabel ( label_text ) #NEWLINE# row = layout . rowCount ( ) #NEWLINE# layout . addWidget ( label , row , 0 , QtCore . Qt . AlignRight ) #NEWLINE# combo = QtGui . QComboBox ( ) #NEWLINE# inv_remap = None #NEWLINE# if ( 'allowed_values' in options ) : #NEWLINE# #INDENT# values = options [ 'allowed_values' ] #NEWLINE# if ( 'remap' in options ) : #NEWLINE# #INDENT# remap = options [ 'remap' ] #NEWLINE# inv_remap = dict ( ( ( v , k ) for ( k , v ) in remap . iteritems ( ) ) ) #NEWLINE# entries = [ remap [ v ] for v in values ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# entries = values #NEWLINE# #UNINDENT# for entry in entries : #NEWLINE# #INDENT# combo . addItem ( entry ) #NEWLINE# #UNINDENT# #UNINDENT# self . set_combo_value ( combo , config_val , field ) #NEWLINE# layout . addWidget ( combo , row , 1 ) #NEWLINE# def call_field_changed( val ) : #NEWLINE# #INDENT# if ( inv_remap is not None ) : #NEWLINE# #INDENT# val = inv_remap [ val ] #NEWLINE# #UNINDENT# self . field_changed ( config_key , field , val , config_val ) #NEWLINE# #UNINDENT# combo . currentIndexChanged [ unicode ] . connect ( call_field_changed ) #NEWLINE# return combo