<s> import weakref <EOL> from pyface . qt import QtGui , QtCore <EOL> from . find_widget import FindWidget <EOL> class ReplaceWidget ( FindWidget ) : <EOL> def __init__ ( self , parent ) : <EOL> super ( FindWidget , self ) . __init__ ( parent ) <EOL> self . adv_code_widget = weakref . ref ( parent ) <EOL> self . button_size = self . fontMetrics ( ) . width ( u'<STR_LIT>' ) + <NUM_LIT:20> <EOL> form_layout = QtGui . QFormLayout ( ) <EOL> form_layout . addRow ( '<STR_LIT>' , self . _create_find_control ( ) ) <EOL> form_layout . addRow ( '<STR_LIT>' , self . _create_replace_control ( ) ) <EOL> layout = QtGui . QHBoxLayout ( ) <EOL> layout . addLayout ( form_layout ) <EOL> close_button = QtGui . QPushButton ( '<STR_LIT>' ) <EOL> layout . addWidget ( close_button , <NUM_LIT:1> , QtCore . Qt . AlignRight ) <EOL> close_button . clicked . connect ( self . hide ) <EOL> self . setLayout ( layout ) <EOL> def _create_replace_control ( self ) : <EOL> control = QtGui . QWidget ( self ) <EOL> self . replace_edit = QtGui . QLineEdit ( ) <EOL> self . replace_button = QtGui . QPushButton ( '<STR_LIT>' ) <EOL> self . replace_button . setFixedWidth ( self . button_size ) <EOL> self . replace_all_button = QtGui . QPushButton ( '<STR_LIT>' ) <EOL> self . replace_all_button . setFixedWidth ( self . button_size ) <EOL> layout = QtGui . QHBoxLayout ( ) <EOL> layout . addWidget ( self . replace_edit ) <EOL> layout . addWidget ( self . replace_button ) <EOL> layout . addWidget ( self . replace_all_button ) <EOL> layout . addStretch ( <NUM_LIT:2> ) <EOL> layout . setContentsMargins ( <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> , <NUM_LIT:0> ) <EOL> control . setLayout ( layout ) <EOL> return control </s>
