1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a zoom dialog for a graphics canvas. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtGui import QDialog |
|
11 |
|
12 from .Ui_ZoomDialog import Ui_ZoomDialog |
|
13 |
|
14 |
|
15 class ZoomDialog(QDialog, Ui_ZoomDialog): |
|
16 """ |
|
17 Class implementing a zoom dialog for a graphics canvas. |
|
18 """ |
|
19 def __init__(self, zoom, parent=None, name=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param zoom zoom factor to show in the spinbox (float) |
|
24 @param parent parent widget of this dialog (QWidget) |
|
25 @param name name of this dialog (string) |
|
26 """ |
|
27 super().__init__(parent) |
|
28 if name: |
|
29 self.setObjectName(name) |
|
30 else: |
|
31 self.setObjectName("ZoomDialog") |
|
32 self.setupUi(self) |
|
33 self.zoomSpinBox.setValue(zoom) |
|
34 |
|
35 def getZoomSize(self): |
|
36 """ |
|
37 Public method to retrieve the zoom size. |
|
38 |
|
39 @return zoom size (double) |
|
40 """ |
|
41 return self.zoomSpinBox.value() |
|