|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2009 - 2022 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the icon size. |
|
8 """ |
|
9 |
|
10 from PyQt6.QtWidgets import QDialog |
|
11 |
|
12 from .Ui_IconSizeDialog import Ui_IconSizeDialog |
|
13 |
|
14 |
|
15 class IconSizeDialog(QDialog, Ui_IconSizeDialog): |
|
16 """ |
|
17 Class implementing a dialog to enter the icon size. |
|
18 """ |
|
19 def __init__(self, width, height, parent=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param width width to be set (integer) |
|
24 @param height height to be set (integer) |
|
25 @param parent reference to the parent widget (QWidget) |
|
26 """ |
|
27 super().__init__(parent) |
|
28 self.setupUi(self) |
|
29 |
|
30 self.widthSpin.setValue(width) |
|
31 self.heightSpin.setValue(height) |
|
32 |
|
33 self.widthSpin.selectAll() |
|
34 |
|
35 msh = self.minimumSizeHint() |
|
36 self.resize(max(self.width(), msh.width()), msh.height()) |
|
37 |
|
38 def getData(self): |
|
39 """ |
|
40 Public method to get the entered data. |
|
41 |
|
42 @return tuple with width and height (tuple of two integers) |
|
43 """ |
|
44 return self.widthSpin.value(), self.heightSpin.value() |