--- a/eric7/QScintilla/EditorOutline.py Sat Nov 20 17:53:03 2021 +0100 +++ b/eric7/QScintilla/EditorOutline.py Sun Nov 21 12:16:53 2021 +0100 @@ -10,7 +10,9 @@ import contextlib from PyQt6.QtCore import pyqtSlot, Qt, QCoreApplication, QModelIndex, QPoint -from PyQt6.QtWidgets import QTreeView, QAbstractItemView, QMenu, QApplication +from PyQt6.QtWidgets import ( + QTreeView, QAbstractItemView, QMenu, QApplication, QDialog +) from UI.BrowserSortFilterProxyModel import BrowserSortFilterProxyModel from UI.BrowserModel import ( @@ -261,8 +263,12 @@ self.__decWidth) self.__menu.addAction( QCoreApplication.translate( - 'EditorOutlineView', 'Set Default Width'), + 'EditorOutlineView', 'Set to Default Width'), self.__defaultWidth) + self.__menu.addAction( + QCoreApplication.translate( + 'EditorOutlineView', 'Change Default Width'), + self.__changeDefaultWidth) # create the attribute/import menu self.__gotoMenu = QMenu( @@ -302,8 +308,12 @@ self.__decWidth) self.__attributeMenu.addAction( QCoreApplication.translate( - 'EditorOutlineView', 'Set Default Width'), + 'EditorOutlineView', 'Set to Default Width'), self.__defaultWidth) + self.__attributeMenu.addAction( + QCoreApplication.translate( + 'EditorOutlineView', 'Change Default Width'), + self.__changeDefaultWidth) # create the background menu self.__backMenu = QMenu(self) @@ -335,8 +345,12 @@ self.__decWidth) self.__backMenu.addAction( QCoreApplication.translate( - 'EditorOutlineView', 'Set Default Width'), + 'EditorOutlineView', 'Set to Default Width'), self.__defaultWidth) + self.__backMenu.addAction( + QCoreApplication.translate( + 'EditorOutlineView', 'Change Default Width'), + self.__changeDefaultWidth) @pyqtSlot(QPoint) def __contextMenuRequested(self, coord): @@ -454,6 +468,28 @@ self.setMaximumWidth(Preferences.getEditor("SourceOutlineWidth")) self.updateGeometry() + @pyqtSlot() + def __changeDefaultWidth(self): + """ + Private slot to open a dialog to change the default width and step + size presetting the width with the current value. + """ + from .EditorOutlineSizesDialog import EditorOutlineSizesDialog + + stepSize = Preferences.getEditor("SourceOutlineStepSize") + defaultWidth = Preferences.getEditor("SourceOutlineWidth") + currentWidth = self.maximumWidth() + + dlg = EditorOutlineSizesDialog(currentWidth, defaultWidth, stepSize) + if dlg.exec() == QDialog.DialogCode.Accepted: + newDefaultWidth, stepSize = dlg.getSizes() + + Preferences.setEditor("SourceOutlineWidth", newDefaultWidth) + Preferences.setEditor("SourceOutlineStepSize", stepSize) + + if newDefaultWidth != currentWidth: + self.__defaultWidth() + ####################################################################### ## Methods handling editor signals below #######################################################################