Fix Python 3.14 compatibility, various updates#16
Open
ilyagr wants to merge 9 commits intopwang7:masterfrom
Open
Fix Python 3.14 compatibility, various updates#16ilyagr wants to merge 9 commits intopwang7:masterfrom
ilyagr wants to merge 9 commits intopwang7:masterfrom
Conversation
check_page_nums() uses re.split() but re was never imported, causing NameError at runtime when page numbers are entered.
87bd2e1 to
df00c8d
Compare
A missing `+` between two string literals on adjacent lines caused Python implicit string concatenation: `' ' 'in,'` became `' in,'`, putting the space before the unit instead of between the page range and the margin values. Result was e.g. `-cbox0.00 in,1.00 in,...` instead of the correct `-cbox 0.00in,1.00in,...`.
Replace asyncio.get_event_loop() with asyncio.new_event_loop(). get_event_loop() was deprecated in 3.10 (warning) and raises RuntimeError in Python 3.14+.
- Fix shebang from `#!/usr/bin/python` (often Python 2) to `#!/usr/bin/env python3`. - Remove unused `import glob`.
Instead of requiring k2pdfopt to be in the same directory as rebook.py, search for it in this order: 1. K2PDFOPT_PATH environment variable 2. Next to rebook.py (the script's own directory) 3. ./k2pdfopt (current working directory) 4. Anywhere in PATH (via shutil.which) The error message now shows the script directory path and explains all options.
Remove state='readonly' from all Spinbox widgets (width, height, DPI, columns, resolution multiplier, margins, font size, OCR CPU %, line break space). Previously, values could only be adjusted via arrow buttons/keys. Now users can click the field and type a number directly. Added <Return> and <FocusOut> bindings to each Spinbox so the corresponding callback fires when the user finishes typing, not just on arrow clicks.
- Show ./rebook_preset.json path on the Save button so users know where the preset file goes. - Clarify that DPI only applies in non-native (rasterized) mode.
Switch from create_subprocess_shell to create_subprocess_exec with a proper argument list. Previously, filenames with shell metacharacters could be executed as commands. The old space-quoting workaround is no longer needed since arguments are passed as a list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
These are a bunch of various updates; most of the commits can be used independently from each other. Most importantly, the first two commits prevent a crash and make
rebookcompatible with recent versions of Python.I am mostly sharing them in case these are useful to anyone, these are mostly AI-generated. If you consider merging these and need help from me in polishing these (e.g. rewriting the descriptions in a more human fashion), picking out some of these (or splitting them into separate PRs), I'd be happy to help.