Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
hotfix - XML export was not working. bump version
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Sep 3, 2018
1 parent 586821c commit a3ee975
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 11 deletions.
9 changes: 5 additions & 4 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,11 @@ def update_search_form(self, search: dict):
def export(self):
"""Launch export"""
# check export options
li_opts = list(self.ui.chb_output_excel.isChecked(),
self.ui.chb_output_word.isChecked(),
self.ui.chb_output_xml.isChecked())
if not all(li_opts):
li_opts = [self.ui.chb_output_excel.isChecked(),
self.ui.chb_output_word.isChecked(),
self.ui.chb_output_xml.isChecked()
]
if not any(li_opts):
QMessageBox.critical(self,
self.tr("Export option is missing"),
self.tr("At least one export option required."))
Expand Down
18 changes: 11 additions & 7 deletions modules/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ def __init__(self,
def run(self):
"""Export metadata into an Excel workbook
"""
language = current_locale.name()[:2]
# workbook
wb = Isogeo2xlsx(lang="FR",
wb = Isogeo2xlsx(lang=language,
url_base="https://open.isogeo.com")
wb.set_worksheets(auto=self.search.get('tags').keys(),
dashboard=self.opt_dasboard,
Expand All @@ -133,7 +134,7 @@ def run(self):
for md in self.search.get("results"):
# show progression
md_title = md.get("title", "No title")
self.sig_step.emit(1, "Processing Excel: {}".format(md_title))
self.sig_step.emit(1, self.tr("Processing Excel: {}").format(md_title))
# store metadata
wb.store_metadatas(md)

Expand All @@ -156,7 +157,7 @@ def run(self):

# Excel export finished
# Now inform the main thread with the output (fill_app_props)
self.sig_step.emit(0, "Excel finished")
self.sig_step.emit(0, self.tr("Excel finished"))


class ExportWordThread(QThread):
Expand Down Expand Up @@ -188,7 +189,7 @@ def run(self):
for md in self.search.get("results"):
# progression
md_title = md.get("title", "No title")
self.sig_step.emit(1, "Processing Word: {}".format(md_title))
self.sig_step.emit(1, self.tr("Processing Word: {}").format(md_title))
# templating
tpl = DocxTemplate(self.tpl_path)
# fill template
Expand Down Expand Up @@ -216,12 +217,12 @@ def run(self):
tpl.save(out_docx_filename)
except Exception as e:
logger.error(e)
self.sig_step.emit(0, "Word: Error")
self.sig_step.emit(0, self.tr("Word: error occurred during savgin step. Check the log."))
del tpl

# Word export finished
# Now inform the main thread with the output (fill_app_props)
self.sig_step.emit(0, "Word finished")
self.sig_step.emit(0, self.tr("Word finished"))


class ExportXmlThread(QThread):
Expand Down Expand Up @@ -273,7 +274,10 @@ def run(self):
pass
uuid = "{}".format(md.get("_id")[:self.length_uuid])

out_xml_path = path.join(out_dir, "{}_{}.xml".format(md_name, uuid))
if self.opt_zip:
out_xml_path = path.join(out_dir, "{}_{}.xml".format(md_name, uuid))
else:
out_xml_path = out_dir + "_{}_{}.xml".format(md_name, uuid)
logger.debug("XML - Output path: {}".format(out_xml_path))
# export
xml_stream = self.api_mngr.isogeo.xml19139(self.api_mngr.token,
Expand Down

0 comments on commit a3ee975

Please sign in to comment.