diff -r dba433b4f3d6 -r 85418cf03fdb ProjectDjangoTagsMenu/IeCommentDialog.py --- a/ProjectDjangoTagsMenu/IeCommentDialog.py Thu Dec 30 12:03:18 2021 +0100 +++ b/ProjectDjangoTagsMenu/IeCommentDialog.py Wed Sep 21 16:38:40 2022 +0200 @@ -16,39 +16,46 @@ """ Class implementing a dialog to enter data for an IE comment. """ + def __init__(self, parent=None): """ Constructor - + @param parent reference to the parent widget @type QWidget """ super().__init__(parent) self.setupUi(self) - - for condStr, condData in [("==", ""), ("<=", " lte"), ("<", " lt"), - (">", " gt"), (">=", " gte")]: + + for condStr, condData in [ + ("==", ""), + ("<=", " lte"), + ("<", " lt"), + (">", " gt"), + (">=", " gte"), + ]: self.conditionalComboBox.addItem(condStr, condData) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + def getData(self): """ Public method to retrieve the entered data. - + @return tuple of condition and version @rtype tuple of (str, int) """ - return (self.conditionalComboBox.itemData( - self.conditionalComboBox.currentIndex()), - self.versionSpinBox.value()) - + return ( + self.conditionalComboBox.itemData(self.conditionalComboBox.currentIndex()), + self.versionSpinBox.value(), + ) + @staticmethod def getTag(selectedText): """ Public static method to get the formatted tag. - + @param selectedText selected text to embed @type str @return formatted tag and a flag indicating the acceptance state @@ -57,8 +64,9 @@ dlg = IeCommentDialog() if dlg.exec() == QDialog.DialogCode.Accepted: condition, version = dlg.getData() - tag = '[if{0} IE {1}]> {2} <![endif]'.format( - condition, version, selectedText) + tag = "[if{0} IE {1}]> {2} <![endif]".format( + condition, version, selectedText + ) return tag, True else: return "", False