<s> from PySide import QtGui , QtCore <EOL> from kraken . ui . color_widget import KColorWidget <EOL> class BackdropInspector ( QtGui . QDialog ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , parent = None , nodeItem = None ) : <EOL> super ( BackdropInspector , self ) . __init__ ( parent ) <EOL> self . setObjectName ( '<STR_LIT>' ) <EOL> self . parent = parent <EOL> self . nodeItem = nodeItem <EOL> self . setWindowTitle ( self . nodeItem . getName ( ) ) <EOL> self . setWindowFlags ( QtCore . Qt . Dialog ) <EOL> self . resize ( <NUM_LIT> , <NUM_LIT> ) <EOL> self . createLayout ( ) <EOL> self . createConnections ( ) <EOL> def createLayout ( self ) : <EOL> self . _mainLayout = QtGui . QVBoxLayout ( ) <EOL> self . _mainLayout . setContentsMargins ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> self . _commentTextEdit = QtGui . QTextEdit ( self ) <EOL> self . _commentTextEdit . setText ( self . nodeItem . getComment ( ) ) <EOL> self . _commentTextEdit . setMinimumHeight ( <NUM_LIT:20> ) <EOL> self . _commentTextEdit . setMaximumHeight ( <NUM_LIT> ) <EOL> self . _settingsLayout = QtGui . QGridLayout ( ) <EOL> self . _settingsLayout . setContentsMargins ( <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:10> ) <EOL> self . _settingsLayout . setSpacing ( <NUM_LIT:3> ) <EOL> self . _settingsLayout . setColumnMinimumWidth ( <NUM_LIT:0> , <NUM_LIT> ) <EOL> self . _settingsLayout . setColumnStretch ( <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> self . _settingsLayout . setColumnStretch ( <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> self . _colorLabel = QtGui . QLabel ( '<STR_LIT>' , self ) <EOL> self . _colorLabel . setObjectName ( '<STR_LIT>' ) <EOL> self . _colorLabel . setSizePolicy ( QtGui . QSizePolicy . MinimumExpanding , QtGui . QSizePolicy . Fixed ) <EOL> self . _colorLabel . setMinimumWidth ( <NUM_LIT> ) <EOL> self . _colorWidget = KColorWidget ( self , self . nodeItem . getColor ( ) ) <EOL> self . _settingsLayout . addWidget ( self . _colorLabel , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , alignment = QtCore . Qt . AlignLeft ) <EOL> self . _settingsLayout . addWidget ( self . _colorWidget , <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:1> , alignment = QtCore . Qt . AlignLeft ) <EOL> self . buttons = QtGui . QDialogButtonBox ( <EOL> QtGui . QDialogButtonBox . Ok | QtGui . QDialogButtonBox . Cancel , <EOL> QtCore . Qt . Horizontal , self ) <EOL> self . _mainLayout . addWidget ( self . _commentTextEdit ) <EOL> self . _mainLayout . addLayout ( self . _settingsLayout ) <EOL> self . _mainLayout . addStretch ( <NUM_LIT:1> ) <EOL> self . _mainLayout . addWidget ( self . buttons ) <EOL> self . setLayout ( self . _mainLayout ) <EOL> def createConnections ( self ) : <EOL> self . buttons . accepted . connect ( self . acceptClose ) <EOL> self . buttons . rejected . connect ( self . close ) <EOL> self . _colorWidget . colorChanged . connect ( self . setNodeColor ) <EOL> def acceptClose ( self ) : <EOL> if self . nodeItem . getComment ( ) != self . _commentTextEdit . toPlainText ( ) : <EOL> self . nodeItem . setComment ( self . _commentTextEdit . toPlainText ( ) ) <EOL> self . nodeItem . adjustSize ( ) <EOL> self . close ( ) <EOL> def setNodeColor ( self , color ) : <EOL> self . nodeItem . setColor ( QtGui . QColor ( color ) ) <EOL> self . nodeItem . setUnselectedColor ( self . nodeItem . getColor ( ) . darker ( <NUM_LIT> ) ) <EOL> self . nodeItem . setSelectedColor ( self . nodeItem . getColor ( ) . lighter ( <NUM_LIT> ) ) <EOL> self . nodeItem . setHoveredColor ( self . nodeItem . getColor ( ) . lighter ( <NUM_LIT> ) ) <EOL> def closeEvent ( self , event ) : <EOL> if self . nodeItem is not None : <EOL> self . nodeItem . inspectorClosed ( ) </s>
