14 |
14 |
15 class ZoomDialog(QDialog, Ui_ZoomDialog): |
15 class ZoomDialog(QDialog, Ui_ZoomDialog): |
16 """ |
16 """ |
17 Class implementing a dialog to select the zoom scale. |
17 Class implementing a dialog to select the zoom scale. |
18 """ |
18 """ |
|
19 |
19 def __init__(self, zoom, parent, name=None, modal=False): |
20 def __init__(self, zoom, parent, name=None, modal=False): |
20 """ |
21 """ |
21 Constructor |
22 Constructor |
22 |
23 |
23 @param zoom zoom factor to show in the spinbox |
24 @param zoom zoom factor to show in the spinbox |
24 @param parent parent widget of this dialog (QWidget) |
25 @param parent parent widget of this dialog (QWidget) |
25 @param name name of this dialog (string) |
26 @param name name of this dialog (string) |
26 @param modal modal dialog state (boolean) |
27 @param modal modal dialog state (boolean) |
27 """ |
28 """ |
28 super().__init__(parent) |
29 super().__init__(parent) |
29 if name: |
30 if name: |
30 self.setObjectName(name) |
31 self.setObjectName(name) |
31 self.setupUi(self) |
32 self.setupUi(self) |
32 self.setModal(modal) |
33 self.setModal(modal) |
33 |
34 |
34 self.zoomSpinBox.setValue(zoom) |
35 self.zoomSpinBox.setValue(zoom) |
35 self.zoomSpinBox.selectAll() |
36 self.zoomSpinBox.selectAll() |
36 |
37 |
37 msh = self.minimumSizeHint() |
38 msh = self.minimumSizeHint() |
38 self.resize(max(self.width(), msh.width()), msh.height()) |
39 self.resize(max(self.width(), msh.width()), msh.height()) |
39 |
40 |
40 def getZoomSize(self): |
41 def getZoomSize(self): |
41 """ |
42 """ |
42 Public method to retrieve the zoom size. |
43 Public method to retrieve the zoom size. |
43 |
44 |
44 @return zoom size (int) |
45 @return zoom size (int) |
45 """ |
46 """ |
46 return self.zoomSpinBox.value() |
47 return self.zoomSpinBox.value() |