From e7b03463bb3b24cda3c74478b742c2bcd16df197 Mon Sep 17 00:00:00 2001 From: Manu Varkey Date: Fri, 10 Nov 2023 11:19:16 +0530 Subject: [PATCH] Windows fixes --- cmbautomiser/data/datamodel.py | 6 +++--- cmbautomiser/misc.py | 15 ++++++--------- pyinstaller_spec.spec | 12 ++++++------ 3 files changed, 15 insertions(+), 18 deletions(-) diff --git a/cmbautomiser/data/datamodel.py b/cmbautomiser/data/datamodel.py index 70a4d13..a1418ca 100644 --- a/cmbautomiser/data/datamodel.py +++ b/cmbautomiser/data/datamodel.py @@ -524,7 +524,7 @@ def render_cmb(self, folder, replacement_dict, path, recursive = True, progress= # Run latex on file if progress is not None: progress.add_message('Rendering CMB No.' + self.cmbs[path[0]].name) - code = misc.run_latex(misc.posix_path(folder), filename, self.program_settings['latex_path']) + code = misc.run_latex(misc.posix_path(folder), filename) if progress is not None: progress.pulse() if code == misc.CMB_ERROR: @@ -699,14 +699,14 @@ def render_bill(self, folder, replacement_dict, path, recursive=True, progress=N # Render this bill if progress is not None: progress.add_message('Rendering Bill No.' + bill.data.cmb_name + ' Abstract') - code = misc.run_latex(misc.posix_path(folder), filename, self.program_settings['latex_path']) + code = misc.run_latex(misc.posix_path(folder), filename) if progress is not None: progress.pulse() if code == misc.CMB_ERROR: return (misc.CMB_ERROR, 'Rendering of Bill: ' + bill.data.title + ' failed') if progress is not None: progress.add_message('Rendering Bill No.' + bill.data.cmb_name + ' Schedule') - code_bill = misc.run_latex(misc.posix_path(folder), filename_bill, self.program_settings['latex_path']) + code_bill = misc.run_latex(misc.posix_path(folder), filename_bill) if progress is not None: progress.pulse() if code_bill == misc.CMB_ERROR: diff --git a/cmbautomiser/misc.py b/cmbautomiser/misc.py index 6e4da03..e6a8bae 100644 --- a/cmbautomiser/misc.py +++ b/cmbautomiser/misc.py @@ -131,12 +131,6 @@ def init_global_platform_vars(): global_settings_dict = dict() - if platform.system() == 'Linux': - global_settings_dict['latex_path'] = 'lualatex' - elif platform.system() == 'Windows': - global_settings_dict['latex_path'] = abs_path( - 'miketex\\miktex\\bin\\x64\\lualatex.exe') - global_settings_dict['$cmbissuedto$'] = '' global_settings_dict['$cmbvarifyingauthority$'] = '' global_settings_dict['$cmbvarifyingauthorityoffice$'] = '' @@ -144,8 +138,7 @@ def init_global_platform_vars(): global_settings_dict['$cmbissuingauthorityoffice$'] = '' return global_settings_dict -global_platform_vars_captions = ['Latex path', - 'CMB Issued to (Default Value)', +global_platform_vars_captions = ['CMB Issued to (Default Value)', 'Varifying Authority (Default Value)', 'Varifying Authority Office (Default Value)', 'Issuing Authority (Default Value)', @@ -939,8 +932,12 @@ def get_file_path_from_dnd_dropped_uri(uri): return path -def run_latex(folder, filename, latex_path): +def run_latex(folder, filename): """Runs latex on file to folder in two passes""" + if platform.system() == 'Linux': + latex_path = 'lualatex' + elif platform.system() == 'Windows': + latex_path = abs_path('miketex\\miktex\\bin\\x64\\lualatex.exe') if filename is not None: latex_exec = Command([latex_path, '-interaction=batchmode', '-output-directory=' + folder, filename]) # First Pass diff --git a/pyinstaller_spec.spec b/pyinstaller_spec.spec index ed63f23..945a8ce 100644 --- a/pyinstaller_spec.spec +++ b/pyinstaller_spec.spec @@ -3,12 +3,12 @@ block_cipher = None added_files = [ - ( 'cmbautomiser/interface/*.glade', 'interface' ), - ( 'cmbautomiser/templates/*.py', 'templates' ), - ( 'cmbautomiser/latex/*.tex', 'latex' ), - ( 'cmbautomiser/ods_templates/*.xlsx', 'ods_templates' ), - ( 'cmbautomiser/documentation/*.pdf', 'documentation' ), - ( 'miketex/', 'miketex' ) + ( 'cmbautomiser/interface/*.glade', 'cmbautomiser/interface' ), + ( 'cmbautomiser/templates/*.py', 'cmbautomiser/templates' ), + ( 'cmbautomiser/latex/*.tex', 'cmbautomiser/latex' ), + ( 'cmbautomiser/ods_templates/*.xlsx', 'cmbautomiser/ods_templates' ), + ( 'cmbautomiser/documentation/*.pdf', 'cmbautomiser/documentation' ), + ( 'miketex/', 'cmbautomiser/miketex' ) ] a = Analysis(['cmbautomiser_launcher.py'],