Skip to content

Commit

Permalink
Merge pull request #5 from atorus-research/devel
Browse files Browse the repository at this point in the history
Improve Error Handling and PDF Processing in pdf_util.py and pdf_compiler.py
  • Loading branch information
RossLux authored Nov 20, 2024
2 parents 8505750 + 1c12c46 commit 0e4ae71
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 190 deletions.
22 changes: 16 additions & 6 deletions src/pdf_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,31 @@ def combine_pdfs(self):
self.gui.root.update()

# Combine PDFs
self.util.go_combine_selected_pdf(
combined = self.util.go_combine_selected_pdf(
dir=self.pathToPDF,
meta_data_=metadata_path,
out_name=self.gui.OUTPUT_FILENAME,
prot_fl=False,
title_sep=self.gui.title_separator,
add_popul=self.gui.add_population
)
current_progress += 1
self.gui.pb1['value'] = current_progress
self.gui.root.update()

if combined:
current_progress += 1
self.gui.pb1['value'] = current_progress
self.gui.root.update()

# Only add TOC if files were actually combined
self.add_toc()

pdfs_count = len([f for f in os.listdir(self.pathToPDF) if f.endswith('.pdf')])

self.gui.logger.warning(
'\nINFO: Job finished! ' + str(tlfs_count) + ' files were added to ' + self.gui.OUTPUT_FILENAME)
self.gui.logger.warning('\nINFO: ' + self.gui.OUTPUT_FILENAME + ' is saved in ' + str(os.getcwd()))
f'\nINFO: Job finished! {tlfs_count} files were processed and '
f'{pdfs_count} were added to {self.gui.OUTPUT_FILENAME}')

if pdfs_count > 0:
self.gui.logger.warning('\nINFO: ' + self.gui.OUTPUT_FILENAME + ' is saved in ' + str(os.getcwd()))

# Final progress update
self.gui.pb1['value'] = total_steps
Expand Down
Loading

0 comments on commit 0e4ae71

Please sign in to comment.