eric7/ViewManager/ViewManager.py

branch
eric7
changeset 8614
4a3a68e51b92
parent 8519
fd4722a8f782
child 8632
f25cd4b94eb0
equal deleted inserted replaced
8613:2af21036b293 8614:4a3a68e51b92
2845 """ 2845 """
2846 Private method defining the user interface actions for the search 2846 Private method defining the user interface actions for the search
2847 commands. 2847 commands.
2848 """ 2848 """
2849 self.searchActGrp = createActionGroup(self) 2849 self.searchActGrp = createActionGroup(self)
2850 self.searchOpenFilesActGrp = createActionGroup(self)
2850 2851
2851 self.searchAct = EricAction( 2852 self.searchAct = EricAction(
2852 QCoreApplication.translate('ViewManager', 'Search'), 2853 QCoreApplication.translate('ViewManager', 'Search'),
2853 UI.PixmapCache.getIcon("find"), 2854 UI.PixmapCache.getIcon("find"),
2854 QCoreApplication.translate('ViewManager', '&Search...'), 2855 QCoreApplication.translate('ViewManager', '&Search...'),
3180 'ViewManager', 'Search for a text in files')) 3181 'ViewManager', 'Search for a text in files'))
3181 self.searchFilesAct.setWhatsThis(QCoreApplication.translate( 3182 self.searchFilesAct.setWhatsThis(QCoreApplication.translate(
3182 'ViewManager', 3183 'ViewManager',
3183 """<b>Search in Files</b>""" 3184 """<b>Search in Files</b>"""
3184 """<p>Search for some text in the files of a directory tree""" 3185 """<p>Search for some text in the files of a directory tree"""
3185 """ or the project. A dialog is shown to enter the searchtext""" 3186 """ or the project. A window is shown to enter the searchtext"""
3186 """ and options for the search and to display the result.</p>""" 3187 """ and options for the search and to display the result.</p>"""
3187 )) 3188 ))
3188 self.searchFilesAct.triggered.connect(self.__searchFiles) 3189 self.searchFilesAct.triggered.connect(self.__searchFiles)
3189 self.searchActions.append(self.searchFilesAct) 3190 self.searchActions.append(self.searchFilesAct)
3190 3191
3199 'ViewManager', 'Search for a text in files and replace it')) 3200 'ViewManager', 'Search for a text in files and replace it'))
3200 self.replaceFilesAct.setWhatsThis(QCoreApplication.translate( 3201 self.replaceFilesAct.setWhatsThis(QCoreApplication.translate(
3201 'ViewManager', 3202 'ViewManager',
3202 """<b>Replace in Files</b>""" 3203 """<b>Replace in Files</b>"""
3203 """<p>Search for some text in the files of a directory tree""" 3204 """<p>Search for some text in the files of a directory tree"""
3204 """ or the project and replace it. A dialog is shown to enter""" 3205 """ or the project and replace it. A window is shown to enter"""
3205 """ the searchtext, the replacement text and options for the""" 3206 """ the searchtext, the replacement text and options for the"""
3206 """ search and to display the result.</p>""" 3207 """ search and to display the result.</p>"""
3207 )) 3208 ))
3208 self.replaceFilesAct.triggered.connect(self.__replaceFiles) 3209 self.replaceFilesAct.triggered.connect(self.__replaceFiles)
3209 self.searchActions.append(self.replaceFilesAct) 3210 self.searchActions.append(self.replaceFilesAct)
3216 'ViewManager', 'Search in Open Files...'), 3217 'ViewManager', 'Search in Open Files...'),
3217 QKeySequence(QCoreApplication.translate( 3218 QKeySequence(QCoreApplication.translate(
3218 'ViewManager', 3219 'ViewManager',
3219 "Meta+Ctrl+Alt+F", "Search|Search Open Files")), 3220 "Meta+Ctrl+Alt+F", "Search|Search Open Files")),
3220 0, 3221 0,
3221 self.searchActGrp, 'vm_search_in_open_files') 3222 self.searchOpenFilesActGrp, 'vm_search_in_open_files')
3222 self.searchOpenFilesAct.setStatusTip(QCoreApplication.translate( 3223 self.searchOpenFilesAct.setStatusTip(QCoreApplication.translate(
3223 'ViewManager', 'Search for a text in open files')) 3224 'ViewManager', 'Search for a text in open files'))
3224 self.searchOpenFilesAct.setWhatsThis(QCoreApplication.translate( 3225 self.searchOpenFilesAct.setWhatsThis(QCoreApplication.translate(
3225 'ViewManager', 3226 'ViewManager',
3226 """<b>Search in Open Files</b>""" 3227 """<b>Search in Open Files</b>"""
3227 """<p>Search for some text in the currently opened files.""" 3228 """<p>Search for some text in the currently opened files."""
3228 """ A dialog is shown to enter the searchtext""" 3229 """ A window is shown to enter the search text"""
3229 """ and options for the search and to display the result.</p>""" 3230 """ and options for the search and to display the result.</p>"""
3230 )) 3231 ))
3231 self.searchOpenFilesAct.triggered.connect(self.__searchOpenFiles) 3232 self.searchOpenFilesAct.triggered.connect(self.__searchOpenFiles)
3232 self.searchActions.append(self.searchOpenFilesAct) 3233 self.searchActions.append(self.searchOpenFilesAct)
3233 3234
3238 'ViewManager', 'Replace in Open Files...'), 3239 'ViewManager', 'Replace in Open Files...'),
3239 QKeySequence(QCoreApplication.translate( 3240 QKeySequence(QCoreApplication.translate(
3240 'ViewManager', 3241 'ViewManager',
3241 "Meta+Ctrl+Alt+R", "Search|Replace in Open Files")), 3242 "Meta+Ctrl+Alt+R", "Search|Replace in Open Files")),
3242 0, 3243 0,
3243 self.searchActGrp, 'vm_replace_in_open_files') 3244 self.searchOpenFilesActGrp, 'vm_replace_in_open_files')
3244 self.replaceOpenFilesAct.setStatusTip(QCoreApplication.translate( 3245 self.replaceOpenFilesAct.setStatusTip(QCoreApplication.translate(
3245 'ViewManager', 'Search for a text in open files and replace it')) 3246 'ViewManager', 'Search for a text in open files and replace it'))
3246 self.replaceOpenFilesAct.setWhatsThis(QCoreApplication.translate( 3247 self.replaceOpenFilesAct.setWhatsThis(QCoreApplication.translate(
3247 'ViewManager', 3248 'ViewManager',
3248 """<b>Replace in Open Files</b>""" 3249 """<b>Replace in Open Files</b>"""
3249 """<p>Search for some text in the currently opened files""" 3250 """<p>Search for some text in the currently opened files"""
3250 """ and replace it. A dialog is shown to enter""" 3251 """ and replace it. A window is shown to enter"""
3251 """ the searchtext, the replacement text and options for the""" 3252 """ the search text, the replacement text and options for the"""
3252 """ search and to display the result.</p>""" 3253 """ search and to display the result.</p>"""
3253 )) 3254 ))
3254 self.replaceOpenFilesAct.triggered.connect(self.__replaceOpenFiles) 3255 self.replaceOpenFilesAct.triggered.connect(self.__replaceOpenFiles)
3255 self.searchActions.append(self.replaceOpenFilesAct) 3256 self.searchActions.append(self.replaceOpenFilesAct)
3257
3258 self.searchOpenFilesActGrp.setEnabled(False)
3256 3259
3257 def initSearchMenu(self): 3260 def initSearchMenu(self):
3258 """ 3261 """
3259 Public method to create the Search menu. 3262 Public method to create the Search menu.
3260 3263
5676 5679
5677 def __searchFiles(self): 5680 def __searchFiles(self):
5678 """ 5681 """
5679 Private method to handle the search in files action. 5682 Private method to handle the search in files action.
5680 """ 5683 """
5681 self.ui.showFindFilesDialog(self.textForFind()) 5684 self.ui.showFindFilesWidget(self.textForFind())
5682 5685
5683 def __replaceFiles(self): 5686 def __replaceFiles(self):
5684 """ 5687 """
5685 Private method to handle the replace in files action. 5688 Private method to handle the replace in files action.
5686 """ 5689 """
5687 self.ui.showReplaceFilesDialog(self.textForFind()) 5690 self.ui.showReplaceFilesWidget(self.textForFind())
5688 5691
5689 def __searchOpenFiles(self): 5692 def __searchOpenFiles(self):
5690 """ 5693 """
5691 Private method to handle the search in open files action. 5694 Private method to handle the search in open files action.
5692 """ 5695 """
5693 self.ui.showFindFilesDialog(self.textForFind(), openFiles=True) 5696 self.ui.showFindFilesWidget(self.textForFind(), openFiles=True)
5694 5697
5695 def __replaceOpenFiles(self): 5698 def __replaceOpenFiles(self):
5696 """ 5699 """
5697 Private method to handle the replace in open files action. 5700 Private method to handle the replace in open files action.
5698 """ 5701 """
5699 self.ui.showReplaceFilesDialog(self.textForFind(), openFiles=True) 5702 self.ui.showReplaceFilesWidget(self.textForFind(), openFiles=True)
5700 5703
5701 ################################################################## 5704 ##################################################################
5702 ## Below are the action methods for the view menu 5705 ## Below are the action methods for the view menu
5703 ################################################################## 5706 ##################################################################
5704 5707
6338 self.printAct.setEnabled(False) 6341 self.printAct.setEnabled(False)
6339 if self.printPreviewAct: 6342 if self.printPreviewAct:
6340 self.printPreviewAct.setEnabled(False) 6343 self.printPreviewAct.setEnabled(False)
6341 self.editActGrp.setEnabled(False) 6344 self.editActGrp.setEnabled(False)
6342 self.searchActGrp.setEnabled(False) 6345 self.searchActGrp.setEnabled(False)
6346 self.searchOpenFilesActGrp.setEnabled(False)
6343 self.viewActGrp.setEnabled(False) 6347 self.viewActGrp.setEnabled(False)
6344 self.viewFoldActGrp.setEnabled(False) 6348 self.viewFoldActGrp.setEnabled(False)
6345 self.unhighlightAct.setEnabled(False) 6349 self.unhighlightAct.setEnabled(False)
6346 self.newDocumentViewAct.setEnabled(False) 6350 self.newDocumentViewAct.setEnabled(False)
6347 self.newDocumentSplitViewAct.setEnabled(False) 6351 self.newDocumentSplitViewAct.setEnabled(False)
6384 self.printAct.setEnabled(True) 6388 self.printAct.setEnabled(True)
6385 if self.printPreviewAct: 6389 if self.printPreviewAct:
6386 self.printPreviewAct.setEnabled(True) 6390 self.printPreviewAct.setEnabled(True)
6387 self.editActGrp.setEnabled(True) 6391 self.editActGrp.setEnabled(True)
6388 self.searchActGrp.setEnabled(True) 6392 self.searchActGrp.setEnabled(True)
6393 self.searchOpenFilesActGrp.setEnabled(True)
6389 self.viewActGrp.setEnabled(True) 6394 self.viewActGrp.setEnabled(True)
6390 self.viewFoldActGrp.setEnabled(True) 6395 self.viewFoldActGrp.setEnabled(True)
6391 self.unhighlightAct.setEnabled(True) 6396 self.unhighlightAct.setEnabled(True)
6392 self.newDocumentViewAct.setEnabled(True) 6397 self.newDocumentViewAct.setEnabled(True)
6393 if self.canSplit(): 6398 if self.canSplit():

eric ide

mercurial