src/eric7/QScintilla/EditorOutlineSizesDialog.py

Tue, 16 Jul 2024 15:14:23 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 16 Jul 2024 15:14:23 +0200
branch
eric7
changeset 10849
78d338b6d89f
parent 10439
21c28b0f9e41
child 11090
f5f5f5803935
permissions
-rw-r--r--

Editor
- Changed the editor layout to use a splitter between editor and code layout to enhance the flexibility.

8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
3 # Copyright (c) 2021 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to change the default size settings of the Source
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 Outline pane.
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt6.QtCore import pyqtSlot
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt6.QtWidgets import QAbstractButton, QDialog, QDialogButtonBox
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_EditorOutlineSizesDialog import Ui_EditorOutlineSizesDialog
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 class EditorOutlineSizesDialog(QDialog, Ui_EditorOutlineSizesDialog):
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
8783
04fe1beecd9c Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8780
diff changeset
19 Class implementing a dialog to change the default size settings of the
04fe1beecd9c Fixed a few code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8780
diff changeset
20 Source Outline pane.
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
22
10849
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
23 def __init__(self, currentWidth, defaultWidth, parent=None):
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
26
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param currentWidth value of the current width
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 @type int
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 @param defaultWidth value of the default width
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 @type int
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param parent reference to the parent widget (defaults to None)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type QWidget (optional)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 super().__init__(parent)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
36
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__defaultWidth = defaultWidth
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
38
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.sourceOutlineWidthSpinBox.setValue(currentWidth)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 msh = self.minimumSizeHint()
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.resize(max(self.width(), msh.width()), msh.height())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
43
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 @pyqtSlot(QAbstractButton)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 def on_buttonBox_clicked(self, button):
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Private slot to handle the selection of a dialog button.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @param button reference to the clicked button
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @type QAbstractButton
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 if button is self.buttonBox.button(
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 QDialogButtonBox.StandardButton.RestoreDefaults
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 ):
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.sourceOutlineWidthSpinBox.setValue(self.__defaultWidth)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 def getSizes(self):
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Public method to retrieve the entered values.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60
10849
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
61 @return new default width value
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
62 @rtype int
8780
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
10849
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
64 return self.sourceOutlineWidthSpinBox.value()

eric ide

mercurial