Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extensive refactor for v1.0 release #212

Merged
merged 85 commits into from
Jun 6, 2024
Merged

Extensive refactor for v1.0 release #212

merged 85 commits into from
Jun 6, 2024

Conversation

cfcurtis
Copy link
Owner

@cfcurtis cfcurtis commented Jun 6, 2024

Refactoring changes

The codebase was refactored to further separate GUI elements from the processing functionality and add more command line support. The code is now structured as follows:

  • cli: Directory containing command line interface modules (just app.py for now)
  • gui: Directory containing the wxPython GUI modules
  • processing: Directory containing the actual PDF manipulation code, with the following modules:
    • procbase.py: Provides ProcessingBase, an abstract base class for each processing unit
    • mainproc.py: Implements a ProcessingBase class to manage sub-units and communicate with the GUI/CLI
    • pagetiler.py: A renamed version of tile_pages.py (the original single script version of PDFStitcher!), providing the PageTiler processing unit class
    • pagefilter.py and layerfilter.py: Not significantly changed in functionality, but now implement ProcessingBase classes

The following refactoring changes have also been made:

  • Unit tests for pagetiler.py are provided in tests/test_pagetiler.py (layer filter tests TBD)
  • Previous test code has been moved to tests/integration
  • "Private" methods have been renamed with the _funcname convention, with most processing units only defining a run method to be called from the GUI/CLI
  • Various references to px renamed to pt to more accurately reflect the PDF base unit

Bug fixes and changes

  • Several bugs were solved just by updating the pikepdf version
  • Some UserUnit issues have been resolved
  • Page rotation was assumed to be the wrong way - this is now corrected
  • When adding margins, the origin (0,0) is now inside the margin, resulting in a MediaBox of size (-margin, -margin, width + margin, width + margin). This makes page tiling (particularly with trim values) simpler and less error-prone.
  • The latest set of translations from Weblate have been merged in

Build system changes

  • Version numbers on various GitHub actions have been updated
  • macOS Intel build bumped to macos-12 as 11 has lost support :(
  • For Windows, the exe is now built with Nuitka, resulting in a slightly smaller file size and hopefully fewer complaints from antivirus software.
  • Finally, the thing that many users have been asking for: Notarization on macOS! I tried (repeatedly and unsuccessfully) to make it work with Nuitka, and have reverted to PyInstaller for macOS.

@mara004 I know you've been away from this project for some time, but I wanted to specifically point out the CLI changes as you did a lot of work in adapting the page tiling stuff. It's not gone, it's just moved to cli/app.py. I'm guessing you've adapted it for your own uses by now, but I wanted to let you know as it's a breaking change.

josefinekr and others added 30 commits January 24, 2024 01:01
Currently translated at 12.5% (21 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/sv/
Currently translated at 72.0% (121 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/tr/
Currently translated at 82.7% (139 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/it/
Currently translated at 100.0% (168 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/it/
Currently translated at 65.4% (110 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/cs/
Currently translated at 100.0% (168 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/tr/
Currently translated at 100.0% (168 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/hi/
Currently translated at 100.0% (168 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/hi/
Currently translated at 97.0% (163 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/fr/
Currently translated at 44.0% (74 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/pl/
Currently translated at 99.4% (167 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/nl/
Currently translated at 51.7% (87 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/pl/
Currently translated at 100.0% (168 of 168 strings)

Translation: PDFStitcher/PDFStitcher
Translate-URL: https://hosted.weblate.org/projects/pdfstitcher/user-interface/hi/
Trim with mixed units still not behaving
@cfcurtis cfcurtis merged commit 50aac65 into main Jun 6, 2024
@mara004
Copy link
Contributor

mara004 commented Jun 16, 2024

@mara004 I know you've been away from this project for some time, but I wanted to specifically point out the CLI changes as you did a lot of work in adapting the page tiling stuff. It's not gone, it's just moved to cli/app.py. I'm guessing you've adapted it for your own uses by now, but I wanted to let you know as it's a breaking change.

@cfcurtis Thanks for the info, great to see how this project keeps going!
I've made an excursion to rendering/bindings (pdfium/ctypes(gen), pdfbox/jpype, pdfjs/jspybridge), but might get back to page tiling eventually. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants