|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2006 - 2009 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 class ZoomDialog(QDialog, Ui_ZoomDialog): |
|
15 """ |
|
16 Class implementing a zoom dialog for a graphics canvas. |
|
17 """ |
|
18 def __init__(self, zoom, parent = None, name = None): |
|
19 """ |
|
20 Constructor |
|
21 |
|
22 @param zoom zoom factor to show in the spinbox (float) |
|
23 @param parent parent widget of this dialog (QWidget) |
|
24 @param name name of this dialog (string or QString) |
|
25 """ |
|
26 QDialog.__init__(self, parent) |
|
27 if name: |
|
28 self.setObjectName(name) |
|
29 else: |
|
30 self.setObjectName("ZoomDialog") |
|
31 self.setupUi(self) |
|
32 self.zoomSpinBox.setValue(zoom) |
|
33 |
|
34 def getZoomSize(self): |
|
35 """ |
|
36 Public method to retrieve the zoom size. |
|
37 |
|
38 @return zoom size (double) |
|
39 """ |
|
40 return self.zoomSpinBox.value() |