17 class EditorOutlineSizesDialog(QDialog, Ui_EditorOutlineSizesDialog): |
17 class EditorOutlineSizesDialog(QDialog, Ui_EditorOutlineSizesDialog): |
18 """ |
18 """ |
19 Class implementing a dialog to change the default size settings of the |
19 Class implementing a dialog to change the default size settings of the |
20 Source Outline pane. |
20 Source Outline pane. |
21 """ |
21 """ |
22 def __init__(self, currentWidth, defaultWidth, defaultStepSize, |
22 |
23 parent=None): |
23 def __init__(self, currentWidth, defaultWidth, defaultStepSize, parent=None): |
24 """ |
24 """ |
25 Constructor |
25 Constructor |
26 |
26 |
27 @param currentWidth value of the current width |
27 @param currentWidth value of the current width |
28 @type int |
28 @type int |
29 @param defaultWidth value of the default width |
29 @param defaultWidth value of the default width |
30 @type int |
30 @type int |
31 @param defaultStepSize value of the step size |
31 @param defaultStepSize value of the step size |
33 @param parent reference to the parent widget (defaults to None) |
33 @param parent reference to the parent widget (defaults to None) |
34 @type QWidget (optional) |
34 @type QWidget (optional) |
35 """ |
35 """ |
36 super().__init__(parent) |
36 super().__init__(parent) |
37 self.setupUi(self) |
37 self.setupUi(self) |
38 |
38 |
39 self.__defaultWidth = defaultWidth |
39 self.__defaultWidth = defaultWidth |
40 self.__defaultStepSize = defaultStepSize |
40 self.__defaultStepSize = defaultStepSize |
41 |
41 |
42 self.sourceOutlineWidthSpinBox.setValue(currentWidth) |
42 self.sourceOutlineWidthSpinBox.setValue(currentWidth) |
43 self.sourceOutlineWidthStepSpinBox.setValue(defaultStepSize) |
43 self.sourceOutlineWidthStepSpinBox.setValue(defaultStepSize) |
44 |
44 |
45 msh = self.minimumSizeHint() |
45 msh = self.minimumSizeHint() |
46 self.resize(max(self.width(), msh.width()), msh.height()) |
46 self.resize(max(self.width(), msh.width()), msh.height()) |
47 |
47 |
48 @pyqtSlot(QAbstractButton) |
48 @pyqtSlot(QAbstractButton) |
49 def on_buttonBox_clicked(self, button): |
49 def on_buttonBox_clicked(self, button): |
50 """ |
50 """ |
51 Private slot to handle the selection of a dialog button. |
51 Private slot to handle the selection of a dialog button. |
52 |
52 |
53 @param button reference to the clicked button |
53 @param button reference to the clicked button |
54 @type QAbstractButton |
54 @type QAbstractButton |
55 """ |
55 """ |
56 if button is self.buttonBox.button( |
56 if button is self.buttonBox.button( |
57 QDialogButtonBox.StandardButton.RestoreDefaults |
57 QDialogButtonBox.StandardButton.RestoreDefaults |
58 ): |
58 ): |
59 self.sourceOutlineWidthSpinBox.setValue(self.__defaultWidth) |
59 self.sourceOutlineWidthSpinBox.setValue(self.__defaultWidth) |
60 self.sourceOutlineWidthStepSpinBox.setValue(self.__defaultStepSize) |
60 self.sourceOutlineWidthStepSpinBox.setValue(self.__defaultStepSize) |
61 |
61 |
62 def getSizes(self): |
62 def getSizes(self): |
63 """ |
63 """ |
64 Public method to retrieve the entered values. |
64 Public method to retrieve the entered values. |
65 |
65 |
66 @return tuple containing the values of the default width and step size |
66 @return tuple containing the values of the default width and step size |
67 @rtype tuple of (int, int) |
67 @rtype tuple of (int, int) |
68 """ |
68 """ |
69 return ( |
69 return ( |
70 self.sourceOutlineWidthSpinBox.value(), |
70 self.sourceOutlineWidthSpinBox.value(), |
71 self.sourceOutlineWidthStepSpinBox.value() |
71 self.sourceOutlineWidthStepSpinBox.value(), |
72 ) |
72 ) |