eric7/QScintilla/EditorOutlineSizesDialog.py

Sun, 21 Nov 2021 12:16:53 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 21 Nov 2021 12:16:53 +0100
branch
eric7
changeset 8780
be7aabf2acef
child 8783
04fe1beecd9c
permissions
-rw-r--r--

Added a dialog to change the source outline width values from the context menu.

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
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2021 Detlev Offenbach <detlev@die-offenbachs.de>
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 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 Class documentation goes here.
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
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 def __init__(self, currentWidth, defaultWidth, defaultStepSize,
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 parent=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
23 """
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 Constructor
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
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @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
27 @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
28 @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
29 @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
30 @param defaultStepSize value of the step size
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 @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
32 @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
33 @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
34 """
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 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
36 self.setupUi(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
37
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.__defaultWidth = defaultWidth
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.__defaultStepSize = defaultStepSize
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40
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 self.sourceOutlineWidthSpinBox.setValue(currentWidth)
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.sourceOutlineWidthStepSpinBox.setValue(defaultStepSize)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
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 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
45 self.resize(max(self.width(), msh.width()), msh.height())
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 @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
48 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
49 """
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 Private slot to handle the selection of a dialog 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
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 @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
53 @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
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 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
56 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
57 ):
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 self.sourceOutlineWidthSpinBox.setValue(self.__defaultWidth)
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 self.sourceOutlineWidthStepSpinBox.setValue(self.__defaultStepSize)
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 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
62 """
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 Public method to retrieve the entered values.
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 @return tuple containing the values of the default width and step size
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 @rtype tuple of (int, 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
67 """
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 return (
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.sourceOutlineWidthSpinBox.value(),
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.sourceOutlineWidthStepSpinBox.value()
be7aabf2acef Added a dialog to change the source outline width values from the context menu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 )

eric ide

mercurial