# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file '/home/detlev/Development/Python/Eric/eric3_8/eric3/QScintilla/SearchReplaceForm.ui'
#
# Created: So Jul 17 16:29:42 2005
#      by: The PyQt User Interface Compiler (pyuic) 3.14.1
#
# WARNING! All changes made in this file will be lost!


import sys
from qt import *


class SearchReplaceForm(QDialog):
    def __init__(self,parent = None,name = None,modal = 0,fl = 0):
        QDialog.__init__(self,parent,name,modal,fl)

        if not name:
            self.setName("SearchReplaceForm")


        SearchReplaceFormLayout = QVBoxLayout(self,6,6,"SearchReplaceFormLayout")

        layout7 = QGridLayout(None,1,1,0,6,"layout7")

        layout6 = QHBoxLayout(None,0,6,"layout6")

        self.limitCheckBox = QCheckBox(self,"limitCheckBox")
        layout6.addWidget(self.limitCheckBox)

        self.linesFrame = QFrame(self,"linesFrame")
        self.linesFrame.setEnabled(0)
        self.linesFrame.setFrameShape(QFrame.NoFrame)
        self.linesFrame.setFrameShadow(QFrame.Raised)
        linesFrameLayout = QHBoxLayout(self.linesFrame,0,6,"linesFrameLayout")

        self.textLabel1 = QLabel(self.linesFrame,"textLabel1")
        linesFrameLayout.addWidget(self.textLabel1)

        self.startLineSpinBox = QSpinBox(self.linesFrame,"startLineSpinBox")
        self.startLineSpinBox.setMaxValue(99999)
        self.startLineSpinBox.setMinValue(1)
        linesFrameLayout.addWidget(self.startLineSpinBox)

        self.textLabel2 = QLabel(self.linesFrame,"textLabel2")
        linesFrameLayout.addWidget(self.textLabel2)

        self.endLineSpinBox = QSpinBox(self.linesFrame,"endLineSpinBox")
        self.endLineSpinBox.setMaxValue(99999)
        self.endLineSpinBox.setMinValue(1)
        self.endLineSpinBox.setValue(99999)
        linesFrameLayout.addWidget(self.endLineSpinBox)
        layout6.addWidget(self.linesFrame)
        spacer3 = QSpacerItem(40,20,QSizePolicy.Expanding,QSizePolicy.Minimum)
        layout6.addItem(spacer3)

        layout7.addLayout(layout6,3,1)

        self.TextLabel1 = QLabel(self,"TextLabel1")

        layout7.addWidget(self.TextLabel1,0,0)

        self.replaceTextLabel = QLabel(self,"replaceTextLabel")

        layout7.addWidget(self.replaceTextLabel,1,0)

        Layout9 = QGridLayout(None,1,1,0,6,"Layout9")

        self.wrapCheckBox = QCheckBox(self,"wrapCheckBox")

        Layout9.addWidget(self.wrapCheckBox,2,1)

        self.backwardsCheckBox = QCheckBox(self,"backwardsCheckBox")

        Layout9.addWidget(self.backwardsCheckBox,1,1)

        self.wordCheckBox = QCheckBox(self,"wordCheckBox")

        Layout9.addWidget(self.wordCheckBox,1,0)

        self.caseCheckBox = QCheckBox(self,"caseCheckBox")

        Layout9.addWidget(self.caseCheckBox,0,0)

        self.regexpCheckBox = QCheckBox(self,"regexpCheckBox")

        Layout9.addWidget(self.regexpCheckBox,2,0)

        layout7.addLayout(Layout9,2,1)

        self.findtextCombo = QComboBox(0,self,"findtextCombo")
        self.findtextCombo.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,self.findtextCombo.sizePolicy().hasHeightForWidth()))
        self.findtextCombo.setEditable(1)
        self.findtextCombo.setInsertionPolicy(QComboBox.AtTop)
        self.findtextCombo.setDuplicatesEnabled(0)

        layout7.addWidget(self.findtextCombo,0,1)

        self.replacetextCombo = QComboBox(0,self,"replacetextCombo")
        self.replacetextCombo.setSizePolicy(QSizePolicy(QSizePolicy.Expanding,QSizePolicy.Fixed,0,0,self.replacetextCombo.sizePolicy().hasHeightForWidth()))
        self.replacetextCombo.setEditable(1)
        self.replacetextCombo.setInsertionPolicy(QComboBox.AtTop)
        self.replacetextCombo.setDuplicatesEnabled(0)

        layout7.addWidget(self.replacetextCombo,1,1)
        SearchReplaceFormLayout.addLayout(layout7)

        Layout8 = QHBoxLayout(None,0,6,"Layout8")
        Spacer3 = QSpacerItem(16,0,QSizePolicy.Expanding,QSizePolicy.Minimum)
        Layout8.addItem(Spacer3)

        self.findButton = QPushButton(self,"findButton")
        self.findButton.setEnabled(0)
        self.findButton.setDefault(1)
        Layout8.addWidget(self.findButton)

        self.findNextButton = QPushButton(self,"findNextButton")
        self.findNextButton.setEnabled(0)
        Layout8.addWidget(self.findNextButton)

        self.replaceButton = QPushButton(self,"replaceButton")
        self.replaceButton.setEnabled(0)
        Layout8.addWidget(self.replaceButton)

        self.replaceAllButton = QPushButton(self,"replaceAllButton")
        self.replaceAllButton.setEnabled(0)
        Layout8.addWidget(self.replaceAllButton)

        self.cancelButton = QPushButton(self,"cancelButton")
        Layout8.addWidget(self.cancelButton)
        Spacer4 = QSpacerItem(16,0,QSizePolicy.Expanding,QSizePolicy.Minimum)
        Layout8.addItem(Spacer4)
        SearchReplaceFormLayout.addLayout(Layout8)

        self.languageChange()

        self.resize(QSize(572,201).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)

        self.connect(self.cancelButton,SIGNAL("clicked()"),self.close)
        self.connect(self.findButton,SIGNAL("clicked()"),self.handleFind)
        self.connect(self.findNextButton,SIGNAL("clicked()"),self.handleFindNext)
        self.connect(self.findtextCombo,SIGNAL("textChanged(const QString&)"),self.enableFindButtons)
        self.connect(self.replaceButton,SIGNAL("clicked()"),self.handleReplace)
        self.connect(self.replaceAllButton,SIGNAL("clicked()"),self.handleReplaceAll)
        self.connect(self.limitCheckBox,SIGNAL("toggled(bool)"),self.linesFrame.setEnabled)

        self.setTabOrder(self.findtextCombo,self.replacetextCombo)
        self.setTabOrder(self.replacetextCombo,self.caseCheckBox)
        self.setTabOrder(self.caseCheckBox,self.wordCheckBox)
        self.setTabOrder(self.wordCheckBox,self.regexpCheckBox)
        self.setTabOrder(self.regexpCheckBox,self.backwardsCheckBox)
        self.setTabOrder(self.backwardsCheckBox,self.wrapCheckBox)
        self.setTabOrder(self.wrapCheckBox,self.limitCheckBox)
        self.setTabOrder(self.limitCheckBox,self.startLineSpinBox)
        self.setTabOrder(self.startLineSpinBox,self.endLineSpinBox)
        self.setTabOrder(self.endLineSpinBox,self.findButton)
        self.setTabOrder(self.findButton,self.findNextButton)
        self.setTabOrder(self.findNextButton,self.replaceButton)
        self.setTabOrder(self.replaceButton,self.replaceAllButton)
        self.setTabOrder(self.replaceAllButton,self.cancelButton)

        self.TextLabel1.setBuddy(self.findtextCombo)
        self.replaceTextLabel.setBuddy(self.replacetextCombo)


    def languageChange(self):
        self.setCaption(self.__tr("Find and Replace"))
        QWhatsThis.add(self,self.__tr("<b>Find and Replace</b>\n"
"<p>This dialog is used to find some text and eventually replace it with another text. By checking the various checkboxes, the search can be made more specific. The search string might be a regular expression. In a regular expression, special characters interpreted are:</p>\n"
"<table border=\"0\">\n"
"<tr><td><code>.</code></td><td>Matches any character</td></tr>\n"
"<tr><td><code>\\(</code></td><td>This marks the start of a region for tagging a match.</td></tr>\n"
"<tr><td><code>\\)</code></td><td>This marks the end of a tagged region.</td></tr>\n"
"<tr><td><code>\\n</code></td>\n"
"<td>Where <code>n</code> is 1 through 9 refers to the first through ninth tagged region\n"
"when replacing. For example, if the search string was <code>Fred\\([1-9]\\)XXX</code> and\n"
"the replace string was <code>Sam\\1YYY</code>, when applied to <code>Fred2XXX</code> this\n"
"would generate <code>Sam2YYY</code>.</td></tr>\n"
"<tr><td><code>\\&lt;</code></td><td>This matches the start of a word using Scintilla's definitions of words.</td></tr>\n"
"<tr><td><code>\\&gt;</code></td><td>This matches the end of a word using Scintilla's definition of words.</td></tr>\n"
"<tr><td><code>\\x</code></td>\n"
"<td>This allows you to use a character x that would otherwise have a special meaning. For\n"
"example, \\[ would be interpreted as [ and not as the start of a character set.</td></tr>\n"
"<tr><td><code>[...]</code></td>\n"
"<td>This indicates a set of characters, for example, [abc] means any of the characters a,\n"
"b or c. You can also use ranges, for example [a-z] for any lower case character.</td></tr>\n"
"<tr><td><code>[^...]</code></td>\n"
"<td>The complement of the characters in the set. For example, [^A-Za-z] means any\n"
"character except an alphabetic character.</td></tr>\n"
"<tr><td><code>^</code></td><td>This matches the start of a line (unless used inside a set, see above).</td></tr>\n"
"<tr><td><code>$</code></td> <td>This matches the end of a line.</td></tr>\n"
"<tr><td><code>*</code></td>\n"
"<td>This matches 0 or more times. For example, <code>Sa*m</code> matches <code>Sm</code>,\n"
"<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td></tr>\n"
"<tr><td><code>+</code></td>\n"
"<td>This matches 1 or more times. For example, <code>Sa+m</code> matches\n"
"<code>Sam</code>, <code>Saam</code>, <code>Saaam</code> and so on.</td></tr>\n"
"</table>"))
        self.limitCheckBox.setText(self.__tr("&Limit search"))
        self.limitCheckBox.setAccel(self.__tr("Alt+L"))
        QToolTip.add(self.limitCheckBox,self.__tr("Select, if the search should be limited to the specified lines"))
        self.textLabel1.setText(self.__tr("Start line"))
        QToolTip.add(self.startLineSpinBox,self.__tr("Enter the line number to start the search"))
        self.textLabel2.setText(self.__tr("End line"))
        QToolTip.add(self.endLineSpinBox,self.__tr("Enter the line number to end the search"))
        self.TextLabel1.setText(self.__tr("Find &text:"))
        self.replaceTextLabel.setText(self.__tr("Replace te&xt:"))
        self.wrapCheckBox.setText(self.__tr("Wra&p around"))
        self.backwardsCheckBox.setText(self.__tr("Search &backwards"))
        self.wordCheckBox.setText(self.__tr("Whole &word"))
        self.wordCheckBox.setAccel(self.__tr("Alt+W"))
        self.caseCheckBox.setText(self.__tr("&Match upper/lower case"))
        self.caseCheckBox.setAccel(self.__tr("Alt+M"))
        self.regexpCheckBox.setText(self.__tr("Regular &Expression"))
        self.regexpCheckBox.setAccel(self.__tr("Alt+E"))
        self.findButton.setText(self.__tr("&Find"))
        self.findButton.setAccel(self.__tr("Alt+F"))
        self.findNextButton.setText(self.__tr("Find &Next"))
        self.replaceButton.setText(self.__tr("&Replace"))
        self.replaceAllButton.setText(self.__tr("Replace &All"))
        self.cancelButton.setText(self.__tr("&Cancel"))
        self.cancelButton.setAccel(self.__tr("Alt+C"))


    def enableFindButtons(self):
        print "SearchReplaceForm.enableFindButtons(): Not implemented yet"

    def handleFind(self):
        print "SearchReplaceForm.handleFind(): Not implemented yet"

    def handleFindNext(self):
        print "SearchReplaceForm.handleFindNext(): Not implemented yet"

    def handleReplace(self):
        print "SearchReplaceForm.handleReplace(): Not implemented yet"

    def handleReplaceAll(self):
        print "SearchReplaceForm.handleReplaceAll(): Not implemented yet"

    def handleLimitToggled(self,a0):
        print "SearchReplaceForm.handleLimitToggled(bool): Not implemented yet"

    def __tr(self,s,c = None):
        return qApp.translate("SearchReplaceForm",s,c)

if __name__ == "__main__":
    a = QApplication(sys.argv)
    QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
    w = SearchReplaceForm()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()
