eric7/QScintilla/EditorOutlineSizesDialog.py

Sun, 26 Dec 2021 18:43:48 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 26 Dec 2021 18:43:48 +0100
branch
eric7
changeset 8858
a70a980e7d4f
parent 8783
04fe1beecd9c
child 8881
54e42bc2437a
permissions
-rw-r--r--

Changed the various search related combo boxes to show an error using style sheets.

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 """
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 """
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 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
23 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
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
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
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 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
32 @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
33 @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
34 @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
35 """
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 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
37 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
38
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.__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
40 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
41
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.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
43 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
44
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 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
46 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
47
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 @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
49 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
50 """
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 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
52
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 @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
54 @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
55 """
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 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
57 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
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 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
60 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
61
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 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
63 """
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 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
65
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 @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
67 @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
68 """
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 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
70 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
71 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
72 )

eric ide

mercurial