From 0312f6cc0e83f9b6a077bd1f5a70fe919ce38293 Mon Sep 17 00:00:00 2001 From: bytinbit Date: Thu, 28 Jan 2021 16:55:56 +0100 Subject: [PATCH] fix page range calculation for reverse assembly --- nobubo/assembly.py | 2 +- nobubo/calc.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nobubo/assembly.py b/nobubo/assembly.py index b363aa3..856c350 100644 --- a/nobubo/assembly.py +++ b/nobubo/assembly.py @@ -51,7 +51,7 @@ def _assemble(input_properties: core.InputProperties, if input_properties.reverse_assembly: start, end, step = calc.pagerange_reverse(current_layout) - l = list(reversed([(x+1, x+current_layout.columns) for x in range(start, end, step)])) + l = list(reversed([(x, x+current_layout.columns-1) for x in range(start, end, step)])) tuples = ["-".join(map(str, i)) for i in l] page_range = ",".join(tuples) else: diff --git a/nobubo/calc.py b/nobubo/calc.py index a0bbf8b..d826fb9 100644 --- a/nobubo/calc.py +++ b/nobubo/calc.py @@ -131,7 +131,7 @@ def to_mm(output_layout: str) -> [int, int]: def pagerange_reverse(layout: core.Layout) -> (int, int, int): - return layout.first_page, (layout.first_page + (layout.columns * layout.rows)), layout.columns + return layout.first_page, layout.first_page + (layout.columns * layout.rows) - 1, layout.columns def new_outputpath(output_path: pathlib.Path, page_count: int):