From 33488e54b5d45bd3a40090aa5c4f07e66417d936 Mon Sep 17 00:00:00 2001 From: Noettore Date: Fri, 26 Nov 2021 15:22:23 +0100 Subject: [PATCH] Open all generated PDF. Corrected xsd schema location for one file pyinstaller generation. --- .gitignore | 1 + fatture_ccsr/fatture_ccsr.py | 9 +++++++-- fatture_ccsr/{ => res}/schema.xsd | 0 fatture_ccsr/traf2000_converter.py | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) rename fatture_ccsr/{ => res}/schema.xsd (100%) diff --git a/.gitignore b/.gitignore index 19a84d1..2e22cdf 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ __pycache__/* *.ipynb *.spec *.wxg +.venv diff --git a/fatture_ccsr/fatture_ccsr.py b/fatture_ccsr/fatture_ccsr.py index 356b618..900251e 100644 --- a/fatture_ccsr/fatture_ccsr.py +++ b/fatture_ccsr/fatture_ccsr.py @@ -209,9 +209,14 @@ class LogDialog(wx.Dialog): def open_pdf(self, _): """open a file with the default software""" - file_path = self.GetParent().output_pdf_dialog.GetPath() + output_all_file_path = self.GetParent().output_pdf_dialog.GetPath() + path, ext = os.path.splitext(output_all_file_path) + output_ft_file_path = path+"_ft"+ext + output_nc_file_path = path+"_nc"+ext if sys.platform == "win32": - os.startfile(file_path) # pylint: disable=maybe-no-member + os.startfile(output_all_file_path) # pylint: disable=maybe-no-member + os.startfile(output_ft_file_path) # pylint: disable=maybe-no-member + os.startfile(output_nc_file_path) # pylint: disable=maybe-no-member else: opener = "open" if sys.platform == "darwin" else "xdg-open" subprocess.call([opener, file_path]) diff --git a/fatture_ccsr/schema.xsd b/fatture_ccsr/res/schema.xsd similarity index 100% rename from fatture_ccsr/schema.xsd rename to fatture_ccsr/res/schema.xsd diff --git a/fatture_ccsr/traf2000_converter.py b/fatture_ccsr/traf2000_converter.py index dc4b300..d713711 100755 --- a/fatture_ccsr/traf2000_converter.py +++ b/fatture_ccsr/traf2000_converter.py @@ -32,9 +32,9 @@ def validate_xml(xml_tree) -> bool: """validate an xml file with an xml schema (xsd)""" __location__ = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) if getattr(sys, 'frozen', False): - xsd_path = os.path.join(sys._MEIPASS, 'schema.xsd') # pylint: disable=no-member, protected-access + xsd_path = os.path.join(sys._MEIPASS, 'res/schema.xsd') # pylint: disable=no-member, protected-access else: - xsd_path = os.path.join(__location__, 'schema.xsd') + xsd_path = os.path.join(__location__, 'res/schema.xsd') xmlschema_doc = lxml.etree.parse(xsd_path) # pylint: disable=c-extension-no-member xmlschema = lxml.etree.XMLSchema(xmlschema_doc) # pylint: disable=c-extension-no-member