#NEWLINE# def buildDialog( self ) : #NEWLINE# #INDENT# self . mainwidget . hide ( ) #NEWLINE# self . mainlayout . removeWidget ( self . mainwidget ) #NEWLINE# self . mainwidget . close ( ) #NEWLINE# del self . mainwidget #NEWLINE# self . mainwidget = QtGui . QWidget ( ) #NEWLINE# self . mainlayout . insertWidget ( 0 , self . mainwidget ) #NEWLINE# self . hbox = QtGui . QHBoxLayout ( ) #NEWLINE# self . mainwidget . setLayout ( self . hbox ) #NEWLINE# self . sliders = [ ] #NEWLINE# self . sliderReceivers = [ ] #NEWLINE# self . previousValues = [ ] #NEWLINE# self . totalValue = 0 #NEWLINE# for ( index , t ) in enumerate ( self . overlayItem . foregrounds ) : #NEWLINE# #INDENT# l = QtGui . QVBoxLayout ( ) #NEWLINE# self . sliderReceivers . append ( SliderReceiver ( self , index , ( self . overlayItem . thresholds [ index ] * 1000 ) ) ) #NEWLINE# w = QtGui . QSlider ( QtCore . Qt . Vertical ) #NEWLINE# w . setToolTip ( ( ( 'Change the threshold for ' + str ( t . name ) ) + '\n a low threshold compared to the other thresholds means a high class probability' ) ) #NEWLINE# w . setRange ( 0 , 999 ) #NEWLINE# w . setSingleStep ( 1 ) #NEWLINE# w . setValue ( ( self . overlayItem . thresholds [ index ] * 1000 ) ) #NEWLINE# l . addWidget ( w ) #NEWLINE# label = QtGui . QLabel ( t . name ) #NEWLINE# l . addWidget ( label ) #NEWLINE# self . sliderReceivers [ ( - 1 ) ] . connect ( w , QtCore . SIGNAL ( 'sliderMoved(int)' ) , self . sliderReceivers [ ( - 1 ) ] . sliderMoved ) #NEWLINE# self . sliders . append ( w ) #NEWLINE# self . hbox . addLayout ( l ) #NEWLINE# #UNINDENT# if ( len ( self . overlayItem . backgrounds ) > 0 ) : #NEWLINE# #INDENT# l = QtGui . QVBoxLayout ( ) #NEWLINE# self . sliderReceivers . append ( SliderReceiver ( self , len ( self . sliders ) , ( self . overlayItem . thresholds [ ( - 1 ) ] * 1000 ) ) ) #NEWLINE# w = QtGui . QSlider ( QtCore . Qt . Vertical ) #NEWLINE# w . setRange ( 0 , 1000 ) #NEWLINE# w . setSingleStep ( 1 ) #NEWLINE# w . setValue ( ( self . overlayItem . thresholds [ ( - 1 ) ] * 1000 ) ) #NEWLINE# l . addWidget ( w ) #NEWLINE# label = QtGui . QLabel ( 'Background' ) #NEWLINE# l . addWidget ( label ) #NEWLINE# self . sliderReceivers [ ( - 1 ) ] . connect ( w , QtCore . SIGNAL ( 'sliderMoved(int)' ) , self . sliderReceivers [ ( - 1 ) ] . sliderMoved ) #NEWLINE# self . sliders . append ( w ) #NEWLINE# self . hbox . addLayout ( l ) #NEWLINE# #UNINDENT# l = QtGui . QVBoxLayout ( ) #NEWLINE# w = QtGui . QPushButton ( 'Select Foreground' ) #NEWLINE# self . connect ( w , QtCore . SIGNAL ( 'clicked()' ) , self . selectForegrounds ) #NEWLINE# l . addWidget ( w ) #NEWLINE# w = QtGui . QPushButton ( 'Select Background' ) #NEWLINE# self . connect ( w , QtCore . SIGNAL ( 'clicked()' ) , self . selectBackgrounds ) #NEWLINE# l . addWidget ( w ) #NEWLINE# l2 = QtGui . QHBoxLayout ( ) #NEWLINE# self . smoothing = QtGui . QCheckBox ( 'Smooth' ) #NEWLINE# self . smoothing . setToolTip ( 'Smooth the input overlays with the specified pixel sigma using a gaussian\n Smoothing may take a while depending on the size of the data...' ) #NEWLINE# self . smoothing . setCheckState ( ( self . overlayItem . smoothing * 2 ) ) #NEWLINE# self . connect ( self . smoothing , QtCore . SIGNAL ( 'stateChanged(int)' ) , self . smoothingChanged ) #NEWLINE# self . sigma = QtGui . QLineEdit ( str ( self . overlayItem . sigma ) ) #NEWLINE# self . sigma . setToolTip ( 'sigma in pixels' ) #NEWLINE# l2 . addWidget ( t . smoothing ) #NEWLINE# l2 . addWidget ( self . sigma ) #NEWLINE# l . addLayout ( l2 ) #NEWLINE# self . hbox . addLayout ( l ) #NEWLINE# self . setMinimumHeight ( 300 )