--- a/eric6/Templates/TemplateViewer.py Wed Apr 21 19:40:50 2021 +0200 +++ b/eric6/Templates/TemplateViewer.py Thu Apr 22 18:02:47 2021 +0200 @@ -212,10 +212,11 @@ @return display text (string) """ - if self.description: - txt = "{0} - {1}".format(self.name, self.description) - else: - txt = self.name + txt = ( + "{0} - {1}".format(self.name, self.description) + if self.description else + self.name + ) return txt def setName(self, name): @@ -292,10 +293,11 @@ """ txt = self.template for var, val in list(varDict.items()): - if var in self.formatedVariables: - txt = self.__expandFormattedVariable(var, val, txt) - else: - txt = txt.replace(var, val) + txt = ( + self.__expandFormattedVariable(var, val, txt) + if var in self.formatedVariables else + txt.replace(var, val) + ) sepchar = Preferences.getTemplates("SeparatorChar") txt = txt.replace("{0}{1}".format(sepchar, sepchar), sepchar) prefix = "{0}{1}".format(os.linesep, indent) @@ -335,10 +337,11 @@ prefix = line[:ind] postfix = line[ind + len(var):] for count, v in enumerate(val.splitlines()): - if count: - t = "{0}{1}{2}{3}".format(t, os.linesep, indent, v) - else: - t = "{0}{1}{2}{3}".format(t, os.linesep, prefix, v) + t = ( + "{0}{1}{2}{3}".format(t, os.linesep, indent, v) + if count else + "{0}{1}{2}{3}".format(t, os.linesep, prefix, v) + ) t = "{0}{1}".format(t, postfix) else: t = "{0}{1}{2}".format(t, os.linesep, line) @@ -484,10 +487,11 @@ Private slot to handle the Add Entry context menu action. """ itm = self.currentItem() - if isinstance(itm, TemplateGroup): - groupName = itm.getName() - else: - groupName = itm.getGroupName() + groupName = ( + itm.getName() + if isinstance(itm, TemplateGroup) else + itm.getGroupName() + ) from .TemplatePropertiesDialog import TemplatePropertiesDialog dlg = TemplatePropertiesDialog(self)