home
·
contact
·
privacy
projects
/
misc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
41a33e1
)
Bookmaker: use actual Python exception for zoom error.
author
Christian Heller
<c.heller@plomlompom.de>
Sun, 24 Sep 2023 02:25:22 +0000
(
04:25
+0200)
committer
Christian Heller
<c.heller@plomlompom.de>
Sun, 24 Sep 2023 02:25:22 +0000
(
04:25
+0200)
bookmaker.py
patch
|
blob
|
history
diff --git
a/bookmaker.py
b/bookmaker.py
index f233d384e921d970fe40d7daa65eea670561ce2a..a82f9861862ae827226fe0ca816dd36f86fbd5e7 100755
(executable)
--- a/
bookmaker.py
+++ b/
bookmaker.py
@@
-81,7
+81,6
@@
parser.add_argument("-m", "--print_margin", type=float, default=0.43, help="prin
parser.add_argument("-H", "--long_help", action="store_true", help="show examples, explanations, additional usage notes")
args = parser.parse_args()
parser.add_argument("-H", "--long_help", action="store_true", help="show examples, explanations, additional usage notes")
args = parser.parse_args()
-
# select pages from input files
def parse_page_range(range_string, pages):
start_page = 0
# select pages from input files
def parse_page_range(range_string, pages):
start_page = 0
@@
-166,8
+165,7
@@
if args.crops:
zoom_horizontal = a4_width / (a4_width - crop_left - crop_right)
zoom_vertical = a4_height / (a4_height - crop_bottom - crop_top)
if (zoom_horizontal > 1 and zoom_vertical < 1) or (zoom_horizontal < 1 and zoom_vertical > 1):
zoom_horizontal = a4_width / (a4_width - crop_left - crop_right)
zoom_vertical = a4_height / (a4_height - crop_bottom - crop_top)
if (zoom_horizontal > 1 and zoom_vertical < 1) or (zoom_horizontal < 1 and zoom_vertical > 1):
- print("Error: opposing zooms.")
- exit(1)
+ raise ValueError("crops would create opposing zoom directions")
elif zoom_horizontal + zoom_vertical > 2:
zoom = min(zoom_horizontal, zoom_vertical)
else:
elif zoom_horizontal + zoom_vertical > 2:
zoom = min(zoom_horizontal, zoom_vertical)
else: