From c78fc0e09d543d138a1dfd90c2a4ca0f7a538cff Mon Sep 17 00:00:00 2001 From: idziubenko Date: Tue, 10 Aug 2021 13:18:36 +0300 Subject: [PATCH] fixed xfce format not working properly --- pym/calculate/lib/cl_progressbar.py | 4 ++-- pym/calculate/lib/cl_template.py | 1 + pym/calculate/lib/cl_xml.py | 2 +- pym/calculate/lib/format/xml_xfce.py | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pym/calculate/lib/cl_progressbar.py b/pym/calculate/lib/cl_progressbar.py index aa0e1c2..c32353b 100644 --- a/pym/calculate/lib/cl_progressbar.py +++ b/pym/calculate/lib/cl_progressbar.py @@ -72,11 +72,11 @@ def get_progress_bar(bartype="text", title=""): pbar = ClProgressDialog() pbar.setCancelButton(None) pbar.adjustSize() - pbar.setWindowTitle(title.decode('utf-8')) + pbar.setWindowTitle(title) pbar.setAutoClose(False) pbar.setAutoReset(False) pbar.setMaximum(0) - pbar.setLabelText(title.decode('utf-8')) + pbar.setLabelText(title) pbar.setTextVisible(False) pbar.setStyleSheet("QProgressBar {border:none; text-align: center;}") return pbar diff --git a/pym/calculate/lib/cl_template.py b/pym/calculate/lib/cl_template.py index deb987a..45153d5 100644 --- a/pym/calculate/lib/cl_template.py +++ b/pym/calculate/lib/cl_template.py @@ -3796,6 +3796,7 @@ class Template(_file, _terms, _warning, xmlShare, _shareTemplate): templDirNameFile = ".calculate_directory" _titleList = ("Modified", "Processed template files" + ":") titleEnd = "For modify this file, create %(conf_path)s.clt template." + protectPaths = [] allContents = {} if "CONFIG_PROTECT" in os.environ: diff --git a/pym/calculate/lib/cl_xml.py b/pym/calculate/lib/cl_xml.py index b16e88d..30aef94 100644 --- a/pym/calculate/lib/cl_xml.py +++ b/pym/calculate/lib/cl_xml.py @@ -592,7 +592,7 @@ class xmlDoc(): areaNodes = xpath.Evaluate('descendant::area', xmlArea) for areaNode in areaNodes: prevNode = areaNode.getprevious() - if prevNode: + if prevNode is not None: parentNode = areaNode.getparent() insertBefore(parentNode, deepcopy(self.sepAreas), areaNode) diff --git a/pym/calculate/lib/format/xml_xfce.py b/pym/calculate/lib/format/xml_xfce.py index 97b605c..0912060 100644 --- a/pym/calculate/lib/format/xml_xfce.py +++ b/pym/calculate/lib/format/xml_xfce.py @@ -153,7 +153,7 @@ class xml_xfce(TemplateFormat): '(action="join", action="replace", action="drop")') self.setError(textError) return False - if xmlOldNode.getparent(): + if xmlNewNode.getparent() is not None: strAttr = [attrName, attrType] findAttr = [x for x in strAttr if x] findAttrStr = '' @@ -251,4 +251,5 @@ class xml_xfce(TemplateFormat): """Получение текстового файла из XML документа""" data = xml_to_str(self.doc).split("\n") data = [x for x in data if x.strip()] + data.insert(0, '\n') return "\n".join(data).replace("\t", " ")