|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2011 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the Add New Parameter dialog. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import pyqtSlot |
|
11 from PyQt4.QtGui import QDialog, QDialogButtonBox |
|
12 |
|
13 from Ui_AddParameterDialog import Ui_AddParameterDialog |
|
14 |
|
15 class AddParameterDialog(QDialog, Ui_AddParameterDialog): |
|
16 """ |
|
17 Class implementing the Add New Parameter dialog. |
|
18 """ |
|
19 def __init__(self, parent = None): |
|
20 """ |
|
21 Constructor |
|
22 |
|
23 @param parent reference to the parent widget (QWidget) |
|
24 """ |
|
25 QDialog.__init__(self, parent) |
|
26 self.setupUi(self) |
|
27 |
|
28 self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
|
29 self.__okButton.setEnabled(False) |
|
30 |
|
31 @pyqtSlot(str) |
|
32 def on_nameEdit_textChanged(self, txt): |
|
33 """ |
|
34 Private slot called, when the name entry is changed. |
|
35 |
|
36 @param txt text of the entry (string) |
|
37 """ |
|
38 self.__okButton.setEnabled(txt != "") |
|
39 |
|
40 def getData(self): |
|
41 """ |
|
42 Public method to extract the data entered into the dialog. |
|
43 |
|
44 @return tuple of three strings (name, default and value) |
|
45 """ |
|
46 return (self.nameEdit.text(), |
|
47 self.defaultEdit.text(), |
|
48 self.valueEdit.text()) |