eric7/UI/UserInterface.py

branch
eric7
changeset 8614
4a3a68e51b92
parent 8610
c9cd21bcbe33
child 8618
356a2f1b04b0
equal deleted inserted replaced
8613:2af21036b293 8614:4a3a68e51b92
943 943
944 # Create the virtual environments management widget 944 # Create the virtual environments management widget
945 from VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget 945 from VirtualEnv.VirtualenvManagerWidgets import VirtualenvManagerWidget
946 self.__virtualenvManagerWidget = VirtualenvManagerWidget( 946 self.__virtualenvManagerWidget = VirtualenvManagerWidget(
947 self.virtualenvManager, self) 947 self.virtualenvManager, self)
948
949 # Create the find in files widget
950 from .FindFileWidget import FindFileWidget
951 self.__findFileWidget = FindFileWidget(self.project, self)
952 self.__findFileWidget.sourceFile.connect(
953 self.viewmanager.openSourceFile)
954 self.__findFileWidget.designerFile.connect(self.__designer)
948 955
949 def __createLayout(self): 956 def __createLayout(self):
950 """ 957 """
951 Private method to create the layout of the various windows. 958 Private method to create the layout of the various windows.
952 959
1063 1070
1064 self.rToolbox.addItem(self.debugViewer, 1071 self.rToolbox.addItem(self.debugViewer,
1065 UI.PixmapCache.getIcon("debugViewer"), 1072 UI.PixmapCache.getIcon("debugViewer"),
1066 self.tr("Debug-Viewer")) 1073 self.tr("Debug-Viewer"))
1067 1074
1075 self.rToolbox.addItem(self.__findFileWidget,
1076 UI.PixmapCache.getIcon("find"),
1077 self.tr("Find/Replace In Files"))
1078
1068 self.rToolbox.addItem(self.pluginRepositoryViewer, 1079 self.rToolbox.addItem(self.pluginRepositoryViewer,
1069 UI.PixmapCache.getIcon("pluginRepository"), 1080 UI.PixmapCache.getIcon("pluginRepository"),
1070 self.tr("Plugin Repository")) 1081 self.tr("Plugin Repository"))
1071 1082
1072 self.rToolbox.addItem(self.__virtualenvManagerWidget, 1083 self.rToolbox.addItem(self.__virtualenvManagerWidget,
1201 self.codeDocumentationViewer, 1212 self.codeDocumentationViewer,
1202 UI.PixmapCache.getIcon("sbCodeDocuViewer96"), 1213 UI.PixmapCache.getIcon("sbCodeDocuViewer96"),
1203 self.tr("Code Documentation Viewer")) 1214 self.tr("Code Documentation Viewer"))
1204 1215
1205 self.rightSidebar.addTab( 1216 self.rightSidebar.addTab(
1206 self.debugViewer, UI.PixmapCache.getIcon("sbDebugViewer96"), 1217 self.debugViewer,
1218 UI.PixmapCache.getIcon("sbDebugViewer96"),
1207 self.tr("Debug-Viewer")) 1219 self.tr("Debug-Viewer"))
1220
1221 self.rightSidebar.addTab(
1222 self.__findFileWidget,
1223 UI.PixmapCache.getIcon("sbFind96"),
1224 self.tr("Find/Replace In Files"))
1208 1225
1209 self.rightSidebar.addTab( 1226 self.rightSidebar.addTab(
1210 self.pluginRepositoryViewer, 1227 self.pluginRepositoryViewer,
1211 UI.PixmapCache.getIcon("sbPluginRepository96"), 1228 UI.PixmapCache.getIcon("sbPluginRepository96"),
1212 self.tr("Plugin Repository")) 1229 self.tr("Plugin Repository"))
2208 )) 2225 ))
2209 self.virtualenvManagerActivateAct.triggered.connect( 2226 self.virtualenvManagerActivateAct.triggered.connect(
2210 self.activateVirtualenvManager) 2227 self.activateVirtualenvManager)
2211 self.actions.append(self.virtualenvManagerActivateAct) 2228 self.actions.append(self.virtualenvManagerActivateAct)
2212 self.addAction(self.virtualenvManagerActivateAct) 2229 self.addAction(self.virtualenvManagerActivateAct)
2230
2231 self.findFileActivateAct = EricAction(
2232 self.tr("Find/Replace In Files"),
2233 self.tr("Find/Replace In Files"),
2234 QKeySequence(self.tr("Ctrl+Alt+Shift+F")),
2235 0, self,
2236 'find_file_activate')
2237 self.findFileActivateAct.setStatusTip(self.tr(
2238 "Switch the input focus to the Find/Replace In Files window."))
2239 self.findFileActivateAct.setWhatsThis(self.tr(
2240 """<b>Find/Replace In Files</b>"""
2241 """<p>This switches the input focus to the Find/Replace In Files"""
2242 """ window.</p>"""
2243 ))
2244 self.findFileActivateAct.triggered.connect(
2245 self.__activateFindFileWidget)
2246 self.actions.append(self.findFileActivateAct)
2247 self.addAction(self.findFileActivateAct)
2213 2248
2214 self.whatsThisAct = EricAction( 2249 self.whatsThisAct = EricAction(
2215 self.tr('What\'s This?'), 2250 self.tr('What\'s This?'),
2216 UI.PixmapCache.getIcon("whatsThis"), 2251 UI.PixmapCache.getIcon("whatsThis"),
2217 self.tr('&What\'s This?'), 2252 self.tr('&What\'s This?'),
3309 self.__menus["subwindow"].addAction(self.shellActivateAct) 3344 self.__menus["subwindow"].addAction(self.shellActivateAct)
3310 if self.codeDocumentationViewer is not None: 3345 if self.codeDocumentationViewer is not None:
3311 self.__menus["subwindow"].addAction( 3346 self.__menus["subwindow"].addAction(
3312 self.codeDocumentationViewerActivateAct) 3347 self.codeDocumentationViewerActivateAct)
3313 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) 3348 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3349 self.__menus["subwindow"].addAction(self.findFileActivateAct)
3314 self.__menus["subwindow"].addAction( 3350 self.__menus["subwindow"].addAction(
3315 self.pluginRepositoryViewerActivateAct) 3351 self.pluginRepositoryViewerActivateAct)
3316 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct) 3352 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct)
3317 if self.pipWidget is not None: 3353 if self.pipWidget is not None:
3318 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) 3354 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
6794 self.findFileNameDialog.designerFile.connect(self.__designer) 6830 self.findFileNameDialog.designerFile.connect(self.__designer)
6795 self.findFileNameDialog.show() 6831 self.findFileNameDialog.show()
6796 self.findFileNameDialog.raise_() 6832 self.findFileNameDialog.raise_()
6797 self.findFileNameDialog.activateWindow() 6833 self.findFileNameDialog.activateWindow()
6798 6834
6799 def showFindFilesDialog(self, txt="", searchDir="", openFiles=False): 6835 def showFindFilesWidget(self, txt="", searchDir="", openFiles=False):
6800 """ 6836 """
6801 Public slot to show the Find In Files dialog. 6837 Public slot to show the Find In Files widget.
6802 6838
6803 @param txt text to search for (string) 6839 @param txt text to search for (defaults to "")
6804 @param searchDir directory to search in (string) 6840 @type str (optional)
6805 @param openFiles flag indicating to operate on open files (boolean) 6841 @param searchDir directory to search in (defaults to "")
6806 """ 6842 @type str (optional)
6807 if self.findFilesDialog is None: 6843 @param openFiles flag indicating to operate on open files only
6808 from .FindFileDialog import FindFileDialog 6844 (defaults to False)
6809 self.findFilesDialog = FindFileDialog(self.project) 6845 @type bool (optional)
6810 self.findFilesDialog.sourceFile.connect( 6846 """
6811 self.viewmanager.openSourceFile) 6847 self.__activateFindFileWidget()
6812 self.findFilesDialog.designerFile.connect(self.__designer) 6848 self.__findFileWidget.activate(
6813 if searchDir: 6849 replaceMode=False, txt=txt, searchDir=searchDir,
6814 self.findFilesDialog.setSearchDirectory(searchDir) 6850 openFiles=openFiles)
6815 self.findFilesDialog.show(txt) 6851
6816 if openFiles: 6852 def showReplaceFilesWidget(self, txt="", searchDir="", openFiles=False):
6817 self.findFilesDialog.setOpenFiles() 6853 """
6818 self.findFilesDialog.raise_() 6854 Public slot to show the Find In Files widget in replace mode.
6819 self.findFilesDialog.activateWindow() 6855
6820 6856 @param txt text to search for (defaults to "")
6821 def showReplaceFilesDialog(self, txt="", searchDir="", openFiles=False): 6857 @type str (optional)
6822 """ 6858 @param searchDir directory to search in (defaults to "")
6823 Public slot to show the Find & Replace In Files dialog. 6859 @type str (optional)
6824 6860 @param openFiles flag indicating to operate on open files only
6825 @param txt text to search for (string) 6861 (defaults to False)
6826 @param searchDir directory to search in (string) 6862 @type bool (optional)
6827 @param openFiles flag indicating to operate on open files (boolean) 6863 """
6828 """ 6864 self.__activateFindFileWidget()
6829 if self.replaceFilesDialog is None: 6865 self.__findFileWidget.activate(
6830 from .FindFileDialog import FindFileDialog 6866 replaceMode=True, txt=txt, searchDir=searchDir,
6831 self.replaceFilesDialog = FindFileDialog( 6867 openFiles=openFiles)
6832 self.project, replaceMode=True) 6868
6833 self.replaceFilesDialog.sourceFile.connect( 6869 def __activateFindFileWidget(self):
6834 self.viewmanager.openSourceFile) 6870 """
6835 self.replaceFilesDialog.designerFile.connect(self.__designer) 6871 Private method to activate the Find In Files widget.
6836 if searchDir: 6872 """
6837 self.replaceFilesDialog.setSearchDirectory(searchDir) 6873 if self.__layoutType == "Toolboxes":
6838 self.replaceFilesDialog.show(txt) 6874 self.rToolboxDock.show()
6839 if openFiles: 6875 self.rToolbox.setCurrentWidget(self.__findFileWidget)
6840 self.replaceFilesDialog.setOpenFiles() 6876 elif self.__layoutType == "Sidebars":
6841 self.replaceFilesDialog.raise_() 6877 self.rightSidebar.show()
6842 self.replaceFilesDialog.activateWindow() 6878 self.rightSidebar.setCurrentWidget(self.__findFileWidget)
6879 self.__findFileWidget.setFocus(
6880 Qt.FocusReason.ActiveWindowFocusReason)
6881
6882 self.__findFileWidget.activate()
6843 6883
6844 ########################################################## 6884 ##########################################################
6845 ## Below are slots to handle StdOut and StdErr 6885 ## Below are slots to handle StdOut and StdErr
6846 ########################################################## 6886 ##########################################################
6847 6887

eric ide

mercurial