UI/SearchWidget.py

changeset 6573
ccac2d1f6858
parent 6048
82ad8ec9548c
child 6645
ad476851d7e0
--- a/UI/SearchWidget.py	Thu Nov 01 15:43:03 2018 +0100
+++ b/UI/SearchWidget.py	Thu Nov 01 18:46:44 2018 +0100
@@ -19,23 +19,30 @@
     """
     Class implementing the search box for the shell, terminal and log viewer.
     
-    @signal searchNext(text, caseSensitive, wholeWord) emitted when the user
-        pressed the next button (string, boolean, boolean)
-    @signal searchPrevious(text, caseSensitive, wholeWord) emitted when the
-        user pressed the previous button (string, boolean, boolean)
+    @signal searchNext(text, caseSensitive, wholeWord, regexp) emitted when the
+        user pressed the next button (string, boolean, boolean)
+    @signal searchPrevious(text, caseSensitive, wholeWord, regexp) emitted when
+        the user pressed the previous button (string, boolean, boolean)
     """
-    searchNext = pyqtSignal(str, bool, bool)
-    searchPrevious = pyqtSignal(str, bool, bool)
+    searchNext = pyqtSignal(str, bool, bool, bool)
+    searchPrevious = pyqtSignal(str, bool, bool, bool)
     
-    def __init__(self, mainWindow, parent=None, spacer=True, showLine=False):
+    def __init__(self, mainWindow, parent=None, spacer=True, showLine=False,
+                 hideRegExp=False):
         """
         Constructor
         
-        @param mainWindow reference to the main window (QWidget)
-        @param parent reference to the parent widget (QWidget)
+        @param mainWindow reference to the main window
+        @type QWidget
+        @param parent reference to the parent widget
+        @type QWidget
         @param spacer flag indicating to add a vertical spacer to the
-            main layout (boolean)
-        @param showLine flag indicating to show all widget in one row (boolean)
+            main layout
+        @type bool
+        @param showLine flag indicating to show all widget in one row
+        @type bool
+        @param hideRegExp flag indicating to hide the Regexp checkbox
+        @type bool
         """
         super(SearchWidget, self).__init__(parent)
         
@@ -46,6 +53,11 @@
             from .Ui_SearchWidget import Ui_SearchWidget
             self.__ui = Ui_SearchWidget()
         self.__ui.setupUi(self)
+        
+        if hideRegExp:
+            self.__ui.regexpCheckBox.setChecked(False)
+            self.__ui.regexpCheckBox.hide()
+        
         if not showLine:
             if spacer:
                 spacerItem = QSpacerItem(
@@ -118,7 +130,9 @@
         self.searchNext.emit(
             txt,
             self.__ui.caseCheckBox.isChecked(),
-            self.__ui.wordCheckBox.isChecked())
+            self.__ui.wordCheckBox.isChecked(),
+            self.__ui.regexpCheckBox.isChecked(),
+        )
     
     @pyqtSlot()
     def on_findPrevButton_clicked(self):
@@ -143,7 +157,9 @@
         self.searchPrevious.emit(
             txt,
             self.__ui.caseCheckBox.isChecked(),
-            self.__ui.wordCheckBox.isChecked())
+            self.__ui.wordCheckBox.isChecked(),
+            self.__ui.regexpCheckBox.isChecked(),
+        )
     
     @pyqtSlot(str)
     def on_findtextCombo_editTextChanged(self, txt):

eric ide

mercurial