src/eric7/QScintilla/EditorOutline.py

branch
eric7
changeset 10849
78d338b6d89f
parent 10832
479cf39ac9cb
child 11006
a671918232f3
--- a/src/eric7/QScintilla/EditorOutline.py	Mon Jul 15 16:40:23 2024 +0200
+++ b/src/eric7/QScintilla/EditorOutline.py	Tue Jul 16 15:14:23 2024 +0200
@@ -253,14 +253,6 @@
         )
         self.__menu.addSeparator()
         self.__menu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Increment Width"),
-            self.__incWidth,
-        )
-        self.__decWidthAct = self.__menu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Decrement Width"),
-            self.__decWidth,
-        )
-        self.__menu.addAction(
             QCoreApplication.translate("EditorOutlineView", "Set to Default Width"),
             self.__defaultWidth,
         )
@@ -297,14 +289,6 @@
         )
         self.__attributeMenu.addSeparator()
         self.__attributeMenu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Increment Width"),
-            self.__incWidth,
-        )
-        self.__attributeDecWidthAct = self.__attributeMenu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Decrement Width"),
-            self.__decWidth,
-        )
-        self.__attributeMenu.addAction(
             QCoreApplication.translate("EditorOutlineView", "Set to Default Width"),
             self.__defaultWidth,
         )
@@ -334,14 +318,6 @@
         )
         self.__backMenu.addSeparator()
         self.__backMenu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Increment Width"),
-            self.__incWidth,
-        )
-        self.__backDecWidthAct = self.__backMenu.addAction(
-            QCoreApplication.translate("EditorOutlineView", "Decrement Width"),
-            self.__decWidth,
-        )
-        self.__backMenu.addAction(
             QCoreApplication.translate("EditorOutlineView", "Set to Default Width"),
             self.__defaultWidth,
         )
@@ -361,22 +337,15 @@
         index = self.indexAt(coord)
         coord = self.mapToGlobal(coord)
 
-        decWidthEnable = self.maximumWidth() != 2 * Preferences.getEditor(
-            "SourceOutlineStepSize"
-        )
-
         if index.isValid():
             self.setCurrentIndex(index)
 
             itm = self.model().item(index)
             if isinstance(itm, (BrowserClassAttributeItem, BrowserImportItem)):
-                self.__attributeDecWidthAct.setEnabled(decWidthEnable)
                 self.__attributeMenu.popup(coord)
             else:
-                self.__decWidthAct.setEnabled(decWidthEnable)
                 self.__menu.popup(coord)
         else:
-            self.__backDecWidthAct.setEnabled(decWidthEnable)
             self.__backMenu.popup(coord)
 
     @pyqtSlot()
@@ -438,33 +407,13 @@
             cb.setText(fn)
 
     @pyqtSlot()
-    def __incWidth(self):
-        """
-        Private slot to increment the width of the outline.
-        """
-        self.setMaximumWidth(
-            self.maximumWidth() + Preferences.getEditor("SourceOutlineStepSize")
-        )
-        self.updateGeometry()
-
-    @pyqtSlot()
-    def __decWidth(self):
-        """
-        Private slot to decrement the width of the outline.
-        """
-        stepSize = Preferences.getEditor("SourceOutlineStepSize")
-        newWidth = self.maximumWidth() - stepSize
-
-        self.setMaximumWidth(max(newWidth, 2 * stepSize))
-        self.updateGeometry()
-
-    @pyqtSlot()
     def __defaultWidth(self):
         """
         Private slot to set the outline to the default width.
         """
-        self.setMaximumWidth(Preferences.getEditor("SourceOutlineWidth"))
-        self.updateGeometry()
+        width = Preferences.getEditor("SourceOutlineWidth")
+        splitterWidth = self.parent().width() - self.parent().handleWidth()
+        self.parent().setSizes([splitterWidth - width, width])
 
     @pyqtSlot()
     def __changeDefaultWidth(self):
@@ -474,16 +423,14 @@
         """
         from .EditorOutlineSizesDialog import EditorOutlineSizesDialog
 
-        stepSize = Preferences.getEditor("SourceOutlineStepSize")
         defaultWidth = Preferences.getEditor("SourceOutlineWidth")
-        currentWidth = self.maximumWidth()
+        currentWidth = self.parent().sizes()[1]
 
-        dlg = EditorOutlineSizesDialog(currentWidth, defaultWidth, stepSize)
+        dlg = EditorOutlineSizesDialog(currentWidth, defaultWidth)
         if dlg.exec() == QDialog.DialogCode.Accepted:
-            newDefaultWidth, stepSize = dlg.getSizes()
+            newDefaultWidth = dlg.getSizes()
 
             Preferences.setEditor("SourceOutlineWidth", newDefaultWidth)
-            Preferences.setEditor("SourceOutlineStepSize", stepSize)
 
             if newDefaultWidth != currentWidth:
                 self.__defaultWidth()

eric ide

mercurial