How gabrielmakedrive/juntarpdflocal works
Main Components
• GUI Layer: Representing the user interface built using Tkinter. This includes buttons (e.g., “Adicionar PDF”, “Remover PDF”, “Juntar PDFs”), the list widget for displaying selected PDFs, and controls for reordering the PDFs.
• PDF Processing Module: The core functionality where the merging logic happens using PyPDF2. This includes:
• File selection handler – validating selected files are proper PDFs.
• File ordering logic – managing the list order based on user actions.
• PDF merging and saving logic – integrating the selected PDFs into a single output file.
• Application Entry Point: The main.py file which initializes the application, sets up the GUI, and ties in the processing functions.
• Build and Distribution Modules: Although not part of runtime architecture, the PyInstaller build process (represented by main.spec, build/, and dist/) is important to show how source code is packaged into an executable.
Relationships and Interactions
• The processing module, upon merging, interacts with the file system, confirming file types and writing the final PDF output.
• The main.py file ties both layers together by initializing the GUI and setting up event listeners that bind user actions to PDF processing functions.
• Optionally, include the PyInstaller layer (build and dist directories) as an external packaging pipeline that takes the source code as input to produce the final distributable executable.
Architectural Patterns and Design Principles
• Modular design: Show distinct modules for handling PDF selection, ordering, and merging, which enhances maintainability and allows for easy future extensions.
• Packaging pipeline: Illustrate that the application is designed to be portable through PyInstaller by outlining the build process separately.
Relevant Technologies
• Tkinter for the UI.
• PyPDF2 for PDF operations.
• Python as the development language.
• PyInstaller for creating the executable (packaging layer).