# eric4.UI.FindFileDialog

Module implementing a dialog to search for text in files.

### Global Attributes

None

### Classes

FindFileDialog | Class implementing a dialog to search for text in files.

### Functions

None

## FindFileDialog

Class implementing a dialog to search for text in files.

The occurrences found are displayed in a QTreeWidget showing the filename, the linenumber and the found text. The file will be opened upon a double click onto the respective entry of the list.

### Signals

designerFile(string)
  emitted to open a Qt-Designer file
sourceFile(string, int, string, (int, int)
  ) emitted to open a source file at a line

### Derived from

QDialog, Ui_FindFileDialog

### Class Attributes

endRole
lineRole
md5Role
replaceRole
startRole

### Class Methods

None

### Methods

FindFileDialog | Constructor
__contextMenuRequested | Private slot to handle the context menu request.
__copyToClipboard | Private method to copy the path of an entry to the clipboard.
__createItem | Private method to create an entry in the file list.
__doSearch | Private slot to handle the find button being pressed.
__enableFindButton | Private slot called to enable the find button.
__getFileList | Private method to get a list of files to search.
__openFile | Private slot to open the currently selected entry.
__stopSearch | Private slot to handle the stop button being pressed.
__stripEol | Private method to strip the eol part.
on_buttonBox_clicked | Private slot called by a button of the button box clicked.
on_dirButton_clicked | Private slot to handle the selection of the project radio button.
on_dirCombo_editTextChanged | Private slot to handle the textChanged signal of the directory combo box.
on_dirSelectButton_clicked | Private slot to display a directory selection dialog.
on_filterCheckBox_clicked | Private slot to handle the selection of the file filter check box.
on_filterEdit_textEdited | Private slot to handle the textChanged signal of the file filter edit.
on_findList_itemDoubleClicked | Private slot to handle the double click on a file item.
on_findtextCombo_editTextChanged | Private slot to handle the editTextChanged signal of the find text combo.
on_projectButton_clicked | Private slot to handle the selection of the project radio button.
on_replaceButton_clicked | Private slot to perform the requested replace actions.
on_replacetextCombo_editTextChanged | Private slot to handle the editTextChanged signal of the replace text combo.
setSearchDirectory | Public slot to set the name of the directory to search in.
show | Overwritten method to enable/disable the project button.

### Static Methods

None

#### FindFileDialog (Constructor)

FindFileDialog(project, replaceMode = False, parent=None)

Constructor

project
  reference to the project object
parent
  parent widget of this dialog (QWidget)

#### FindFileDialog.__contextMenuRequested

__contextMenuRequested(pos)

Private slot to handle the context menu request.

pos
  position the context menu shall be shown (QPoint)

#### FindFileDialog.__copyToClipboard

__copyToClipboard()

Private method to copy the path of an entry to the clipboard.

#### FindFileDialog.__createItem

__createItem(file, line, text, start, end, replTxt = "", md5 = "")

Private method to create an entry in the file list.

file
  filename of file (string or QString)
line
  line number (integer)
text
  text found (string or QString)
start
  start position of match (integer)
end
  end position of match (integer)
replTxt
  text with replacements applied (string or QString)
md5
  MD5 hash of the file (string or QString)

#### FindFileDialog.__doSearch

__doSearch()

Private slot to handle the find button being pressed.

#### FindFileDialog.__enableFindButton

__enableFindButton()

Private slot called to enable the find button.

#### FindFileDialog.__getFileList

__getFileList(path, filterRe)

Private method to get a list of files to search.

path
  the root directory to search in (string)
filterRe
  regular expression defining the filter criteria (regexp object)

Returns:
  list of files to be processed (list of strings)

#### FindFileDialog.__openFile

__openFile()

Private slot to open the currently selected entry.

#### FindFileDialog.__stopSearch

__stopSearch()

Private slot to handle the stop button being pressed.

#### FindFileDialog.__stripEol

__stripEol(txt)

Private method to strip the eol part.

txt
  line of text that should be treated (string)

Returns:
  text with eol stripped (string)

#### FindFileDialog.on_buttonBox_clicked

on_buttonBox_clicked(button)

Private slot called by a button of the button box clicked.

button
  button that was clicked (QAbstractButton)

#### FindFileDialog.on_dirButton_clicked

on_dirButton_clicked()

Private slot to handle the selection of the project radio button.

#### FindFileDialog.on_dirCombo_editTextChanged

on_dirCombo_editTextChanged(text)

Private slot to handle the textChanged signal of the directory combo box.

text
  (ignored)

#### FindFileDialog.on_dirSelectButton_clicked

on_dirSelectButton_clicked()

Private slot to display a directory selection dialog.

#### FindFileDialog.on_filterCheckBox_clicked

on_filterCheckBox_clicked()

Private slot to handle the selection of the file filter check box.

#### FindFileDialog.on_filterEdit_textEdited

on_filterEdit_textEdited(p0)

Private slot to handle the textChanged signal of the file filter edit.

text
  (ignored)

#### FindFileDialog.on_findList_itemDoubleClicked

on_findList_itemDoubleClicked(itm, column)

Private slot to handle the double click on a file item.

It emits the signal sourceFile or designerFile depending on the file extension.

itm
  the double clicked tree item (QTreeWidgetItem)
column
  column that was double clicked (integer) (ignored)

#### FindFileDialog.on_findtextCombo_editTextChanged

on_findtextCombo_editTextChanged(text)

Private slot to handle the editTextChanged signal of the find text combo.

text
  (ignored)

#### FindFileDialog.on_projectButton_clicked

on_projectButton_clicked()

Private slot to handle the selection of the project radio button.

#### FindFileDialog.on_replaceButton_clicked

on_replaceButton_clicked()

Private slot to perform the requested replace actions.

#### FindFileDialog.on_replacetextCombo_editTextChanged

on_replacetextCombo_editTextChanged(text)

Private slot to handle the editTextChanged signal of the replace text combo.

text
  (ignored)

#### FindFileDialog.setSearchDirectory

setSearchDirectory(searchDir)

Public slot to set the name of the directory to search in.

searchDir
  name of the directory to search in (string or QString)

#### FindFileDialog.show

show(txt = "")

Overwritten method to enable/disable the project button.

txt
  text to be shown in the searchtext combo (string or QString)

Up