ViewManager/ViewManager.py

changeset 2213
022f4ad3ed19
parent 2211
86bdcfac4a4a
child 2214
4ce1ebcc3806
--- a/ViewManager/ViewManager.py	Sat Nov 10 16:19:22 2012 +0100
+++ b/ViewManager/ViewManager.py	Sat Nov 10 18:05:51 2012 +0100
@@ -2291,6 +2291,8 @@
         searchMenu.addAction(self.searchAct)
         searchMenu.addAction(self.searchNextAct)
         searchMenu.addAction(self.searchPrevAct)
+        searchMenu.addAction(self.searchNextWordAct)
+        searchMenu.addAction(self.searchPrevWordAct)
         searchMenu.addAction(self.replaceAct)
         searchMenu.addSeparator()
         searchMenu.addAction(self.searchClearMarkersAct)
@@ -2451,6 +2453,42 @@
         self.searchClearMarkersAct.triggered[()].connect(self.__searchClearMarkers)
         self.searchActions.append(self.searchClearMarkersAct)
         
+        self.searchNextWordAct = E5Action(QApplication.translate('ViewManager',
+                    'Search current word forward'),
+                UI.PixmapCache.getIcon("findWordNext.png"),
+                QApplication.translate('ViewManager', 'Search current word forward'),
+                QKeySequence(QApplication.translate('ViewManager',
+                    "Ctrl+.", "Search|Search current word forward")),
+                0,
+                self.searchActGrp, 'vm_search_word_next')
+        self.searchNextWordAct.setStatusTip(QApplication.translate('ViewManager',
+            'Search next occurrence of the current word'))
+        self.searchNextWordAct.setWhatsThis(QApplication.translate('ViewManager',
+            """<b>Search current word forward</b>"""
+            """<p>Search the next occurrence of the current word of the current"""
+            """ editor.</p>"""
+        ))
+        self.searchNextWordAct.triggered[()].connect(self.__findNextWord)
+        self.searchActions.append(self.searchNextWordAct)
+        
+        self.searchPrevWordAct = E5Action(QApplication.translate('ViewManager',
+                    'Search current word backward'),
+                UI.PixmapCache.getIcon("findWordPrev.png"),
+                QApplication.translate('ViewManager', 'Search current word backward'),
+                QKeySequence(QApplication.translate('ViewManager',
+                    "Ctrl+,", "Search|Search current word backward")),
+                0,
+                self.searchActGrp, 'vm_search_word_previous')
+        self.searchPrevWordAct.setStatusTip(QApplication.translate('ViewManager',
+            'Search previous occurrence of the current word'))
+        self.searchPrevWordAct.setWhatsThis(QApplication.translate('ViewManager',
+            """<b>Search current word backward</b>"""
+            """<p>Search the previous occurrence of the current word of the current"""
+            """ editor.</p>"""
+        ))
+        self.searchPrevWordAct.triggered[()].connect(self.__findPrevWord)
+        self.searchActions.append(self.searchPrevWordAct)
+        
         self.replaceAct = E5Action(QApplication.translate('ViewManager', 'Replace'),
                 QApplication.translate('ViewManager', '&Replace...'),
                 QKeySequence(QApplication.translate('ViewManager',
@@ -4762,6 +4800,20 @@
         self.searchDlg.close()
         self.replaceDlg.show(self.textForFind())
         
+    def __findNextWord(self):
+        """
+        Private slot to find the next occurrence of the current word of the current
+        editor.
+        """
+        self.activeWindow().searchCurrentWordForward()
+        
+    def __findPrevWord(self):
+        """
+        Private slot to find the previous occurrence of the current word of the current
+        editor.
+        """
+        self.activeWindow().searchCurrentWordBackward()
+        
     def __searchClearMarkers(self):
         """
         Private method to clear the search markers of the active window.

eric ide

mercurial