5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to enter the parameters for the if tag. |
7 Module implementing a dialog to enter the parameters for the if tag. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import pyqtSlot |
10 from PyQt6.QtCore import pyqtSlot |
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
11 from PyQt6.QtWidgets import QDialog, QDialogButtonBox |
12 |
12 |
13 from .Ui_IfTagInputDialog import Ui_IfTagInputDialog |
13 from .Ui_IfTagInputDialog import Ui_IfTagInputDialog |
14 |
14 |
15 |
15 |
16 class IfTagInputDialog(QDialog, Ui_IfTagInputDialog): |
16 class IfTagInputDialog(QDialog, Ui_IfTagInputDialog): |
19 """ |
19 """ |
20 def __init__(self, parent=None): |
20 def __init__(self, parent=None): |
21 """ |
21 """ |
22 Constructor |
22 Constructor |
23 |
23 |
24 @param parent reference to the parent widget (QWidget) |
24 @param parent reference to the parent widget |
|
25 @type QWidget |
25 """ |
26 """ |
26 super().__init__(parent) |
27 super().__init__(parent) |
27 self.setupUi(self) |
28 self.setupUi(self) |
28 |
29 |
29 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
30 self.buttonBox.button( |
|
31 QDialogButtonBox.StandardButton.Ok).setEnabled(False) |
30 |
32 |
31 @pyqtSlot(str) |
33 @pyqtSlot(str) |
32 def on_ifEdit_textChanged(self, txt): |
34 def on_ifEdit_textChanged(self, txt): |
33 """ |
35 """ |
34 Private slot to handle changes of the 'if' expression. |
36 Private slot to handle changes of the 'if' expression. |
35 |
37 |
36 @param txt text of the line edit (string) |
38 @param txt text of the line edit |
|
39 @type str |
37 """ |
40 """ |
38 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(bool(txt)) |
41 self.buttonBox.button( |
|
42 QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) |
39 |
43 |
40 def getTag(self): |
44 def getTag(self): |
41 """ |
45 """ |
42 Public method to retrieve the tag. |
46 Public method to retrieve the tag. |
43 |
47 |
44 @return tag (string) |
48 @return tag |
|
49 @rtype str |
45 """ |
50 """ |
46 tag = '{{% if {0} %}}\n'.format(self.ifEdit.text()) |
51 tag = '{{% if {0} %}}\n'.format(self.ifEdit.text()) |
47 elifText = self.elifEdit.toPlainText() |
52 elifText = self.elifEdit.toPlainText() |
48 if elifText: |
53 if elifText: |
49 for expression in elifText.splitlines(): |
54 for expression in elifText.splitlines(): |