eric6/QScintilla/ZoomDialog.py

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

eric ide

mercurial