eric7/UI/UserInterface.py

branch
eric7
changeset 8727
e2f8a0fbf738
parent 8722
2f57e52a704b
child 8728
62b44a7c0a3a
equal deleted inserted replaced
8726:12c25acee031 8727:e2f8a0fbf738
1158 1158
1159 #################################################### 1159 ####################################################
1160 ## Populate the bottom toolbox 1160 ## Populate the bottom toolbox
1161 #################################################### 1161 ####################################################
1162 1162
1163 self.hToolbox.addItem(self.shellAssembly,
1164 UI.PixmapCache.getIcon("shell"),
1165 self.tr("Shell"))
1166
1163 self.hToolbox.addItem(self.taskViewer, 1167 self.hToolbox.addItem(self.taskViewer,
1164 UI.PixmapCache.getIcon("task"), 1168 UI.PixmapCache.getIcon("task"),
1165 self.tr("Task-Viewer")) 1169 self.tr("Task-Viewer"))
1166 1170
1167 self.hToolbox.addItem(self.logViewer, 1171 self.hToolbox.addItem(self.logViewer,
1172 self.hToolbox.addItem(self.numbersViewer, 1176 self.hToolbox.addItem(self.numbersViewer,
1173 UI.PixmapCache.getIcon("numbers"), 1177 UI.PixmapCache.getIcon("numbers"),
1174 self.tr("Numbers")) 1178 self.tr("Numbers"))
1175 1179
1176 #################################################### 1180 ####################################################
1177 ## Populate the configurable widgets
1178 ####################################################
1179
1180 self.__shellPosition = Preferences.getUI("ShellPosition")
1181 if self.__shellPosition == "left":
1182 self.__shellParent = self.lToolboxDock
1183 elif self.__shellPosition == "right":
1184 self.__shellParent = self.rToolboxDock
1185 else:
1186 self.__shellParent = self.hToolboxDock
1187 self.__shellParent.widget().insertItem(
1188 0, self.shellAssembly, UI.PixmapCache.getIcon("shell"),
1189 self.tr("Shell"))
1190
1191 ####################################################
1192 ## Set the start index of each toolbox 1181 ## Set the start index of each toolbox
1193 #################################################### 1182 ####################################################
1194 1183
1195 self.lToolbox.setCurrentIndex(0) 1184 self.lToolbox.setCurrentIndex(0)
1196 self.rToolbox.setCurrentIndex(0) 1185 self.rToolbox.setCurrentIndex(0)
1213 self.bottomSidebar = EricSideBar(EricSideBarSide.SOUTH, 1202 self.bottomSidebar = EricSideBar(EricSideBarSide.SOUTH,
1214 Preferences.getUI("IconBarSize")) 1203 Preferences.getUI("IconBarSize"))
1215 self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) 1204 self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor"))
1216 1205
1217 # Create the right sidebar 1206 # Create the right sidebar
1218 self.rightSidebar = EricSideBar(EricSideBarSide.EAST, 1207 if Preferences.getUI("CombinedLeftRightSidebar"):
1219 Preferences.getUI("IconBarSize")) 1208 # combine left and right sidebar on the left side
1220 self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) 1209 self.rightSidebar = None
1221 1210 else:
1211 self.rightSidebar = EricSideBar(
1212 EricSideBarSide.EAST, Preferences.getUI("IconBarSize"))
1213 self.rightSidebar.setIconBarColor(
1214 Preferences.getUI("IconBarColor"))
1215
1222 #################################################### 1216 ####################################################
1223 ## Populate the left side bar 1217 ## Populate the left side bar
1224 #################################################### 1218 ####################################################
1225 1219
1226 self.leftSidebar.addTab( 1220 self.leftSidebar.addTab(
1264 self.leftSidebar.addTab( 1258 self.leftSidebar.addTab(
1265 self.symbolsViewer, 1259 self.symbolsViewer,
1266 UI.PixmapCache.getIcon("sbSymbolsViewer96"), 1260 UI.PixmapCache.getIcon("sbSymbolsViewer96"),
1267 self.tr("Symbols")) 1261 self.tr("Symbols"))
1268 1262
1269 #################################################### 1263 ##############################################################
1270 ## Populate the right side bar 1264 ## Populate the right side bar or combined left sidebar
1271 #################################################### 1265 ##############################################################
1272 1266
1273 # TODO: add option to add all tools to the left sidebar 1267 # TODO: add option to add all tools to the left sidebar
1274 # possibly with different order (e.g. debug after VCS) 1268 # possibly with different order (e.g. debug after VCS)
1275 self.rightSidebar.addTab( 1269 sidebar = self.rightSidebar or self.leftSidebar
1276 self.debugViewer, 1270
1277 UI.PixmapCache.getIcon("sbDebugViewer96"), 1271 if sidebar is self.leftSidebar:
1278 self.tr("Debug-Viewer")) 1272 # place debug viewer after 'VCS Status' widget
1273 index = self.leftSidebar.indexOf(self.__vcsStatusWidget) + 1
1274 sidebar.insertTab(
1275 index,
1276 self.debugViewer,
1277 UI.PixmapCache.getIcon("sbDebugViewer96"),
1278 self.tr("Debug-Viewer"))
1279 else:
1280 sidebar.addTab(
1281 self.debugViewer,
1282 UI.PixmapCache.getIcon("sbDebugViewer96"),
1283 self.tr("Debug-Viewer"))
1279 1284
1280 if self.codeDocumentationViewer: 1285 if self.codeDocumentationViewer:
1281 self.rightSidebar.addTab( 1286 sidebar.addTab(
1282 self.codeDocumentationViewer, 1287 self.codeDocumentationViewer,
1283 UI.PixmapCache.getIcon("sbCodeDocuViewer96"), 1288 UI.PixmapCache.getIcon("sbCodeDocuViewer96"),
1284 self.tr("Code Documentation Viewer")) 1289 self.tr("Code Documentation Viewer"))
1285 1290
1286 if self.__helpViewerWidget: 1291 if self.__helpViewerWidget:
1287 self.rightSidebar.addTab( 1292 sidebar.addTab(
1288 self.__helpViewerWidget, 1293 self.__helpViewerWidget,
1289 UI.PixmapCache.getIcon("sbHelpViewer96"), 1294 UI.PixmapCache.getIcon("sbHelpViewer96"),
1290 self.tr("Help Viewer")) 1295 self.tr("Help Viewer"))
1291 1296
1292 self.rightSidebar.addTab( 1297 sidebar.addTab(
1293 self.pluginRepositoryViewer, 1298 self.pluginRepositoryViewer,
1294 UI.PixmapCache.getIcon("sbPluginRepository96"), 1299 UI.PixmapCache.getIcon("sbPluginRepository96"),
1295 self.tr("Plugin Repository")) 1300 self.tr("Plugin Repository"))
1296 1301
1297 self.rightSidebar.addTab( 1302 sidebar.addTab(
1298 self.__virtualenvManagerWidget, 1303 self.__virtualenvManagerWidget,
1299 UI.PixmapCache.getIcon("sbVirtenvManager96"), 1304 UI.PixmapCache.getIcon("sbVirtenvManager96"),
1300 self.tr("Virtual Environments")) 1305 self.tr("Virtual Environments"))
1301 1306
1302 if self.pipWidget: 1307 if self.pipWidget:
1303 self.rightSidebar.addTab( 1308 sidebar.addTab(
1304 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"), 1309 self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"),
1305 self.tr("PyPI")) 1310 self.tr("PyPI"))
1306 1311
1307 if self.condaWidget: 1312 if self.condaWidget:
1308 self.rightSidebar.addTab( 1313 sidebar.addTab(
1309 self.condaWidget, UI.PixmapCache.getIcon("sbMiniconda96"), 1314 self.condaWidget, UI.PixmapCache.getIcon("sbMiniconda96"),
1310 self.tr("Conda")) 1315 self.tr("Conda"))
1311 1316
1312 if self.cooperation: 1317 if self.cooperation:
1313 self.rightSidebar.addTab( 1318 sidebar.addTab(
1314 self.cooperation, UI.PixmapCache.getIcon("sbCooperation96"), 1319 self.cooperation, UI.PixmapCache.getIcon("sbCooperation96"),
1315 self.tr("Cooperation")) 1320 self.tr("Cooperation"))
1316 1321
1317 if self.irc: 1322 if self.irc:
1318 self.rightSidebar.addTab( 1323 sidebar.addTab(
1319 self.irc, UI.PixmapCache.getIcon("sbIrc96"), 1324 self.irc, UI.PixmapCache.getIcon("sbIrc96"),
1320 self.tr("IRC")) 1325 self.tr("IRC"))
1321 1326
1322 if self.microPythonWidget: 1327 if self.microPythonWidget:
1323 self.rightSidebar.addTab( 1328 sidebar.addTab(
1324 self.microPythonWidget, 1329 self.microPythonWidget,
1325 UI.PixmapCache.getIcon("sbMicroPython96"), 1330 UI.PixmapCache.getIcon("sbMicroPython96"),
1326 self.tr("MicroPython")) 1331 self.tr("MicroPython"))
1327 1332
1328 #################################################### 1333 ####################################################
1329 ## Populate the bottom side bar 1334 ## Populate the bottom side bar
1330 #################################################### 1335 ####################################################
1336
1337 self.bottomSidebar.addTab(self.shellAssembly,
1338 UI.PixmapCache.getIcon("sbShell96"),
1339 self.tr("Shell"))
1331 1340
1332 self.bottomSidebar.addTab(self.taskViewer, 1341 self.bottomSidebar.addTab(self.taskViewer,
1333 UI.PixmapCache.getIcon("sbTasksViewer96"), 1342 UI.PixmapCache.getIcon("sbTasksViewer96"),
1334 self.tr("Task-Viewer")) 1343 self.tr("Task-Viewer"))
1335 1344
1341 self.bottomSidebar.addTab(self.numbersViewer, 1350 self.bottomSidebar.addTab(self.numbersViewer,
1342 UI.PixmapCache.getIcon("sbNumbers96"), 1351 UI.PixmapCache.getIcon("sbNumbers96"),
1343 self.tr("Numbers")) 1352 self.tr("Numbers"))
1344 1353
1345 #################################################### 1354 ####################################################
1346 ## Populate the configurable widgets
1347 ####################################################
1348
1349 self.__shellPosition = Preferences.getUI("ShellPosition")
1350 if self.__shellPosition == "left":
1351 self.__shellParent = self.leftSidebar
1352 elif self.__shellPosition == "right":
1353 self.__shellParent = self.rightSidebar
1354 else:
1355 self.__shellParent = self.bottomSidebar
1356 self.__shellParent.insertTab(0, self.shellAssembly,
1357 UI.PixmapCache.getIcon("sbShell96"),
1358 self.tr("Shell"))
1359
1360 ####################################################
1361 ## Set the start index of each side bar 1355 ## Set the start index of each side bar
1362 #################################################### 1356 ####################################################
1363 1357
1364 self.leftSidebar.setCurrentIndex(0) 1358 self.leftSidebar.setCurrentIndex(0)
1365 self.rightSidebar.setCurrentIndex(0) 1359 if self.rightSidebar:
1360 self.rightSidebar.setCurrentIndex(0)
1366 self.bottomSidebar.setCurrentIndex(0) 1361 self.bottomSidebar.setCurrentIndex(0)
1367 1362
1368 # create the central widget 1363 # create the central widget
1369 logging.debug("Creating central widget...") 1364 logging.debug("Creating central widget...")
1370 cw = self.centralWidget() # save the current central widget 1365 cw = self.centralWidget() # save the current central widget
1374 self.verticalSplitter.setChildrenCollapsible(False) 1369 self.verticalSplitter.setChildrenCollapsible(False)
1375 self.verticalSplitter.addWidget(cw) 1370 self.verticalSplitter.addWidget(cw)
1376 self.verticalSplitter.addWidget(self.bottomSidebar) 1371 self.verticalSplitter.addWidget(self.bottomSidebar)
1377 self.horizontalSplitter.addWidget(self.leftSidebar) 1372 self.horizontalSplitter.addWidget(self.leftSidebar)
1378 self.horizontalSplitter.addWidget(self.verticalSplitter) 1373 self.horizontalSplitter.addWidget(self.verticalSplitter)
1379 self.horizontalSplitter.addWidget(self.rightSidebar) 1374 if self.rightSidebar:
1375 self.horizontalSplitter.addWidget(self.rightSidebar)
1380 self.setCentralWidget(self.horizontalSplitter) 1376 self.setCentralWidget(self.horizontalSplitter)
1381 1377
1382 def addSideWidget(self, side, widget, icon, label): 1378 def addSideWidget(self, side, widget, icon, label):
1383 """ 1379 """
1384 Public method to add a widget to the sides. 1380 Public method to add a widget to the sides.
1406 if side == UserInterface.LeftSide: 1402 if side == UserInterface.LeftSide:
1407 self.leftSidebar.addTab(widget, icon, label) 1403 self.leftSidebar.addTab(widget, icon, label)
1408 elif side == UserInterface.BottomSide: 1404 elif side == UserInterface.BottomSide:
1409 self.bottomSidebar.addTab(widget, icon, label) 1405 self.bottomSidebar.addTab(widget, icon, label)
1410 elif side == UserInterface.RightSide: 1406 elif side == UserInterface.RightSide:
1411 self.rightSidebar.addTab(widget, icon, label) 1407 if self.rightSidebar:
1408 self.rightSidebar.addTab(widget, icon, label)
1409 else:
1410 self.leftSidebar.addTab(widget, icon, label)
1412 1411
1413 def removeSideWidget(self, widget): 1412 def removeSideWidget(self, widget):
1414 """ 1413 """
1415 Public method to remove a widget added using addSideWidget(). 1414 Public method to remove a widget added using addSideWidget().
1416 1415
1423 if index != -1: 1422 if index != -1:
1424 container.removeItem(index) 1423 container.removeItem(index)
1425 elif self.__layoutType == "Sidebars": 1424 elif self.__layoutType == "Sidebars":
1426 for container in [self.leftSidebar, self.bottomSidebar, 1425 for container in [self.leftSidebar, self.bottomSidebar,
1427 self.rightSidebar]: 1426 self.rightSidebar]:
1428 index = container.indexOf(widget) 1427 if container is not None:
1429 if index != -1: 1428 index = container.indexOf(widget)
1430 container.removeTab(index) 1429 if index != -1:
1430 container.removeTab(index)
1431 1431
1432 def showSideWidget(self, widget): 1432 def showSideWidget(self, widget):
1433 """ 1433 """
1434 Public method to show a specific widget placed in the side widgets. 1434 Public method to show a specific widget placed in the side widgets.
1435 1435
1446 container.setCurrentIndex(index) 1446 container.setCurrentIndex(index)
1447 dock.raise_() 1447 dock.raise_()
1448 elif self.__layoutType == "Sidebars": 1448 elif self.__layoutType == "Sidebars":
1449 for container in [self.leftSidebar, self.bottomSidebar, 1449 for container in [self.leftSidebar, self.bottomSidebar,
1450 self.rightSidebar]: 1450 self.rightSidebar]:
1451 index = container.indexOf(widget) 1451 if container is not None:
1452 if index != -1: 1452 index = container.indexOf(widget)
1453 container.show() 1453 if index != -1:
1454 container.setCurrentIndex(index) 1454 container.show()
1455 container.raise_() 1455 container.setCurrentIndex(index)
1456 container.raise_()
1456 1457
1457 def showLogViewer(self): 1458 def showLogViewer(self):
1458 """ 1459 """
1459 Public method to show the Log-Viewer. 1460 Public method to show the Log-Viewer.
1460 """ 1461 """
2073 """ If it is displayed then close it.</p>""" 2074 """ If it is displayed then close it.</p>"""
2074 )) 2075 ))
2075 self.lsbAct.triggered.connect(self.__toggleLeftSidebar) 2076 self.lsbAct.triggered.connect(self.__toggleLeftSidebar)
2076 self.actions.append(self.lsbAct) 2077 self.actions.append(self.lsbAct)
2077 2078
2078 self.rsbAct = EricAction( 2079 if self.rightSidebar:
2079 self.tr('Right Sidebar'), 2080 self.rsbAct = EricAction(
2080 self.tr('&Right Sidebar'), 2081 self.tr('Right Sidebar'),
2081 0, 0, self, 'right_sidebar', True) 2082 self.tr('&Right Sidebar'),
2082 self.rsbAct.setStatusTip(self.tr( 2083 0, 0, self, 'right_sidebar', True)
2083 'Toggle the right sidebar window')) 2084 self.rsbAct.setStatusTip(self.tr(
2084 self.rsbAct.setWhatsThis(self.tr( 2085 'Toggle the right sidebar window'))
2085 """<b>Toggle the right sidebar window</b>""" 2086 self.rsbAct.setWhatsThis(self.tr(
2086 """<p>If the right sidebar window is hidden then display it.""" 2087 """<b>Toggle the right sidebar window</b>"""
2087 """ If it is displayed then close it.</p>""" 2088 """<p>If the right sidebar window is hidden then display it."""
2088 )) 2089 """ If it is displayed then close it.</p>"""
2089 self.rsbAct.triggered.connect(self.__toggleRightSidebar) 2090 ))
2090 self.actions.append(self.rsbAct) 2091 self.rsbAct.triggered.connect(self.__toggleRightSidebar)
2092 self.actions.append(self.rsbAct)
2093 else:
2094 self.rsbAct = None
2091 2095
2092 self.bsbAct = EricAction( 2096 self.bsbAct = EricAction(
2093 self.tr('Bottom Sidebar'), 2097 self.tr('Bottom Sidebar'),
2094 self.tr('&Bottom Sidebar'), 0, 0, self, 2098 self.tr('&Bottom Sidebar'), 0, 0, self,
2095 'bottom_sidebar', True) 2099 'bottom_sidebar', True)
3434 self.__menus["subwindow"].addSection(self.tr("Central Park")) 3438 self.__menus["subwindow"].addSection(self.tr("Central Park"))
3435 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct) 3439 self.__menus["subwindow"].addAction(self.viewmanagerActivateAct)
3436 3440
3437 # left side 3441 # left side
3438 self.__menus["subwindow"].addSection(self.tr("Left Side")) 3442 self.__menus["subwindow"].addSection(self.tr("Left Side"))
3439 if self.__shellPosition == "left":
3440 self.__menus["subwindow"].addAction(self.shellActivateAct)
3441 self.__menus["subwindow"].addAction(self.mpbActivateAct) 3443 self.__menus["subwindow"].addAction(self.mpbActivateAct)
3442 self.__menus["subwindow"].addAction(self.pbActivateAct) 3444 self.__menus["subwindow"].addAction(self.pbActivateAct)
3443 self.__menus["subwindow"].addAction(self.findFileActivateAct) 3445 self.__menus["subwindow"].addAction(self.findFileActivateAct)
3444 self.__menus["subwindow"].addAction(self.findLocationActivateAct) 3446 self.__menus["subwindow"].addAction(self.findLocationActivateAct)
3445 self.__menus["subwindow"].addAction(self.vcsStatusListActivateAct) 3447 self.__menus["subwindow"].addAction(self.vcsStatusListActivateAct)
3448 if not self.rightSidebar:
3449 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3446 if self.templateViewer is not None: 3450 if self.templateViewer is not None:
3447 self.__menus["subwindow"].addAction(self.templateViewerActivateAct) 3451 self.__menus["subwindow"].addAction(self.templateViewerActivateAct)
3448 if self.browser is not None: 3452 if self.browser is not None:
3449 self.__menus["subwindow"].addAction(self.browserActivateAct) 3453 self.__menus["subwindow"].addAction(self.browserActivateAct)
3450 if self.symbolsViewer is not None: 3454 if self.symbolsViewer is not None:
3451 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) 3455 self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct)
3452 3456
3453 # right side 3457 # right side
3454 self.__menus["subwindow"].addSection(self.tr("Right Side")) 3458 if self.rightSidebar:
3455 if self.__shellPosition == "right": 3459 self.__menus["subwindow"].addSection(self.tr("Right Side"))
3456 self.__menus["subwindow"].addAction(self.shellActivateAct) 3460 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3457 self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
3458 if self.codeDocumentationViewer is not None: 3461 if self.codeDocumentationViewer is not None:
3459 self.__menus["subwindow"].addAction( 3462 self.__menus["subwindow"].addAction(
3460 self.codeDocumentationViewerActivateAct) 3463 self.codeDocumentationViewerActivateAct)
3461 self.__menus["subwindow"].addAction( 3464 self.__menus["subwindow"].addAction(
3462 self.helpViewerActivateAct) 3465 self.helpViewerActivateAct)
3476 self.__menus["subwindow"].addAction( 3479 self.__menus["subwindow"].addAction(
3477 self.microPythonWidgetActivateAct) 3480 self.microPythonWidgetActivateAct)
3478 3481
3479 # bottom side 3482 # bottom side
3480 self.__menus["subwindow"].addSection(self.tr("Bottom Side")) 3483 self.__menus["subwindow"].addSection(self.tr("Bottom Side"))
3481 if self.__shellPosition == "bottom": 3484 self.__menus["subwindow"].addAction(self.shellActivateAct)
3482 self.__menus["subwindow"].addAction(self.shellActivateAct)
3483 self.__menus["subwindow"].addAction(self.taskViewerActivateAct) 3485 self.__menus["subwindow"].addAction(self.taskViewerActivateAct)
3484 self.__menus["subwindow"].addAction(self.logViewerActivateAct) 3486 self.__menus["subwindow"].addAction(self.logViewerActivateAct)
3485 if self.numbersViewer is not None: 3487 if self.numbersViewer is not None:
3486 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct) 3488 self.__menus["subwindow"].addAction(self.numbersViewerActivateAct)
3487 3489
4501 self.__menus["window"].addAction(self.htAct) 4503 self.__menus["window"].addAction(self.htAct)
4502 self.htAct.setChecked(not self.hToolboxDock.isHidden()) 4504 self.htAct.setChecked(not self.hToolboxDock.isHidden())
4503 elif self.__layoutType == "Sidebars": 4505 elif self.__layoutType == "Sidebars":
4504 self.__menus["window"].addAction(self.lsbAct) 4506 self.__menus["window"].addAction(self.lsbAct)
4505 self.lsbAct.setChecked(not self.leftSidebar.isHidden()) 4507 self.lsbAct.setChecked(not self.leftSidebar.isHidden())
4506 self.__menus["window"].addAction(self.rsbAct) 4508 if self.rsbAct:
4507 self.rsbAct.setChecked(not self.rightSidebar.isHidden()) 4509 self.__menus["window"].addAction(self.rsbAct)
4510 self.rsbAct.setChecked(not self.rightSidebar.isHidden())
4508 self.__menus["window"].addAction(self.bsbAct) 4511 self.__menus["window"].addAction(self.bsbAct)
4509 self.bsbAct.setChecked(not self.bottomSidebar.isHidden()) 4512 self.bsbAct.setChecked(not self.bottomSidebar.isHidden())
4510 4513
4511 # Insert menu entry for sub-windows 4514 # Insert menu entry for sub-windows
4512 self.__menus["window"].addSeparator() 4515 self.__menus["window"].addSeparator()
4639 4642
4640 state = self.leftSidebar.saveState() 4643 state = self.leftSidebar.saveState()
4641 self.profiles[self.currentProfile][2][2] = state 4644 self.profiles[self.currentProfile][2][2] = state
4642 state = self.bottomSidebar.saveState() 4645 state = self.bottomSidebar.saveState()
4643 self.profiles[self.currentProfile][2][3] = state 4646 self.profiles[self.currentProfile][2][3] = state
4644 state = self.rightSidebar.saveState() 4647 if self.rightSidebar:
4645 self.profiles[self.currentProfile][2][4] = state 4648 state = self.rightSidebar.saveState()
4649 self.profiles[self.currentProfile][2][4] = state
4646 4650
4647 # step 2: save the visibility of the windows of the active profile 4651 # step 2: save the visibility of the windows of the active profile
4648 if self.__layoutType == "Toolboxes": 4652 if self.__layoutType == "Toolboxes":
4649 self.profiles[self.currentProfile][1][0] = ( 4653 self.profiles[self.currentProfile][1][0] = (
4650 self.lToolboxDock.isVisible() 4654 self.lToolboxDock.isVisible()
4660 self.leftSidebar.isVisible() 4664 self.leftSidebar.isVisible()
4661 ) 4665 )
4662 self.profiles[self.currentProfile][1][1] = ( 4666 self.profiles[self.currentProfile][1][1] = (
4663 self.bottomSidebar.isVisible() 4667 self.bottomSidebar.isVisible()
4664 ) 4668 )
4665 self.profiles[self.currentProfile][1][2] = ( 4669 if self.rightSidebar:
4666 self.rightSidebar.isVisible() 4670 self.profiles[self.currentProfile][1][2] = (
4667 ) 4671 self.rightSidebar.isVisible()
4672 )
4668 Preferences.setUI("ViewProfiles", self.profiles) 4673 Preferences.setUI("ViewProfiles", self.profiles)
4669 4674
4670 def __activateViewProfile(self, name, save=True): 4675 def __activateViewProfile(self, name, save=True):
4671 """ 4676 """
4672 Private slot to activate a view profile. 4677 Private slot to activate a view profile.
4696 if state: 4701 if state:
4697 self.leftSidebar.restoreState(state) 4702 self.leftSidebar.restoreState(state)
4698 state = self.profiles[name][2][3] 4703 state = self.profiles[name][2][3]
4699 if state: 4704 if state:
4700 self.bottomSidebar.restoreState(state) 4705 self.bottomSidebar.restoreState(state)
4701 state = self.profiles[name][2][4] 4706 if self.rightSidebar:
4702 if state: 4707 state = self.profiles[name][2][4]
4703 self.rightSidebar.restoreState(state) 4708 if state:
4709 self.rightSidebar.restoreState(state)
4704 4710
4705 if self.__layoutType == "Toolboxes": 4711 if self.__layoutType == "Toolboxes":
4706 # set the corner usages 4712 # set the corner usages
4707 self.setCorner(Qt.Corner.TopLeftCorner, 4713 self.setCorner(Qt.Corner.TopLeftCorner,
4708 Qt.DockWidgetArea.LeftDockWidgetArea) 4714 Qt.DockWidgetArea.LeftDockWidgetArea)
4719 self.hToolboxDock.setVisible(self.profiles[name][1][1]) 4725 self.hToolboxDock.setVisible(self.profiles[name][1][1])
4720 self.rToolboxDock.setVisible(self.profiles[name][1][2]) 4726 self.rToolboxDock.setVisible(self.profiles[name][1][2])
4721 elif self.__layoutType == "Sidebars": 4727 elif self.__layoutType == "Sidebars":
4722 self.leftSidebar.setVisible(self.profiles[name][1][0]) 4728 self.leftSidebar.setVisible(self.profiles[name][1][0])
4723 self.bottomSidebar.setVisible(self.profiles[name][1][1]) 4729 self.bottomSidebar.setVisible(self.profiles[name][1][1])
4724 self.rightSidebar.setVisible(self.profiles[name][1][2]) 4730 if self.rightSidebar:
4731 self.rightSidebar.setVisible(self.profiles[name][1][2])
4725 4732
4726 # step 4: remember the new profile 4733 # step 4: remember the new profile
4727 self.currentProfile = name 4734 self.currentProfile = name
4728 4735
4729 # step 5: make sure that cursor of the shell is visible 4736 # step 5: make sure that cursor of the shell is visible
4745 self.__currentRightWidget = self.rToolbox.currentWidget() 4752 self.__currentRightWidget = self.rToolbox.currentWidget()
4746 self.rToolbox.setCurrentWidget(self.debugViewer) 4753 self.rToolbox.setCurrentWidget(self.debugViewer)
4747 self.__currentBottomWidget = self.hToolbox.currentWidget() 4754 self.__currentBottomWidget = self.hToolbox.currentWidget()
4748 self.hToolbox.setCurrentWidget(self.shellAssembly) 4755 self.hToolbox.setCurrentWidget(self.shellAssembly)
4749 elif self.__layoutType == "Sidebars": 4756 elif self.__layoutType == "Sidebars":
4750 self.__currentRightWidget = self.rightSidebar.currentWidget() 4757 if self.rightSidebar:
4751 self.rightSidebar.setCurrentWidget(self.debugViewer) 4758 self.__currentRightWidget = self.rightSidebar.currentWidget()
4759 self.rightSidebar.setCurrentWidget(self.debugViewer)
4760 else:
4761 self.__currentRightWidget = self.leftSidebar.currentWidget()
4762 self.leftSidebar.setCurrentWidget(self.debugViewer)
4752 self.__currentBottomWidget = self.bottomSidebar.currentWidget() 4763 self.__currentBottomWidget = self.bottomSidebar.currentWidget()
4753 self.bottomSidebar.setCurrentWidget(self.shellAssembly) 4764 self.bottomSidebar.setCurrentWidget(self.shellAssembly)
4754 4765
4755 def __debuggingDone(self): 4766 def __debuggingDone(self):
4756 """ 4767 """
4762 self.rToolbox.setCurrentWidget(self.__currentRightWidget) 4773 self.rToolbox.setCurrentWidget(self.__currentRightWidget)
4763 if self.__currentBottomWidget: 4774 if self.__currentBottomWidget:
4764 self.hToolbox.setCurrentWidget(self.__currentBottomWidget) 4775 self.hToolbox.setCurrentWidget(self.__currentBottomWidget)
4765 elif self.__layoutType == "Sidebars": 4776 elif self.__layoutType == "Sidebars":
4766 if self.__currentRightWidget: 4777 if self.__currentRightWidget:
4767 self.rightSidebar.setCurrentWidget(self.__currentRightWidget) 4778 if self.rightSidebar:
4779 self.rightSidebar.setCurrentWidget(
4780 self.__currentRightWidget)
4781 else:
4782 self.leftSidebar.setCurrentWidget(
4783 self.__currentRightWidget)
4768 if self.__currentBottomWidget: 4784 if self.__currentBottomWidget:
4769 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget) 4785 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget)
4770 self.__currentRightWidget = None 4786 self.__currentRightWidget = None
4771 self.__currentBottomWidget = None 4787 self.__currentBottomWidget = None
4772 self.__activateViewmanager() 4788 self.__activateViewmanager()
4809 4825
4810 @return current layout type 4826 @return current layout type
4811 @rtype str 4827 @rtype str
4812 """ 4828 """
4813 return self.__layoutType 4829 return self.__layoutType
4830
4831 def __activateLeftRightSidebarWidget(self, widget):
4832 """
4833 Private method to activate the given widget in the left or right
4834 sidebar.
4835
4836 @param widget reference to the widget to be activated
4837 @type QWidget
4838 """
4839 sidebar = (
4840 self.leftSidebar
4841 if Preferences.getUI("CombinedLeftRightSidebar") else
4842 self.rightSidebar
4843 )
4844 sidebar.show()
4845 sidebar.setCurrentWidget(widget)
4814 4846
4815 def __activateProjectBrowser(self): 4847 def __activateProjectBrowser(self):
4816 """ 4848 """
4817 Private slot to handle the activation of the project browser. 4849 Private slot to handle the activation of the project browser.
4818 """ 4850 """
4844 """ 4876 """
4845 if self.__layoutType == "Toolboxes": 4877 if self.__layoutType == "Toolboxes":
4846 self.rToolboxDock.show() 4878 self.rToolboxDock.show()
4847 self.rToolbox.setCurrentWidget(self.debugViewer) 4879 self.rToolbox.setCurrentWidget(self.debugViewer)
4848 elif self.__layoutType == "Sidebars": 4880 elif self.__layoutType == "Sidebars":
4849 self.rightSidebar.show() 4881 self.__activateLeftRightSidebarWidget(self.debugViewer)
4850 self.rightSidebar.setCurrentWidget(self.debugViewer)
4851 self.debugViewer.currentWidget().setFocus( 4882 self.debugViewer.currentWidget().setFocus(
4852 Qt.FocusReason.ActiveWindowFocusReason) 4883 Qt.FocusReason.ActiveWindowFocusReason)
4853 4884
4854 def __activateShell(self): 4885 def __activateShell(self):
4855 """ 4886 """
4999 if self.cooperation is not None: 5030 if self.cooperation is not None:
5000 if self.__layoutType == "Toolboxes": 5031 if self.__layoutType == "Toolboxes":
5001 self.rToolboxDock.show() 5032 self.rToolboxDock.show()
5002 self.rToolbox.setCurrentWidget(self.cooperation) 5033 self.rToolbox.setCurrentWidget(self.cooperation)
5003 elif self.__layoutType == "Sidebars": 5034 elif self.__layoutType == "Sidebars":
5004 self.rightSidebar.show() 5035 self.__activateLeftRightSidebarWidget(self.cooperation)
5005 self.rightSidebar.setCurrentWidget(self.cooperation)
5006 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 5036 self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5007 5037
5008 def __activateIRC(self): 5038 def __activateIRC(self):
5009 """ 5039 """
5010 Private slot to handle the activation of the IRC window. 5040 Private slot to handle the activation of the IRC window.
5012 if self.irc is not None: 5042 if self.irc is not None:
5013 if self.__layoutType == "Toolboxes": 5043 if self.__layoutType == "Toolboxes":
5014 self.rToolboxDock.show() 5044 self.rToolboxDock.show()
5015 self.rToolbox.setCurrentWidget(self.irc) 5045 self.rToolbox.setCurrentWidget(self.irc)
5016 elif self.__layoutType == "Sidebars": 5046 elif self.__layoutType == "Sidebars":
5017 self.rightSidebar.show() 5047 self.__activateLeftRightSidebarWidget(self.irc)
5018 self.rightSidebar.setCurrentWidget(self.irc)
5019 self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 5048 self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5020 5049
5021 def __activateSymbolsViewer(self): 5050 def __activateSymbolsViewer(self):
5022 """ 5051 """
5023 Private slot to handle the activation of the Symbols Viewer. 5052 Private slot to handle the activation of the Symbols Viewer.
5062 if self.codeDocumentationViewer is not None: 5091 if self.codeDocumentationViewer is not None:
5063 if self.__layoutType == "Toolboxes": 5092 if self.__layoutType == "Toolboxes":
5064 self.rToolboxDock.show() 5093 self.rToolboxDock.show()
5065 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) 5094 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer)
5066 elif self.__layoutType == "Sidebars": 5095 elif self.__layoutType == "Sidebars":
5067 self.rightSidebar.show() 5096 self.__activateLeftRightSidebarWidget(
5068 self.rightSidebar.setCurrentWidget(
5069 self.codeDocumentationViewer) 5097 self.codeDocumentationViewer)
5070 if switchFocus: 5098 if switchFocus:
5071 self.codeDocumentationViewer.setFocus( 5099 self.codeDocumentationViewer.setFocus(
5072 Qt.FocusReason.ActiveWindowFocusReason) 5100 Qt.FocusReason.ActiveWindowFocusReason)
5073 5101
5078 if self.pipWidget is not None: 5106 if self.pipWidget is not None:
5079 if self.__layoutType == "Toolboxes": 5107 if self.__layoutType == "Toolboxes":
5080 self.rToolboxDock.show() 5108 self.rToolboxDock.show()
5081 self.rToolbox.setCurrentWidget(self.pipWidget) 5109 self.rToolbox.setCurrentWidget(self.pipWidget)
5082 elif self.__layoutType == "Sidebars": 5110 elif self.__layoutType == "Sidebars":
5083 self.rightSidebar.show() 5111 self.__activateLeftRightSidebarWidget(self.pipWidget)
5084 self.rightSidebar.setCurrentWidget(self.pipWidget)
5085 self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 5112 self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5086 5113
5087 def __activateCondaWidget(self): 5114 def __activateCondaWidget(self):
5088 """ 5115 """
5089 Private slot to handle the activation of the Conda manager widget. 5116 Private slot to handle the activation of the Conda manager widget.
5091 if self.condaWidget is not None: 5118 if self.condaWidget is not None:
5092 if self.__layoutType == "Toolboxes": 5119 if self.__layoutType == "Toolboxes":
5093 self.rToolboxDock.show() 5120 self.rToolboxDock.show()
5094 self.rToolbox.setCurrentWidget(self.condaWidget) 5121 self.rToolbox.setCurrentWidget(self.condaWidget)
5095 elif self.__layoutType == "Sidebars": 5122 elif self.__layoutType == "Sidebars":
5096 self.rightSidebar.show() 5123 self.__activateLeftRightSidebarWidget(self.condaWidget)
5097 self.rightSidebar.setCurrentWidget(self.condaWidget)
5098 self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) 5124 self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
5099 5125
5100 def __activateMicroPython(self): 5126 def __activateMicroPython(self):
5101 """ 5127 """
5102 Private slot to handle the activation of the MicroPython widget. 5128 Private slot to handle the activation of the MicroPython widget.
5104 if self.microPythonWidget is not None: 5130 if self.microPythonWidget is not None:
5105 if self.__layoutType == "Toolboxes": 5131 if self.__layoutType == "Toolboxes":
5106 self.rToolboxDock.show() 5132 self.rToolboxDock.show()
5107 self.rToolbox.setCurrentWidget(self.microPythonWidget) 5133 self.rToolbox.setCurrentWidget(self.microPythonWidget)
5108 elif self.__layoutType == "Sidebars": 5134 elif self.__layoutType == "Sidebars":
5109 self.rightSidebar.show() 5135 self.__activateLeftRightSidebarWidget(self.microPythonWidget)
5110 self.rightSidebar.setCurrentWidget(self.microPythonWidget)
5111 self.microPythonWidget.setFocus( 5136 self.microPythonWidget.setFocus(
5112 Qt.FocusReason.ActiveWindowFocusReason) 5137 Qt.FocusReason.ActiveWindowFocusReason)
5113 5138
5114 def __toggleWindow(self, w): 5139 def __toggleWindow(self, w):
5115 """ 5140 """
6400 not Preferences.getUI("SingleApplicationMode")) 6425 not Preferences.getUI("SingleApplicationMode"))
6401 6426
6402 if self.__layoutType == "Sidebars": 6427 if self.__layoutType == "Sidebars":
6403 self.leftSidebar.setIconBarColor( 6428 self.leftSidebar.setIconBarColor(
6404 Preferences.getUI("IconBarColor")) 6429 Preferences.getUI("IconBarColor"))
6430 self.leftSidebar.setIconBarSize(
6431 Preferences.getUI("IconBarSize"))
6432
6405 self.bottomSidebar.setIconBarColor( 6433 self.bottomSidebar.setIconBarColor(
6406 Preferences.getUI("IconBarColor")) 6434 Preferences.getUI("IconBarColor"))
6407 self.rightSidebar.setIconBarColor(
6408 Preferences.getUI("IconBarColor"))
6409
6410 self.leftSidebar.setIconBarSize(
6411 Preferences.getUI("IconBarSize"))
6412 self.bottomSidebar.setIconBarSize( 6435 self.bottomSidebar.setIconBarSize(
6413 Preferences.getUI("IconBarSize")) 6436 Preferences.getUI("IconBarSize"))
6414 self.rightSidebar.setIconBarSize( 6437
6415 Preferences.getUI("IconBarSize")) 6438 if self.rightSidebar:
6439 self.rightSidebar.setIconBarColor(
6440 Preferences.getUI("IconBarColor"))
6441 self.rightSidebar.setIconBarSize(
6442 Preferences.getUI("IconBarSize"))
6416 6443
6417 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") 6444 self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
6418 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") 6445 self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename")
6419 if not self.captionShowsFilename: 6446 if not self.captionShowsFilename:
6420 self.__setWindowCaption(editor="") 6447 self.__setWindowCaption(editor="")
7054 if self.__helpViewerWidget is not None: 7081 if self.__helpViewerWidget is not None:
7055 if self.__layoutType == "Toolboxes": 7082 if self.__layoutType == "Toolboxes":
7056 self.rToolboxDock.show() 7083 self.rToolboxDock.show()
7057 self.rToolbox.setCurrentWidget(self.__helpViewerWidget) 7084 self.rToolbox.setCurrentWidget(self.__helpViewerWidget)
7058 elif self.__layoutType == "Sidebars": 7085 elif self.__layoutType == "Sidebars":
7059 self.rightSidebar.show() 7086 self.__activateLeftRightSidebarWidget(self.__helpViewerWidget)
7060 self.rightSidebar.setCurrentWidget(self.__helpViewerWidget)
7061 self.__helpViewerWidget.setFocus( 7087 self.__helpViewerWidget.setFocus(
7062 Qt.FocusReason.ActiveWindowFocusReason) 7088 Qt.FocusReason.ActiveWindowFocusReason)
7063 7089
7064 url = None 7090 url = None
7065 searchWord = None 7091 searchWord = None
7188 7214
7189 if self.__layoutType == "Toolboxes": 7215 if self.__layoutType == "Toolboxes":
7190 self.rToolboxDock.show() 7216 self.rToolboxDock.show()
7191 self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer) 7217 self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer)
7192 elif self.__layoutType == "Sidebars": 7218 elif self.__layoutType == "Sidebars":
7193 self.rightSidebar.show() 7219 self.__activateLeftRightSidebarWidget(self.pluginRepositoryViewer)
7194 self.rightSidebar.setCurrentWidget(self.pluginRepositoryViewer)
7195 self.pluginRepositoryViewer.setFocus( 7220 self.pluginRepositoryViewer.setFocus(
7196 Qt.FocusReason.ActiveWindowFocusReason) 7221 Qt.FocusReason.ActiveWindowFocusReason)
7197 7222
7198 ################################################################# 7223 #################################################################
7199 ## Drag and Drop Support 7224 ## Drag and Drop Support
7934 """ 7959 """
7935 if self.__layoutType == "Toolboxes": 7960 if self.__layoutType == "Toolboxes":
7936 self.rToolboxDock.show() 7961 self.rToolboxDock.show()
7937 self.rToolbox.setCurrentWidget(self.__virtualenvManagerWidget) 7962 self.rToolbox.setCurrentWidget(self.__virtualenvManagerWidget)
7938 elif self.__layoutType == "Sidebars": 7963 elif self.__layoutType == "Sidebars":
7939 self.rightSidebar.show() 7964 self.__activateLeftRightSidebarWidget(
7940 self.rightSidebar.setCurrentWidget(self.__virtualenvManagerWidget) 7965 self.__virtualenvManagerWidget)
7941 self.__virtualenvManagerWidget.setFocus( 7966 self.__virtualenvManagerWidget.setFocus(
7942 Qt.FocusReason.ActiveWindowFocusReason) 7967 Qt.FocusReason.ActiveWindowFocusReason)

eric ide

mercurial