diff -r dba433b4f3d6 -r 85418cf03fdb ProjectDjangoTagsMenu/IfTagInputDialog.py --- a/ProjectDjangoTagsMenu/IfTagInputDialog.py Thu Dec 30 12:03:18 2021 +0100 +++ b/ProjectDjangoTagsMenu/IfTagInputDialog.py Wed Sep 21 16:38:40 2022 +0200 @@ -17,45 +17,44 @@ """ Class implementing a dialog to enter the parameters for the if tag. """ + def __init__(self, parent=None): """ Constructor - + @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + @pyqtSlot(str) def on_ifEdit_textChanged(self, txt): """ Private slot to handle changes of the 'if' expression. - + @param txt text of the line edit @type str """ - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) - + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(bool(txt)) + def getTag(self): """ Public method to retrieve the tag. - + @return tag @rtype str """ - tag = '{{% if {0} %}}\n'.format(self.ifEdit.text()) + tag = "{{% if {0} %}}\n".format(self.ifEdit.text()) elifText = self.elifEdit.toPlainText() if elifText: for expression in elifText.splitlines(): if expression.strip(): - tag += '{{% elif {0} %}}\n'.format(expression.strip()) + tag += "{{% elif {0} %}}\n".format(expression.strip()) if self.elseCheckBox.isChecked(): - tag += '{% else %}\n' - tag += '{% endif %}' - + tag += "{% else %}\n" + tag += "{% endif %}" + return tag