From: Christian Heller Date: Sun, 24 Sep 2023 18:40:23 +0000 (+0200) Subject: Bookmaker: more refactoring. X-Git-Url: https://plomlompom.com/repos/%22https:/validator.w3.org/blog?a=commitdiff_plain;h=71280964e196003c0198eb3c418f28ec32f5be78;p=misc Bookmaker: more refactoring. --- diff --git a/bookmaker.py b/bookmaker.py index 8df8814..1c7240a 100755 --- a/bookmaker.py +++ b/bookmaker.py @@ -87,6 +87,7 @@ CUT_WIDTH = 1.05 * POINTS_PER_CM MIDDLE_POINT_DEPTH = 0.4 * POINTS_PER_CM SPINE_LIMIT = 1 * POINTS_PER_CM QUARTER_SCALE_FACTOR = 0.5 +PAGE_ORDER = (3,0,7,4,1,2,5,6) # some helpers class HandledException(Exception): @@ -331,6 +332,7 @@ def main(): print(f"built page number {i+1} (of {len(pages_to_add)})") else: + # --nup4 output print("-n: building 4-input-pages-per-output-page book") print(f"-m: applying printable-area margin of {args.print_margin}cm") if args.analyze: @@ -351,23 +353,10 @@ def main(): i += 1 if i == 8: i = 0 - new_i_order += [8 * n_eights + 3, - 8 * n_eights + 0, - 8 * n_eights + 7, - 8 * n_eights + 4, - 8 * n_eights + 1, - 8 * n_eights + 2, - 8 * n_eights + 5, - 8 * n_eights + 6] + for n in PAGE_ORDER: + new_i_order += [8 * n_eights + n] + new_page_order += [eight_pack[n]] n_eights += 1 - new_page_order += [eight_pack[3]] # page front, upper left - new_page_order += [eight_pack[0]] # page front, upper right - new_page_order += [eight_pack[7]] # page front, lower left - new_page_order += [eight_pack[4]] # page front, lower right - new_page_order += [eight_pack[1]] # page back, upper left - new_page_order += [eight_pack[2]] # page back, upper right - new_page_order += [eight_pack[5]] # page back, lower left - new_page_order += [eight_pack[6]] # page back, lower right i = 0 page_count = 0 front_page = True