|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2002 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to select the zoom scale. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtWidgets import QDialog |
|
11 |
|
12 from .Ui_ZoomDialog import Ui_ZoomDialog |
|
13 |
|
14 |
|
15 class ZoomDialog(QDialog, Ui_ZoomDialog): |
|
16 """ |
|
17 Class implementing a dialog to select the zoom scale. |
|
18 """ |
|
19 def __init__(self, zoom, parent, name=None, modal=False): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param zoom zoom factor to show in the spinbox |
|
24 @param parent parent widget of this dialog (QWidget) |
|
25 @param name name of this dialog (string) |
|
26 @param modal modal dialog state (boolean) |
|
27 """ |
|
28 super().__init__(parent) |
|
29 if name: |
|
30 self.setObjectName(name) |
|
31 self.setupUi(self) |
|
32 self.setModal(modal) |
|
33 |
|
34 self.zoomSpinBox.setValue(zoom) |
|
35 self.zoomSpinBox.selectAll() |
|
36 |
|
37 msh = self.minimumSizeHint() |
|
38 self.resize(max(self.width(), msh.width()), msh.height()) |
|
39 |
|
40 def getZoomSize(self): |
|
41 """ |
|
42 Public method to retrieve the zoom size. |
|
43 |
|
44 @return zoom size (int) |
|
45 """ |
|
46 return self.zoomSpinBox.value() |