# eric6.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(str)
  emitted to open a Qt-Designer file
sourceFile(str, int, str, 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 'Directory' radio button.
on_dirPicker_editTextChanged | Private slot to handle the textChanged signal of the directory picker.
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_openFilesButton_clicked | Private slot to handle the selection of the 'Open Files' radio button.
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.
setOpenFiles | Public slot to set the mode to search in open files.
setSearchDirectory | Public slot to set the name of the directory to search in.
show | Public 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
replaceMode
  flag indicating the replace dialog mode (boolean)
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)
line
  line number (integer)
text
  text found (string)
start
  start position of match (integer)
end
  end position of match (integer)
replTxt
  text with replacements applied (string)
md5=
  MD5 hash of the file (string)

#### 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 'Directory' radio button.

#### FindFileDialog.on_dirPicker_editTextChanged

on_dirPicker_editTextChanged(text)

Private slot to handle the textChanged signal of the directory picker.

text
  (ignored)

#### 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(text)

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_openFilesButton_clicked

on_openFilesButton_clicked()

Private slot to handle the selection of the 'Open Files' radio button.

#### 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.setOpenFiles

setOpenFiles()

Public slot to set the mode to search in open files.

#### 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)

#### FindFileDialog.show

show(txt="")

Public method to enable/disable the project button.

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

Up