eric7/UI/UserInterface.py

branch
eric7
changeset 8678
85a83e4e7f18
parent 8637
394377638256
child 8680
85503ff2fce9
equal deleted inserted replaced
8677:2e3d02a0f0b6 8678:85a83e4e7f18
972 972
973 # Create the VCS Status widget 973 # Create the VCS Status widget
974 from VCS.StatusWidget import StatusWidget 974 from VCS.StatusWidget import StatusWidget
975 self.__vcsStatusWidget = StatusWidget( 975 self.__vcsStatusWidget = StatusWidget(
976 self.project, self.viewmanager, self) 976 self.project, self.viewmanager, self)
977
978 # Create the embedded help viewer
979 from HelpViewer.HelpViewerWidget import HelpViewerWidget
980 self.__helpViewerWidget = HelpViewerWidget(self)
977 981
978 def __createLayout(self): 982 def __createLayout(self):
979 """ 983 """
980 Private method to create the layout of the various windows. 984 Private method to create the layout of the various windows.
981 985
1056 1060
1057 #################################################### 1061 ####################################################
1058 ## Populate the left toolbox 1062 ## Populate the left toolbox
1059 #################################################### 1063 ####################################################
1060 1064
1065 self.lToolbox.addItem(self.multiProjectBrowser,
1066 UI.PixmapCache.getIcon("multiProjectViewer"),
1067 self.tr("Multiproject-Viewer"))
1068
1061 self.lToolbox.addItem(self.projectBrowser, 1069 self.lToolbox.addItem(self.projectBrowser,
1062 UI.PixmapCache.getIcon("projectViewer"), 1070 UI.PixmapCache.getIcon("projectViewer"),
1063 self.tr("Project-Viewer")) 1071 self.tr("Project-Viewer"))
1064 1072
1073 self.lToolbox.addItem(self.__findFileWidget,
1074 UI.PixmapCache.getIcon("find"),
1075 self.tr("Find/Replace In Files"))
1076
1077 self.lToolbox.addItem(self.__findLocationWidget,
1078 UI.PixmapCache.getIcon("findLocation"),
1079 self.tr("Find File"))
1080
1065 self.lToolbox.addItem(self.__vcsStatusWidget, 1081 self.lToolbox.addItem(self.__vcsStatusWidget,
1066 UI.PixmapCache.getIcon("tbVcsStatus"), 1082 UI.PixmapCache.getIcon("tbVcsStatus"),
1067 self.tr("VCS Status")) 1083 self.tr("VCS Status"))
1068
1069 self.lToolbox.addItem(self.multiProjectBrowser,
1070 UI.PixmapCache.getIcon("multiProjectViewer"),
1071 self.tr("Multiproject-Viewer"))
1072 1084
1073 if self.templateViewer: 1085 if self.templateViewer:
1074 self.lToolbox.addItem(self.templateViewer, 1086 self.lToolbox.addItem(self.templateViewer,
1075 UI.PixmapCache.getIcon("templateViewer"), 1087 UI.PixmapCache.getIcon("templateViewer"),
1076 self.tr("Template-Viewer")) 1088 self.tr("Template-Viewer"))
1077 1089
1078 if self.browser: 1090 if self.browser:
1079 self.lToolbox.addItem(self.browser, 1091 self.lToolbox.addItem(self.browser,
1080 UI.PixmapCache.getIcon("browser"), 1092 UI.PixmapCache.getIcon("browser"),
1081 self.tr("File-Browser")) 1093 self.tr("File-Browser"))
1082 1094
1087 1099
1088 #################################################### 1100 ####################################################
1089 ## Populate the right toolbox 1101 ## Populate the right toolbox
1090 #################################################### 1102 ####################################################
1091 1103
1104 self.rToolbox.addItem(self.debugViewer,
1105 UI.PixmapCache.getIcon("debugViewer"),
1106 self.tr("Debug-Viewer"))
1107
1092 if self.codeDocumentationViewer: 1108 if self.codeDocumentationViewer:
1093 self.rToolbox.addItem(self.codeDocumentationViewer, 1109 self.rToolbox.addItem(self.codeDocumentationViewer,
1094 UI.PixmapCache.getIcon("codeDocuViewer"), 1110 UI.PixmapCache.getIcon("codeDocuViewer"),
1095 self.tr("Code Documentation Viewer")) 1111 self.tr("Code Documentation Viewer"))
1096 1112
1097 self.rToolbox.addItem(self.debugViewer, 1113 self.rToolbox.addItem(self.__helpViewerWidget,
1098 UI.PixmapCache.getIcon("debugViewer"), 1114 UI.PixmapCache.getIcon("help"),
1099 self.tr("Debug-Viewer")) 1115 self.tr("Help Viewer"))
1100
1101 self.rToolbox.addItem(self.__findFileWidget,
1102 UI.PixmapCache.getIcon("find"),
1103 self.tr("Find/Replace In Files"))
1104
1105 self.rToolbox.addItem(self.__findLocationWidget,
1106 UI.PixmapCache.getIcon("findLocation"),
1107 self.tr("Find File"))
1108 1116
1109 self.rToolbox.addItem(self.pluginRepositoryViewer, 1117 self.rToolbox.addItem(self.pluginRepositoryViewer,
1110 UI.PixmapCache.getIcon("pluginRepository"), 1118 UI.PixmapCache.getIcon("pluginRepository"),
1111 self.tr("Plugin Repository")) 1119 self.tr("Plugin Repository"))
1112 1120
1113 self.rToolbox.addItem(self.__virtualenvManagerWidget, 1121 self.rToolbox.addItem(self.__virtualenvManagerWidget,
1114 UI.PixmapCache.getIcon("virtualenv"), 1122 UI.PixmapCache.getIcon("virtualenv"),
1115 self.tr("Virtual Environments")) 1123 self.tr("Virtual Environments"))
1124
1116 if self.pipWidget: 1125 if self.pipWidget:
1117 self.rToolbox.addItem(self.pipWidget, 1126 self.rToolbox.addItem(self.pipWidget,
1118 UI.PixmapCache.getIcon("pypi"), 1127 UI.PixmapCache.getIcon("pypi"),
1119 self.tr("PyPI")) 1128 self.tr("PyPI"))
1120 1129
1204 #################################################### 1213 ####################################################
1205 ## Populate the left side bar 1214 ## Populate the left side bar
1206 #################################################### 1215 ####################################################
1207 1216
1208 self.leftSidebar.addTab( 1217 self.leftSidebar.addTab(
1218 self.multiProjectBrowser,
1219 UI.PixmapCache.getIcon("sbMultiProjectViewer96"),
1220 self.tr("Multiproject-Viewer"))
1221
1222 self.leftSidebar.addTab(
1209 self.projectBrowser, 1223 self.projectBrowser,
1210 UI.PixmapCache.getIcon("sbProjectViewer96"), 1224 UI.PixmapCache.getIcon("sbProjectViewer96"),
1211 self.tr("Project-Viewer")) 1225 self.tr("Project-Viewer"))
1212 1226
1227 self.leftSidebar.addTab(
1228 self.__findFileWidget,
1229 UI.PixmapCache.getIcon("sbFind96"),
1230 self.tr("Find/Replace In Files"))
1231
1232 self.leftSidebar.addTab(
1233 self.__findLocationWidget,
1234 UI.PixmapCache.getIcon("sbFindLocation96"),
1235 self.tr("Find File"))
1236
1213 self.leftSidebar.addTab( 1237 self.leftSidebar.addTab(
1214 self.__vcsStatusWidget, 1238 self.__vcsStatusWidget,
1215 UI.PixmapCache.getIcon("sbVcsStatus96"), 1239 UI.PixmapCache.getIcon("sbVcsStatus96"),
1216 self.tr("VCS Status")) 1240 self.tr("VCS Status"))
1217 1241
1218 self.leftSidebar.addTab(
1219 self.multiProjectBrowser,
1220 UI.PixmapCache.getIcon("sbMultiProjectViewer96"),
1221 self.tr("Multiproject-Viewer"))
1222
1223 if self.templateViewer: 1242 if self.templateViewer:
1224 self.leftSidebar.addTab( 1243 self.leftSidebar.addTab(
1225 self.templateViewer, 1244 self.templateViewer,
1226 UI.PixmapCache.getIcon("sbTemplateViewer96"), 1245 UI.PixmapCache.getIcon("sbTemplateViewer96"),
1227 self.tr("Template-Viewer")) 1246 self.tr("Template-Viewer"))
1228 1247
1229 if self.browser: 1248 if self.browser:
1230 self.leftSidebar.addTab( 1249 self.leftSidebar.addTab(
1231 self.browser, 1250 self.browser,
1232 UI.PixmapCache.getIcon("sbFileBrowser96"), 1251 UI.PixmapCache.getIcon("sbFileBrowser96"),
1233 self.tr("File-Browser")) 1252 self.tr("File-Browser"))
1240 1259
1241 #################################################### 1260 ####################################################
1242 ## Populate the right side bar 1261 ## Populate the right side bar
1243 #################################################### 1262 ####################################################
1244 1263
1264 self.rightSidebar.addTab(
1265 self.debugViewer,
1266 UI.PixmapCache.getIcon("sbDebugViewer96"),
1267 self.tr("Debug-Viewer"))
1268
1245 if self.codeDocumentationViewer: 1269 if self.codeDocumentationViewer:
1246 self.rightSidebar.addTab( 1270 self.rightSidebar.addTab(
1247 self.codeDocumentationViewer, 1271 self.codeDocumentationViewer,
1248 UI.PixmapCache.getIcon("sbCodeDocuViewer96"), 1272 UI.PixmapCache.getIcon("sbCodeDocuViewer96"),
1249 self.tr("Code Documentation Viewer")) 1273 self.tr("Code Documentation Viewer"))
1250 1274
1251 self.rightSidebar.addTab( 1275 self.rightSidebar.addTab(
1252 self.debugViewer, 1276 self.__helpViewerWidget,
1253 UI.PixmapCache.getIcon("sbDebugViewer96"), 1277 UI.PixmapCache.getIcon("sbHelpViewer96"),
1254 self.tr("Debug-Viewer")) 1278 self.tr("Help Viewer"))
1255
1256 self.rightSidebar.addTab(
1257 self.__findFileWidget,
1258 UI.PixmapCache.getIcon("sbFind96"),
1259 self.tr("Find/Replace In Files"))
1260
1261 self.rightSidebar.addTab(
1262 self.__findLocationWidget,
1263 UI.PixmapCache.getIcon("sbFindLocation96"),
1264 self.tr("Find File"))
1265 1279
1266 self.rightSidebar.addTab( 1280 self.rightSidebar.addTab(
1267 self.pluginRepositoryViewer, 1281 self.pluginRepositoryViewer,
1268 UI.PixmapCache.getIcon("sbPluginRepository96"), 1282 UI.PixmapCache.getIcon("sbPluginRepository96"),
1269 self.tr("Plugin Repository")) 1283 self.tr("Plugin Repository"))
2320 self.vcsStatusListActivateAct.triggered.connect( 2334 self.vcsStatusListActivateAct.triggered.connect(
2321 self.__activateVcsStatusList) 2335 self.__activateVcsStatusList)
2322 self.actions.append(self.vcsStatusListActivateAct) 2336 self.actions.append(self.vcsStatusListActivateAct)
2323 self.addAction(self.vcsStatusListActivateAct) 2337 self.addAction(self.vcsStatusListActivateAct)
2324 2338
2339 self.helpViewerActivateAct = EricAction(
2340 self.tr("Help Viewer"),
2341 self.tr("Help Viewer"),
2342 QKeySequence(self.tr("Alt+Shift+H")),
2343 0, self,
2344 'help_viewer_activate')
2345 self.helpViewerActivateAct.setStatusTip(self.tr(
2346 "Switch the input focus to the embedded Help Viewer window."))
2347 self.helpViewerActivateAct.setWhatsThis(self.tr(
2348 """<b>Help Viewer</b>"""
2349 """<p>This switches the input focus to the embedded Help Viewer"""
2350 """ window. It will show HTML help files and help from Qt help"""
2351 """ collections.</p><p>If called with a word selected, this word"""
2352 """ is searched in the Qt help collection.</p>"""
2353 ))
2354 self.helpViewerActivateAct.triggered.connect(
2355 self.__activateHelpViewerWidget)
2356 self.actions.append(self.helpViewerActivateAct)
2357 self.addAction(self.helpViewerActivateAct)
2358
2325 self.whatsThisAct = EricAction( 2359 self.whatsThisAct = EricAction(
2326 self.tr('What\'s This?'), 2360 self.tr('What\'s This?'),
2327 UI.PixmapCache.getIcon("whatsThis"), 2361 UI.PixmapCache.getIcon("whatsThis"),
2328 self.tr('&What\'s This?'), 2362 self.tr('&What\'s This?'),
2329 QKeySequence(self.tr("Shift+F1")), 2363 QKeySequence(self.tr("Shift+F1")),
2353 """<p>Display the eric web browser. This window will show""" 2387 """<p>Display the eric web browser. This window will show"""
2354 """ HTML help files and help from Qt help collections. It""" 2388 """ HTML help files and help from Qt help collections. It"""
2355 """ has the capability to navigate to links, set bookmarks,""" 2389 """ has the capability to navigate to links, set bookmarks,"""
2356 """ print the displayed help and some more features. You may""" 2390 """ print the displayed help and some more features. You may"""
2357 """ use it to browse the internet as well</p><p>If called""" 2391 """ use it to browse the internet as well</p><p>If called"""
2358 """ with a word selected, this word is search in the Qt help""" 2392 """ with a word selected, this word is searched in the Qt help"""
2359 """ collection.</p>""" 2393 """ collection.</p>"""
2360 )) 2394 ))
2361 self.helpviewerAct.triggered.connect(self.__helpViewer) 2395 self.helpviewerAct.triggered.connect(self.__helpViewer)
2362 self.actions.append(self.helpviewerAct) 2396 self.actions.append(self.helpviewerAct)
2363 2397
3394 3428
3395 # left side 3429 # left side
3396 self.__menus["subwindow"].addSection(self.tr("Left Side")) 3430 self.__menus["subwindow"].addSection(self.tr("Left Side"))
3397 if self.__shellPosition == "left": 3431 if self.__shellPosition == "left":
3398 self.__menus["subwindow"].addAction(self.shellActivateAct) 3432 self.__menus["subwindow"].addAction(self.shellActivateAct)
3433 self.__menus["subwindow"].addAction(self.mpbActivateAct)
3399 self.__menus["subwindow"].addAction(self.pbActivateAct) 3434 self.__menus["subwindow"].addAction(self.pbActivateAct)
3435 self.__menus["subwindow"].addAction(self.findFileActivateAct)
3436 self.__menus["subwindow"].addAction(self.findLocationActivateAct)
3400 self.__menus["subwindow"].addAction(self.vcsStatusListActivateAct) 3437 self.__menus["subwindow"].addAction(self.vcsStatusListActivateAct)
3401 self.__menus["subwindow"].addAction(self.mpbActivateAct)
3402 if self.templateViewer is not None: 3438 if self.templateViewer is not None:
3403 self.__menus["subwindow"].addAction(self.templateViewerActivateAct) 3439 self.__menus["subwindow"].addAction(self.templateViewerActivateAct)
3404 if self.browser is not None: 3440 if self.browser is not None:
3405 self.__menus["subwindow"].addAction(self.browserActivateAct) 3441 self.__menus["subwindow"].addAction(self.browserActivateAct)
3406 if self.symbolsViewer is not None: 3442 if self.symbolsViewer is not None:
3417 3453
3418 # right side 3454 # right side
3419 self.__menus["subwindow"].addSection(self.tr("Right Side")) 3455 self.__menus["subwindow"].addSection(self.tr("Right Side"))
3420 if self.__shellPosition == "right": 3456 if self.__shellPosition == "right":
3421 self.__menus["subwindow"].addAction(self.shellActivateAct) 3457 self.__menus["subwindow"].addAction(self.shellActivateAct)
3458 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3422 if self.codeDocumentationViewer is not None: 3459 if self.codeDocumentationViewer is not None:
3423 self.__menus["subwindow"].addAction( 3460 self.__menus["subwindow"].addAction(
3424 self.codeDocumentationViewerActivateAct) 3461 self.codeDocumentationViewerActivateAct)
3425 self.__menus["subwindow"].addAction(self.debugViewerActivateAct) 3462 self.__menus["subwindow"].addAction(
3426 self.__menus["subwindow"].addAction(self.findFileActivateAct) 3463 self.helpViewerActivateAct)
3427 self.__menus["subwindow"].addAction(self.findLocationActivateAct)
3428 self.__menus["subwindow"].addAction( 3464 self.__menus["subwindow"].addAction(
3429 self.pluginRepositoryViewerActivateAct) 3465 self.pluginRepositoryViewerActivateAct)
3430 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct) 3466 self.__menus["subwindow"].addAction(self.virtualenvManagerActivateAct)
3431 if self.pipWidget is not None: 3467 if self.pipWidget is not None:
3432 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct) 3468 self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
3438 if self.irc is not None: 3474 if self.irc is not None:
3439 self.__menus["subwindow"].addAction(self.ircActivateAct) 3475 self.__menus["subwindow"].addAction(self.ircActivateAct)
3440 if self.microPythonWidget is not None: 3476 if self.microPythonWidget is not None:
3441 self.__menus["subwindow"].addAction( 3477 self.__menus["subwindow"].addAction(
3442 self.microPythonWidgetActivateAct) 3478 self.microPythonWidgetActivateAct)
3479
3480 # plug-in provided windows
3443 self.__menus["subwindow"].addSection(self.tr("Plug-ins")) 3481 self.__menus["subwindow"].addSection(self.tr("Plug-ins"))
3444 3482
3445 ############################################################## 3483 ##############################################################
3446 ## Window/Toolbars menu 3484 ## Window/Toolbars menu
3447 ############################################################## 3485 ##############################################################
6947 def __activateFindFileWidget(self): 6985 def __activateFindFileWidget(self):
6948 """ 6986 """
6949 Private slot to activate the Find In Files widget. 6987 Private slot to activate the Find In Files widget.
6950 """ 6988 """
6951 if self.__layoutType == "Toolboxes": 6989 if self.__layoutType == "Toolboxes":
6952 self.rToolboxDock.show() 6990 self.lToolboxDock.show()
6953 self.rToolbox.setCurrentWidget(self.__findFileWidget) 6991 self.lToolbox.setCurrentWidget(self.__findFileWidget)
6954 elif self.__layoutType == "Sidebars": 6992 elif self.__layoutType == "Sidebars":
6955 self.rightSidebar.show() 6993 self.leftSidebar.show()
6956 self.rightSidebar.setCurrentWidget(self.__findFileWidget) 6994 self.leftSidebar.setCurrentWidget(self.__findFileWidget)
6957 self.__findFileWidget.setFocus( 6995 self.__findFileWidget.setFocus(
6958 Qt.FocusReason.ActiveWindowFocusReason) 6996 Qt.FocusReason.ActiveWindowFocusReason)
6959 6997
6960 self.__findFileWidget.activate() 6998 self.__findFileWidget.activate()
6961 6999
6968 def __activateFindLocationWidget(self): 7006 def __activateFindLocationWidget(self):
6969 """ 7007 """
6970 Private method to activate the Find File widget. 7008 Private method to activate the Find File widget.
6971 """ 7009 """
6972 if self.__layoutType == "Toolboxes": 7010 if self.__layoutType == "Toolboxes":
6973 self.rToolboxDock.show() 7011 self.lToolboxDock.show()
6974 self.rToolbox.setCurrentWidget(self.__findLocationWidget) 7012 self.lToolbox.setCurrentWidget(self.__findLocationWidget)
6975 elif self.__layoutType == "Sidebars": 7013 elif self.__layoutType == "Sidebars":
6976 self.rightSidebar.show() 7014 self.leftSidebar.show()
6977 self.rightSidebar.setCurrentWidget(self.__findLocationWidget) 7015 self.leftSidebar.setCurrentWidget(self.__findLocationWidget)
6978 self.__findLocationWidget.setFocus( 7016 self.__findLocationWidget.setFocus(
6979 Qt.FocusReason.ActiveWindowFocusReason) 7017 Qt.FocusReason.ActiveWindowFocusReason)
6980 7018
6981 self.__findLocationWidget.activate() 7019 self.__findLocationWidget.activate()
6982 7020
6990 elif self.__layoutType == "Sidebars": 7028 elif self.__layoutType == "Sidebars":
6991 self.leftSidebar.show() 7029 self.leftSidebar.show()
6992 self.leftSidebar.setCurrentWidget(self.__vcsStatusWidget) 7030 self.leftSidebar.setCurrentWidget(self.__vcsStatusWidget)
6993 self.__vcsStatusWidget.setFocus( 7031 self.__vcsStatusWidget.setFocus(
6994 Qt.FocusReason.ActiveWindowFocusReason) 7032 Qt.FocusReason.ActiveWindowFocusReason)
7033
7034 def __activateHelpViewerWidget(self):
7035 """
7036 Private method to activate the embedded Help Viewer window.
7037 """
7038 if self.__layoutType == "Toolboxes":
7039 self.rToolboxDock.show()
7040 self.rToolbox.setCurrentWidget(self.__helpViewerWidget)
7041 elif self.__layoutType == "Sidebars":
7042 self.rightSidebar.show()
7043 self.rightSidebar.setCurrentWidget(self.__helpViewerWidget)
7044 self.__helpViewerWidget.setFocus(
7045 Qt.FocusReason.ActiveWindowFocusReason)
7046
7047 searchWord = self.viewmanager.textForFind(False)
7048 if searchWord == "":
7049 searchWord = None
7050 self.__helpViewerWidget.activate(searchWord=searchWord)
6995 7051
6996 ########################################################## 7052 ##########################################################
6997 ## Below are slots to handle StdOut and StdErr 7053 ## Below are slots to handle StdOut and StdErr
6998 ########################################################## 7054 ##########################################################
6999 7055

eric ide

mercurial