10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import pyqtSlot |
12 from PyQt5.QtCore import pyqtSlot |
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
14 |
14 |
15 from Ui_AddParameterDialog import Ui_AddParameterDialog |
15 from .Ui_AddParameterDialog import Ui_AddParameterDialog |
16 |
16 |
17 |
17 |
18 class AddParameterDialog(QDialog, Ui_AddParameterDialog): |
18 class AddParameterDialog(QDialog, Ui_AddParameterDialog): |
19 """ |
19 """ |
20 Class implementing the Add New Parameter dialog. |
20 Class implementing the Add New Parameter dialog. |
21 """ |
21 """ |
22 def __init__(self, parent=None): |
22 def __init__(self, parent=None): |
23 """ |
23 """ |
24 Constructor |
24 Constructor |
25 |
25 |
26 @param parent reference to the parent widget (QWidget) |
26 @param parent reference to the parent widget |
|
27 @type QWidget |
27 """ |
28 """ |
28 QDialog.__init__(self, parent) |
29 QDialog.__init__(self, parent) |
29 self.setupUi(self) |
30 self.setupUi(self) |
30 |
31 |
31 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
32 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
37 @pyqtSlot(str) |
38 @pyqtSlot(str) |
38 def on_nameEdit_textChanged(self, txt): |
39 def on_nameEdit_textChanged(self, txt): |
39 """ |
40 """ |
40 Private slot called, when the name entry is changed. |
41 Private slot called, when the name entry is changed. |
41 |
42 |
42 @param txt text of the entry (string) |
43 @param txt text of the entry |
|
44 @type str |
43 """ |
45 """ |
44 self.__okButton.setEnabled(txt != "") |
46 self.__okButton.setEnabled(txt != "") |
45 |
47 |
46 def getData(self): |
48 def getData(self): |
47 """ |
49 """ |
48 Public method to extract the data entered into the dialog. |
50 Public method to extract the data entered into the dialog. |
49 |
51 |
50 @return tuple of three strings (name, default and value) |
52 @return tuple containing name, default and value |
|
53 @rtype tuple of (str, str, str) |
51 """ |
54 """ |
52 return (self.nameEdit.text(), |
55 return (self.nameEdit.text(), |
53 self.defaultEdit.text(), |
56 self.defaultEdit.text(), |
54 self.valueEdit.text()) |
57 self.valueEdit.text()) |