|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2003 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data for a new property. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
|
11 |
|
12 from .Ui_SvnPropDelDialog import Ui_SvnPropDelDialog |
|
13 |
|
14 |
|
15 class SvnPropDelDialog(QDialog, Ui_SvnPropDelDialog): |
|
16 """ |
|
17 Class implementing a dialog to enter the data for a new property. |
|
18 """ |
|
19 def __init__(self, recursive, parent=None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param recursive flag indicating a recursive set is requested |
|
24 @param parent parent widget (QWidget) |
|
25 """ |
|
26 super().__init__(parent) |
|
27 self.setupUi(self) |
|
28 |
|
29 self.okButton = self.buttonBox.button( |
|
30 QDialogButtonBox.StandardButton.Ok) |
|
31 self.okButton.setEnabled(False) |
|
32 |
|
33 self.recurseCheckBox.setChecked(recursive) |
|
34 |
|
35 msh = self.minimumSizeHint() |
|
36 self.resize(max(self.width(), msh.width()), msh.height()) |
|
37 |
|
38 def on_propNameEdit_textChanged(self, text): |
|
39 """ |
|
40 Private method used to enable/disable the OK-button. |
|
41 |
|
42 @param text ignored |
|
43 """ |
|
44 self.okButton.setDisabled(text == "") |
|
45 |
|
46 def getData(self): |
|
47 """ |
|
48 Public slot used to retrieve the data entered into the dialog. |
|
49 |
|
50 @return tuple of two values giving the property name and a flag |
|
51 indicating, that this property should be applied recursively. |
|
52 (string, boolean) |
|
53 """ |
|
54 return (self.propNameEdit.text(), |
|
55 self.recurseCheckBox.isChecked()) |