14 |
14 |
15 class UMLSceneSizeDialog(QDialog, Ui_UMLSceneSizeDialog): |
15 class UMLSceneSizeDialog(QDialog, Ui_UMLSceneSizeDialog): |
16 """ |
16 """ |
17 Class implementing a dialog to set the scene sizes. |
17 Class implementing a dialog to set the scene sizes. |
18 """ |
18 """ |
|
19 |
19 def __init__(self, w, h, minW, minH, parent=None, name=None): |
20 def __init__(self, w, h, minW, minH, parent=None, name=None): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
22 |
23 |
23 @param w current width of scene |
24 @param w current width of scene |
24 @type int |
25 @type int |
25 @param h current height of scene |
26 @param h current height of scene |
26 @type int |
27 @type int |
27 @param minW minimum width allowed |
28 @param minW minimum width allowed |
35 """ |
36 """ |
36 super().__init__(parent) |
37 super().__init__(parent) |
37 if name: |
38 if name: |
38 self.setObjectName(name) |
39 self.setObjectName(name) |
39 self.setupUi(self) |
40 self.setupUi(self) |
40 |
41 |
41 self.widthSpinBox.setValue(w) |
42 self.widthSpinBox.setValue(w) |
42 self.heightSpinBox.setValue(h) |
43 self.heightSpinBox.setValue(h) |
43 self.widthSpinBox.setMinimum(minW) |
44 self.widthSpinBox.setMinimum(minW) |
44 self.heightSpinBox.setMinimum(minH) |
45 self.heightSpinBox.setMinimum(minH) |
45 self.widthSpinBox.selectAll() |
46 self.widthSpinBox.selectAll() |
46 self.widthSpinBox.setFocus() |
47 self.widthSpinBox.setFocus() |
47 |
48 |
48 msh = self.minimumSizeHint() |
49 msh = self.minimumSizeHint() |
49 self.resize(max(self.width(), msh.width()), msh.height()) |
50 self.resize(max(self.width(), msh.width()), msh.height()) |
50 |
51 |
51 def getData(self): |
52 def getData(self): |
52 """ |
53 """ |
53 Public method to retrieve the entered data. |
54 Public method to retrieve the entered data. |
54 |
55 |
55 @return tuple giving the selected width and height |
56 @return tuple giving the selected width and height |
56 @rtype tuple of (int, int) |
57 @rtype tuple of (int, int) |
57 """ |
58 """ |
58 return (self.widthSpinBox.value(), self.heightSpinBox.value()) |
59 return (self.widthSpinBox.value(), self.heightSpinBox.value()) |