From 69f1026ee8707fd6291fd255de8a5c2f4340c54c Mon Sep 17 00:00:00 2001 From: Srinivas Chippagiri Date: Tue, 1 Dec 2026 01:47:29 -0800 Subject: [PATCH] use docform, the maintained fork of docxtpl --- scripts/core/hydrogen_bond_propensity/ReadMe.md | 2 +- .../hydrogen_bond_propensity_report.py | 8 ++++---- .../multi_component_hydrogen_bond_propensity/ReadMe.md | 2 +- .../multi_component_hydrogen_bond_propensity_report.py | 10 +++++----- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scripts/core/hydrogen_bond_propensity/ReadMe.md b/scripts/core/hydrogen_bond_propensity/ReadMe.md index 5d61450..b818db3 100644 --- a/scripts/core/hydrogen_bond_propensity/ReadMe.md +++ b/scripts/core/hydrogen_bond_propensity/ReadMe.md @@ -24,7 +24,7 @@ Included in the report: ## Requirements -- ```matplotlib, docxtpl``` +- ```matplotlib, docform``` - hydrogen_bond_propensity_report.docx ## Licensing Requirements diff --git a/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py b/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py index d0ceda6..90b57a3 100644 --- a/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py +++ b/scripts/core/hydrogen_bond_propensity/hydrogen_bond_propensity_report.py @@ -38,12 +38,12 @@ with warnings.catch_warnings(): warnings.simplefilter("ignore", category=DeprecationWarning) - import docxtpl + import docform from docx.shared import Cm except ImportError: error_message = """ The python-docx-template templating engine needed by this script could not - be found. Please run "{} -m pip install docxtpl" + be found. Please run "{} -m pip install docform" to try to fix the issue.\nYou may need administrator's rights to do this. """.format(sys.executable) raise ImportError(error_message) @@ -199,7 +199,7 @@ def fg_diagram(mol, directory, con): def add_picture_subdoc(picture_location, docx_template, cm=7): # This function adds a picture to the .docx file - return docxtpl.InlineImage( + return docform.InlineImage( docx_template, image_descriptor=picture_location, width=Cm(cm)) @@ -347,7 +347,7 @@ def hbp_landscape(groups, observed_groups, crystal, directory, work_directory, d def main(structure, directory, csdrefcode, min_donor_coordination, min_acceptor_coordination, fg_count, noopen=False): # This looks for the .docx template that is used to generate the report from if os.path.isfile(TEMPLATE_FILE): - docx_template = docxtpl.DocxTemplate(TEMPLATE_FILE) + docx_template = docform.DocxTemplate(TEMPLATE_FILE) else: print('Error! {} not found!'.format(TEMPLATE_FILENAME)) quit() diff --git a/scripts/materials/multi_component_hydrogen_bond_propensity/ReadMe.md b/scripts/materials/multi_component_hydrogen_bond_propensity/ReadMe.md index bb46a3d..aa588be 100644 --- a/scripts/materials/multi_component_hydrogen_bond_propensity/ReadMe.md +++ b/scripts/materials/multi_component_hydrogen_bond_propensity/ReadMe.md @@ -21,7 +21,7 @@ Summary report includes: ## Requirements -- docxtpl +- docform - multi_component_hydrogen_bond_propensity_report.docx - multi_component_pair_hbp_report.docx diff --git a/scripts/materials/multi_component_hydrogen_bond_propensity/multi_component_hydrogen_bond_propensity_report.py b/scripts/materials/multi_component_hydrogen_bond_propensity/multi_component_hydrogen_bond_propensity_report.py index f0d42a4..e8e8182 100644 --- a/scripts/materials/multi_component_hydrogen_bond_propensity/multi_component_hydrogen_bond_propensity_report.py +++ b/scripts/materials/multi_component_hydrogen_bond_propensity/multi_component_hydrogen_bond_propensity_report.py @@ -37,12 +37,12 @@ with warnings.catch_warnings(): warnings.simplefilter("ignore", category=DeprecationWarning) - import docxtpl + import docform from docx.shared import Cm except ImportError: error_message = """ The python-docx-template templating engine needed by this script could not - be found. Please run "{} -m pip install docxtpl" + be found. Please run "{} -m pip install docform" to try to fix the issue.\nYou may need administrator's rights to do this. """.format(sys.executable) raise ImportError(error_message) @@ -162,7 +162,7 @@ def make_mc_chart(dictionary, directory, mol): def add_picture_subdoc(picture_location, docx_template, wd=7): # This function adds a picture to the .docx file - return docxtpl.InlineImage( + return docform.InlineImage( docx_template, image_descriptor=picture_location, width=Cm(wd)) @@ -272,7 +272,7 @@ def pair_output(identifier, propensities, donors, acceptors, coordination_scores # This looks for the .docx template that is used to generate the report from if os.path.isfile(PAIR_TEMPLATE_FILE): - docx_template = docxtpl.DocxTemplate(PAIR_TEMPLATE_FILE) + docx_template = docform.DocxTemplate(PAIR_TEMPLATE_FILE) else: print('Error! {} not found!'.format(PAIR_TEMPLATE_FILENAME)) quit() @@ -308,7 +308,7 @@ def make_mc_report(identifier, results, directory, diagram_file, chart_file): # This looks for the .docx template that is used to generate the report from if os.path.isfile(TEMPLATE_FILE): - docx_template = docxtpl.DocxTemplate(TEMPLATE_FILE) + docx_template = docform.DocxTemplate(TEMPLATE_FILE) else: print('Error! {} not found!'.format(TEMPLATE_FILENAME)) quit()