Wed, 27 Oct 2021 19:15:50 +0200
Added an interface option that shows all integrated tools in the left sidebar. The right one is not used. This is recommended for screens less FHD.
--- a/eric7/Preferences/ConfigurationPages/InterfacePage.py Tue Oct 26 18:03:56 2021 +0200 +++ b/eric7/Preferences/ConfigurationPages/InterfacePage.py Wed Oct 27 19:15:50 2021 +0200 @@ -51,7 +51,6 @@ # set initial values self.__populateStyleCombo() self.__populateLanguageCombo() - self.__populateShellPositionCombo() self.uiBrowsersListFoldersFirstCheckBox.setChecked( Preferences.getUI("BrowsersListFoldersFirst")) @@ -111,6 +110,9 @@ self.__iconBarColor = Preferences.getUI("IconBarColor") self.__setIconBarSamples() + self.combinedLeftRightSidebarCheckBox.setChecked( + Preferences.getUI("CombinedLeftRightSidebar")) + # connect the icon size combo box after initialization is complete self.iconSizeComboBox.currentIndexChanged.connect( self.__setIconBarSamples) @@ -169,11 +171,6 @@ layoutType = "Sidebars" # just in case Preferences.setUI("LayoutType", layoutType) - # save the shell position setting - shellPositionIndex = self.shellPositionComboBox.currentIndex() - shellPosition = self.shellPositionComboBox.itemData(shellPositionIndex) - Preferences.setUI("ShellPosition", shellPosition) - # save the integrated tools activation # left side Preferences.setUI( @@ -218,6 +215,9 @@ Preferences.setUI( "IconBarColor", self.__iconBarColor) + Preferences.setUI( + "CombinedLeftRightSidebar", + self.combinedLeftRightSidebarCheckBox.isChecked()) def __populateStyleCombo(self): """ @@ -276,20 +276,6 @@ self.languageComboBox.addItem(locales[locale], locale) self.languageComboBox.setCurrentIndex(currentIndex) - def __populateShellPositionCombo(self): - """ - Private method to initialize the shell position combo box. - """ - self.shellPositionComboBox.addItem(self.tr("Left Side"), "left") - self.shellPositionComboBox.addItem(self.tr("Right Side"), "right") - self.shellPositionComboBox.addItem(self.tr("Bottom Side"), "bottom") - - shellPosition = Preferences.getUI("ShellPosition") - if shellPosition not in ("left", "right", "bottom"): - shellPosition = "bottom" - index = self.shellPositionComboBox.findData(shellPosition) - self.shellPositionComboBox.setCurrentIndex(index) - @pyqtSlot() def on_resetLayoutButton_clicked(self): """ @@ -335,6 +321,20 @@ if colDlg.exec() == QDialog.DialogCode.Accepted: self.__iconBarColor = colDlg.selectedColor() self.__setIconBarSamples() + + @pyqtSlot(bool) + def on_combinedLeftRightSidebarCheckBox_toggled(self, checked): + """ + Private slot handling a change of the combined sidebars checkbox. + + @param checked state of the checkbox + @type bool + """ + self.leftRightGroupBox.setTitle( + self.tr("Combined Left Side") + if checked else + self.tr("Right Side") + ) def create(dlg):
--- a/eric7/Preferences/ConfigurationPages/InterfacePage.ui Tue Oct 26 18:03:56 2021 +0200 +++ b/eric7/Preferences/ConfigurationPages/InterfacePage.ui Wed Oct 27 19:15:50 2021 +0200 @@ -10,7 +10,7 @@ <height>1048</height> </rect> </property> - <layout class="QVBoxLayout" name="verticalLayout_2"> + <layout class="QVBoxLayout" name="verticalLayout_3"> <item> <widget class="QLabel" name="headerLabel"> <property name="text"> @@ -201,79 +201,113 @@ <property name="title"> <string>Sidebars</string> </property> - <layout class="QHBoxLayout" name="horizontalLayout"> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <layout class="QGridLayout" name="gridLayout_7"> - <item row="0" column="0" colspan="2"> - <widget class="QPushButton" name="iconBarButton"> - <property name="toolTip"> - <string>Select the icon bar background color</string> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <layout class="QGridLayout" name="gridLayout_7"> + <item row="0" column="0" colspan="2"> + <widget class="QPushButton" name="iconBarButton"> + <property name="toolTip"> + <string>Select the icon bar background color</string> + </property> + <property name="text"> + <string>Icon Bar Color</string> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_5"> + <property name="text"> + <string>Icon Size:</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="QComboBox" name="iconSizeComboBox"> + <property name="toolTip"> + <string>Select the icon size</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <widget class="QLabel" name="sampleLabel"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> </property> <property name="text"> - <string>Icon Bar Color</string> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="1" column="0"> - <widget class="QLabel" name="label_5"> + <item> + <widget class="QLabel" name="highlightedSampleLabel"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>50</height> + </size> + </property> <property name="text"> - <string>Icon Size:</string> + <string/> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QComboBox" name="iconSizeComboBox"> - <property name="toolTip"> - <string>Select the icon size</string> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>396</width> + <height>20</height> + </size> + </property> + </spacer> </item> </layout> </item> <item> - <widget class="QLabel" name="sampleLabel"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>50</height> - </size> + <widget class="Line" name="line9_3"> + <property name="frameShape"> + <enum>QFrame::HLine</enum> </property> - <property name="text"> - <string/> + <property name="frameShadow"> + <enum>QFrame::Sunken</enum> </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> - <widget class="QLabel" name="highlightedSampleLabel"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>50</height> - </size> - </property> + <widget class="QLabel" name="TextLabel1_2_2_3"> <property name="text"> - <string/> - </property> - <property name="alignment"> - <set>Qt::AlignCenter</set> + <string><font color="#FF0000"><b>Note:</b> The following setting will be activated at the next startup of the application.</font></string> </property> </widget> </item> <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> + <widget class="QCheckBox" name="combinedLeftRightSidebarCheckBox"> + <property name="toolTip"> + <string>Select to combine the left and right sidebar</string> </property> - <property name="sizeHint" stdset="0"> - <size> - <width>396</width> - <height>20</height> - </size> + <property name="text"> + <string>Combine left and right sidebar</string> </property> - </spacer> + </widget> </item> </layout> </widget> @@ -300,45 +334,6 @@ </item> <item> <layout class="QGridLayout" name="gridLayout"> - <item row="0" column="0"> - <widget class="QLabel" name="languageLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string>Language:</string> - </property> - <property name="buddy"> - <cstring>languageComboBox</cstring> - </property> - </widget> - </item> - <item row="0" column="1"> - <widget class="QComboBox" name="languageComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Select the interface language.</string> - </property> - <property name="whatsThis"> - <string>The interface language can be selected from this list. If "system" is selected, the interface language is determined by the system. The selection of "none" means, that the default language will be used.</string> - </property> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="layoutLabel"> - <property name="text"> - <string>Layout:</string> - </property> - </widget> - </item> <item row="1" column="1"> <widget class="QComboBox" name="layoutComboBox"> <property name="sizePolicy"> @@ -362,17 +357,42 @@ </item> </widget> </item> - <item row="2" column="0"> - <widget class="QLabel" name="label_6"> - <property name="text"> - <string>Shell Position:</string> + <item row="0" column="1"> + <widget class="QComboBox" name="languageComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Select the interface language.</string> + </property> + <property name="whatsThis"> + <string>The interface language can be selected from this list. If "system" is selected, the interface language is determined by the system. The selection of "none" means, that the default language will be used.</string> </property> </widget> </item> - <item row="2" column="1"> - <widget class="QComboBox" name="shellPositionComboBox"> - <property name="toolTip"> - <string>Select the position for the Shell window</string> + <item row="0" column="0"> + <widget class="QLabel" name="languageLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string>Language:</string> + </property> + <property name="buddy"> + <cstring>languageComboBox</cstring> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="layoutLabel"> + <property name="text"> + <string>Layout:</string> </property> </widget> </item> @@ -424,7 +444,7 @@ </widget> </item> <item> - <widget class="QGroupBox" name="groupBox_9"> + <widget class="QGroupBox" name="leftRightGroupBox"> <property name="title"> <string>Right Side</string> </property> @@ -596,9 +616,9 @@ <tabstop>styleSheetPicker</tabstop> <tabstop>iconBarButton</tabstop> <tabstop>iconSizeComboBox</tabstop> + <tabstop>combinedLeftRightSidebarCheckBox</tabstop> <tabstop>languageComboBox</tabstop> <tabstop>layoutComboBox</tabstop> - <tabstop>shellPositionComboBox</tabstop> <tabstop>templateViewerCheckBox</tabstop> <tabstop>fileBrowserCheckBox</tabstop> <tabstop>symbolsCheckBox</tabstop>
--- a/eric7/Preferences/__init__.py Tue Oct 26 18:03:56 2021 +0200 +++ b/eric7/Preferences/__init__.py Wed Oct 27 19:15:50 2021 +0200 @@ -116,7 +116,8 @@ "StyleSheet": "", "ViewManager": "tabview", "LayoutType": "Sidebars", # "Toolboxes" or "Sidebars" - "ShellPosition": "bottom", # "left", "right" or "bottom" + "CombinedLeftRightSidebar": False, # place all tools into the + # left sidebar "IconBarColor": QColor("#008800"), "IconBarSize": EricIconBar.DefaultBarSize, "BrowsersListFoldersFirst": True, @@ -1933,7 +1934,8 @@ "ShowCondaPackageManager", "ShowCooperation", "ShowIrc", "ShowTemplateViewer", "ShowFileBrowser", "ShowSymbolsViewer", "ShowNumbersViewer", "ShowMicroPython", - "ShowInternalHelpViewer", "UseNativeMenuBar"]: + "ShowInternalHelpViewer", "UseNativeMenuBar", + "CombinedLeftRightSidebar"]: return toBool(Prefs.settings.value( "UI/" + key, Prefs.uiDefaults[key])) elif key in ["TabViewManagerFilenameLength", "CaptionFilenameLength",
--- a/eric7/UI/UserInterface.py Tue Oct 26 18:03:56 2021 +0200 +++ b/eric7/UI/UserInterface.py Wed Oct 27 19:15:50 2021 +0200 @@ -1160,6 +1160,10 @@ ## Populate the bottom toolbox #################################################### + self.hToolbox.addItem(self.shellAssembly, + UI.PixmapCache.getIcon("shell"), + self.tr("Shell")) + self.hToolbox.addItem(self.taskViewer, UI.PixmapCache.getIcon("task"), self.tr("Task-Viewer")) @@ -1174,21 +1178,6 @@ self.tr("Numbers")) #################################################### - ## Populate the configurable widgets - #################################################### - - self.__shellPosition = Preferences.getUI("ShellPosition") - if self.__shellPosition == "left": - self.__shellParent = self.lToolboxDock - elif self.__shellPosition == "right": - self.__shellParent = self.rToolboxDock - else: - self.__shellParent = self.hToolboxDock - self.__shellParent.widget().insertItem( - 0, self.shellAssembly, UI.PixmapCache.getIcon("shell"), - self.tr("Shell")) - - #################################################### ## Set the start index of each toolbox #################################################### @@ -1215,10 +1204,15 @@ self.bottomSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) # Create the right sidebar - self.rightSidebar = EricSideBar(EricSideBarSide.EAST, - Preferences.getUI("IconBarSize")) - self.rightSidebar.setIconBarColor(Preferences.getUI("IconBarColor")) - + if Preferences.getUI("CombinedLeftRightSidebar"): + # combine left and right sidebar on the left side + self.rightSidebar = None + else: + self.rightSidebar = EricSideBar( + EricSideBarSide.EAST, Preferences.getUI("IconBarSize")) + self.rightSidebar.setIconBarColor( + Preferences.getUI("IconBarColor")) + #################################################### ## Populate the left side bar #################################################### @@ -1266,61 +1260,72 @@ UI.PixmapCache.getIcon("sbSymbolsViewer96"), self.tr("Symbols")) - #################################################### - ## Populate the right side bar - #################################################### + ############################################################## + ## Populate the right side bar or combined left sidebar + ############################################################## # TODO: add option to add all tools to the left sidebar # possibly with different order (e.g. debug after VCS) - self.rightSidebar.addTab( - self.debugViewer, - UI.PixmapCache.getIcon("sbDebugViewer96"), - self.tr("Debug-Viewer")) + sidebar = self.rightSidebar or self.leftSidebar + + if sidebar is self.leftSidebar: + # place debug viewer after 'VCS Status' widget + index = self.leftSidebar.indexOf(self.__vcsStatusWidget) + 1 + sidebar.insertTab( + index, + self.debugViewer, + UI.PixmapCache.getIcon("sbDebugViewer96"), + self.tr("Debug-Viewer")) + else: + sidebar.addTab( + self.debugViewer, + UI.PixmapCache.getIcon("sbDebugViewer96"), + self.tr("Debug-Viewer")) if self.codeDocumentationViewer: - self.rightSidebar.addTab( + sidebar.addTab( self.codeDocumentationViewer, UI.PixmapCache.getIcon("sbCodeDocuViewer96"), self.tr("Code Documentation Viewer")) if self.__helpViewerWidget: - self.rightSidebar.addTab( + sidebar.addTab( self.__helpViewerWidget, UI.PixmapCache.getIcon("sbHelpViewer96"), self.tr("Help Viewer")) - self.rightSidebar.addTab( + sidebar.addTab( self.pluginRepositoryViewer, UI.PixmapCache.getIcon("sbPluginRepository96"), self.tr("Plugin Repository")) - self.rightSidebar.addTab( + sidebar.addTab( self.__virtualenvManagerWidget, UI.PixmapCache.getIcon("sbVirtenvManager96"), self.tr("Virtual Environments")) if self.pipWidget: - self.rightSidebar.addTab( + sidebar.addTab( self.pipWidget, UI.PixmapCache.getIcon("sbPyPI96"), self.tr("PyPI")) if self.condaWidget: - self.rightSidebar.addTab( + sidebar.addTab( self.condaWidget, UI.PixmapCache.getIcon("sbMiniconda96"), self.tr("Conda")) if self.cooperation: - self.rightSidebar.addTab( + sidebar.addTab( self.cooperation, UI.PixmapCache.getIcon("sbCooperation96"), self.tr("Cooperation")) if self.irc: - self.rightSidebar.addTab( + sidebar.addTab( self.irc, UI.PixmapCache.getIcon("sbIrc96"), self.tr("IRC")) if self.microPythonWidget: - self.rightSidebar.addTab( + sidebar.addTab( self.microPythonWidget, UI.PixmapCache.getIcon("sbMicroPython96"), self.tr("MicroPython")) @@ -1329,6 +1334,10 @@ ## Populate the bottom side bar #################################################### + self.bottomSidebar.addTab(self.shellAssembly, + UI.PixmapCache.getIcon("sbShell96"), + self.tr("Shell")) + self.bottomSidebar.addTab(self.taskViewer, UI.PixmapCache.getIcon("sbTasksViewer96"), self.tr("Task-Viewer")) @@ -1343,26 +1352,12 @@ self.tr("Numbers")) #################################################### - ## Populate the configurable widgets - #################################################### - - self.__shellPosition = Preferences.getUI("ShellPosition") - if self.__shellPosition == "left": - self.__shellParent = self.leftSidebar - elif self.__shellPosition == "right": - self.__shellParent = self.rightSidebar - else: - self.__shellParent = self.bottomSidebar - self.__shellParent.insertTab(0, self.shellAssembly, - UI.PixmapCache.getIcon("sbShell96"), - self.tr("Shell")) - - #################################################### ## Set the start index of each side bar #################################################### self.leftSidebar.setCurrentIndex(0) - self.rightSidebar.setCurrentIndex(0) + if self.rightSidebar: + self.rightSidebar.setCurrentIndex(0) self.bottomSidebar.setCurrentIndex(0) # create the central widget @@ -1376,7 +1371,8 @@ self.verticalSplitter.addWidget(self.bottomSidebar) self.horizontalSplitter.addWidget(self.leftSidebar) self.horizontalSplitter.addWidget(self.verticalSplitter) - self.horizontalSplitter.addWidget(self.rightSidebar) + if self.rightSidebar: + self.horizontalSplitter.addWidget(self.rightSidebar) self.setCentralWidget(self.horizontalSplitter) def addSideWidget(self, side, widget, icon, label): @@ -1408,7 +1404,10 @@ elif side == UserInterface.BottomSide: self.bottomSidebar.addTab(widget, icon, label) elif side == UserInterface.RightSide: - self.rightSidebar.addTab(widget, icon, label) + if self.rightSidebar: + self.rightSidebar.addTab(widget, icon, label) + else: + self.leftSidebar.addTab(widget, icon, label) def removeSideWidget(self, widget): """ @@ -1425,9 +1424,10 @@ elif self.__layoutType == "Sidebars": for container in [self.leftSidebar, self.bottomSidebar, self.rightSidebar]: - index = container.indexOf(widget) - if index != -1: - container.removeTab(index) + if container is not None: + index = container.indexOf(widget) + if index != -1: + container.removeTab(index) def showSideWidget(self, widget): """ @@ -1448,11 +1448,12 @@ elif self.__layoutType == "Sidebars": for container in [self.leftSidebar, self.bottomSidebar, self.rightSidebar]: - index = container.indexOf(widget) - if index != -1: - container.show() - container.setCurrentIndex(index) - container.raise_() + if container is not None: + index = container.indexOf(widget) + if index != -1: + container.show() + container.setCurrentIndex(index) + container.raise_() def showLogViewer(self): """ @@ -2075,19 +2076,22 @@ self.lsbAct.triggered.connect(self.__toggleLeftSidebar) self.actions.append(self.lsbAct) - self.rsbAct = EricAction( - self.tr('Right Sidebar'), - self.tr('&Right Sidebar'), - 0, 0, self, 'right_sidebar', True) - self.rsbAct.setStatusTip(self.tr( - 'Toggle the right sidebar window')) - self.rsbAct.setWhatsThis(self.tr( - """<b>Toggle the right sidebar window</b>""" - """<p>If the right sidebar window is hidden then display it.""" - """ If it is displayed then close it.</p>""" - )) - self.rsbAct.triggered.connect(self.__toggleRightSidebar) - self.actions.append(self.rsbAct) + if self.rightSidebar: + self.rsbAct = EricAction( + self.tr('Right Sidebar'), + self.tr('&Right Sidebar'), + 0, 0, self, 'right_sidebar', True) + self.rsbAct.setStatusTip(self.tr( + 'Toggle the right sidebar window')) + self.rsbAct.setWhatsThis(self.tr( + """<b>Toggle the right sidebar window</b>""" + """<p>If the right sidebar window is hidden then display it.""" + """ If it is displayed then close it.</p>""" + )) + self.rsbAct.triggered.connect(self.__toggleRightSidebar) + self.actions.append(self.rsbAct) + else: + self.rsbAct = None self.bsbAct = EricAction( self.tr('Bottom Sidebar'), @@ -3436,13 +3440,13 @@ # left side self.__menus["subwindow"].addSection(self.tr("Left Side")) - if self.__shellPosition == "left": - self.__menus["subwindow"].addAction(self.shellActivateAct) self.__menus["subwindow"].addAction(self.mpbActivateAct) self.__menus["subwindow"].addAction(self.pbActivateAct) self.__menus["subwindow"].addAction(self.findFileActivateAct) self.__menus["subwindow"].addAction(self.findLocationActivateAct) self.__menus["subwindow"].addAction(self.vcsStatusListActivateAct) + if not self.rightSidebar: + self.__menus["subwindow"].addAction(self.debugViewerActivateAct) if self.templateViewer is not None: self.__menus["subwindow"].addAction(self.templateViewerActivateAct) if self.browser is not None: @@ -3451,10 +3455,9 @@ self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct) # right side - self.__menus["subwindow"].addSection(self.tr("Right Side")) - if self.__shellPosition == "right": - self.__menus["subwindow"].addAction(self.shellActivateAct) - self.__menus["subwindow"].addAction(self.debugViewerActivateAct) + if self.rightSidebar: + self.__menus["subwindow"].addSection(self.tr("Right Side")) + self.__menus["subwindow"].addAction(self.debugViewerActivateAct) if self.codeDocumentationViewer is not None: self.__menus["subwindow"].addAction( self.codeDocumentationViewerActivateAct) @@ -3478,8 +3481,7 @@ # bottom side self.__menus["subwindow"].addSection(self.tr("Bottom Side")) - if self.__shellPosition == "bottom": - self.__menus["subwindow"].addAction(self.shellActivateAct) + self.__menus["subwindow"].addAction(self.shellActivateAct) self.__menus["subwindow"].addAction(self.taskViewerActivateAct) self.__menus["subwindow"].addAction(self.logViewerActivateAct) if self.numbersViewer is not None: @@ -4503,8 +4505,9 @@ elif self.__layoutType == "Sidebars": self.__menus["window"].addAction(self.lsbAct) self.lsbAct.setChecked(not self.leftSidebar.isHidden()) - self.__menus["window"].addAction(self.rsbAct) - self.rsbAct.setChecked(not self.rightSidebar.isHidden()) + if self.rsbAct: + self.__menus["window"].addAction(self.rsbAct) + self.rsbAct.setChecked(not self.rightSidebar.isHidden()) self.__menus["window"].addAction(self.bsbAct) self.bsbAct.setChecked(not self.bottomSidebar.isHidden()) @@ -4641,8 +4644,9 @@ self.profiles[self.currentProfile][2][2] = state state = self.bottomSidebar.saveState() self.profiles[self.currentProfile][2][3] = state - state = self.rightSidebar.saveState() - self.profiles[self.currentProfile][2][4] = state + if self.rightSidebar: + state = self.rightSidebar.saveState() + self.profiles[self.currentProfile][2][4] = state # step 2: save the visibility of the windows of the active profile if self.__layoutType == "Toolboxes": @@ -4662,9 +4666,10 @@ self.profiles[self.currentProfile][1][1] = ( self.bottomSidebar.isVisible() ) - self.profiles[self.currentProfile][1][2] = ( - self.rightSidebar.isVisible() - ) + if self.rightSidebar: + self.profiles[self.currentProfile][1][2] = ( + self.rightSidebar.isVisible() + ) Preferences.setUI("ViewProfiles", self.profiles) def __activateViewProfile(self, name, save=True): @@ -4698,9 +4703,10 @@ state = self.profiles[name][2][3] if state: self.bottomSidebar.restoreState(state) - state = self.profiles[name][2][4] - if state: - self.rightSidebar.restoreState(state) + if self.rightSidebar: + state = self.profiles[name][2][4] + if state: + self.rightSidebar.restoreState(state) if self.__layoutType == "Toolboxes": # set the corner usages @@ -4721,7 +4727,8 @@ elif self.__layoutType == "Sidebars": self.leftSidebar.setVisible(self.profiles[name][1][0]) self.bottomSidebar.setVisible(self.profiles[name][1][1]) - self.rightSidebar.setVisible(self.profiles[name][1][2]) + if self.rightSidebar: + self.rightSidebar.setVisible(self.profiles[name][1][2]) # step 4: remember the new profile self.currentProfile = name @@ -4747,8 +4754,12 @@ self.__currentBottomWidget = self.hToolbox.currentWidget() self.hToolbox.setCurrentWidget(self.shellAssembly) elif self.__layoutType == "Sidebars": - self.__currentRightWidget = self.rightSidebar.currentWidget() - self.rightSidebar.setCurrentWidget(self.debugViewer) + if self.rightSidebar: + self.__currentRightWidget = self.rightSidebar.currentWidget() + self.rightSidebar.setCurrentWidget(self.debugViewer) + else: + self.__currentRightWidget = self.leftSidebar.currentWidget() + self.leftSidebar.setCurrentWidget(self.debugViewer) self.__currentBottomWidget = self.bottomSidebar.currentWidget() self.bottomSidebar.setCurrentWidget(self.shellAssembly) @@ -4764,7 +4775,12 @@ self.hToolbox.setCurrentWidget(self.__currentBottomWidget) elif self.__layoutType == "Sidebars": if self.__currentRightWidget: - self.rightSidebar.setCurrentWidget(self.__currentRightWidget) + if self.rightSidebar: + self.rightSidebar.setCurrentWidget( + self.__currentRightWidget) + else: + self.leftSidebar.setCurrentWidget( + self.__currentRightWidget) if self.__currentBottomWidget: self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget) self.__currentRightWidget = None @@ -4812,6 +4828,22 @@ """ return self.__layoutType + def __activateLeftRightSidebarWidget(self, widget): + """ + Private method to activate the given widget in the left or right + sidebar. + + @param widget reference to the widget to be activated + @type QWidget + """ + sidebar = ( + self.leftSidebar + if Preferences.getUI("CombinedLeftRightSidebar") else + self.rightSidebar + ) + sidebar.show() + sidebar.setCurrentWidget(widget) + def __activateProjectBrowser(self): """ Private slot to handle the activation of the project browser. @@ -4846,8 +4878,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.debugViewer) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.debugViewer) + self.__activateLeftRightSidebarWidget(self.debugViewer) self.debugViewer.currentWidget().setFocus( Qt.FocusReason.ActiveWindowFocusReason) @@ -5001,8 +5032,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.cooperation) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.cooperation) + self.__activateLeftRightSidebarWidget(self.cooperation) self.cooperation.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateIRC(self): @@ -5014,8 +5044,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.irc) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.irc) + self.__activateLeftRightSidebarWidget(self.irc) self.irc.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateSymbolsViewer(self): @@ -5064,8 +5093,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.codeDocumentationViewer) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget( + self.__activateLeftRightSidebarWidget( self.codeDocumentationViewer) if switchFocus: self.codeDocumentationViewer.setFocus( @@ -5080,8 +5108,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.pipWidget) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.pipWidget) + self.__activateLeftRightSidebarWidget(self.pipWidget) self.pipWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateCondaWidget(self): @@ -5093,8 +5120,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.condaWidget) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.condaWidget) + self.__activateLeftRightSidebarWidget(self.condaWidget) self.condaWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason) def __activateMicroPython(self): @@ -5106,8 +5132,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.microPythonWidget) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.microPythonWidget) + self.__activateLeftRightSidebarWidget(self.microPythonWidget) self.microPythonWidget.setFocus( Qt.FocusReason.ActiveWindowFocusReason) @@ -6402,17 +6427,19 @@ if self.__layoutType == "Sidebars": self.leftSidebar.setIconBarColor( Preferences.getUI("IconBarColor")) + self.leftSidebar.setIconBarSize( + Preferences.getUI("IconBarSize")) + self.bottomSidebar.setIconBarColor( Preferences.getUI("IconBarColor")) - self.rightSidebar.setIconBarColor( - Preferences.getUI("IconBarColor")) - - self.leftSidebar.setIconBarSize( - Preferences.getUI("IconBarSize")) self.bottomSidebar.setIconBarSize( Preferences.getUI("IconBarSize")) - self.rightSidebar.setIconBarSize( - Preferences.getUI("IconBarSize")) + + if self.rightSidebar: + self.rightSidebar.setIconBarColor( + Preferences.getUI("IconBarColor")) + self.rightSidebar.setIconBarSize( + Preferences.getUI("IconBarSize")) self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength") self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename") @@ -7056,8 +7083,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.__helpViewerWidget) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.__helpViewerWidget) + self.__activateLeftRightSidebarWidget(self.__helpViewerWidget) self.__helpViewerWidget.setFocus( Qt.FocusReason.ActiveWindowFocusReason) @@ -7190,8 +7216,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.pluginRepositoryViewer) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.pluginRepositoryViewer) + self.__activateLeftRightSidebarWidget(self.pluginRepositoryViewer) self.pluginRepositoryViewer.setFocus( Qt.FocusReason.ActiveWindowFocusReason) @@ -7936,7 +7961,7 @@ self.rToolboxDock.show() self.rToolbox.setCurrentWidget(self.__virtualenvManagerWidget) elif self.__layoutType == "Sidebars": - self.rightSidebar.show() - self.rightSidebar.setCurrentWidget(self.__virtualenvManagerWidget) + self.__activateLeftRightSidebarWidget( + self.__virtualenvManagerWidget) self.__virtualenvManagerWidget.setFocus( Qt.FocusReason.ActiveWindowFocusReason)