Skip to content

Commit

Permalink
rename overview to first_page
Browse files Browse the repository at this point in the history
  • Loading branch information
bytinbit committed Jan 28, 2021
1 parent a588236 commit 4d916c9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions nobubo/assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def _assemble(input_properties: core.InputProperties,
tuples = ["-".join(map(str, i)) for i in l]
page_range = ",".join(tuples)
else:
begin = current_layout.overview
end = current_layout.overview + (current_layout.columns * current_layout.rows) - 1
begin = current_layout.first_page
end = current_layout.first_page + (current_layout.columns * current_layout.rows) - 1
page_range = f"{begin}-{end}"

file_content = [
Expand Down
4 changes: 2 additions & 2 deletions nobubo/calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def parse_cli_input(input_layout: (int, int, int), output_layout_cli: str, print


def parse_input_layouts(input_layout: (int, int, int)) ->[core.Layout]:
return [core.Layout(overview=data[0], columns=data[1], rows=data[2]) for data in input_layout]
return [core.Layout(first_page=data[0], columns=data[1], rows=data[2]) for data in input_layout]


def parse_output_layout(output_layout_cli: str, print_margin: int = None) -> [int]:
Expand Down Expand Up @@ -131,7 +131,7 @@ def to_mm(output_layout: str) -> [int, int]:


def pagerange_reverse(layout: core.Layout) -> (int, int, int):
return layout.overview, (layout.overview + (layout.columns * layout.rows)), layout.columns
return layout.first_page, (layout.first_page + (layout.columns * layout.rows)), layout.columns


def new_outputpath(output_path: pathlib.Path, page_count: int):
Expand Down
5 changes: 4 additions & 1 deletion nobubo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ class PageSize:
class Layout:
"""
A Pattern layout.
first_page: The number of the pdf page which marks the beginning of the pattern pages
that are covered by the columns and rows.
"""
overview: int
first_page: int
columns: int
rows: int

Expand Down
10 changes: 5 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,23 +66,23 @@ def pdfproperty() -> core.InputProperties:
output_path=pathlib.Path("output_test.pdf"),
number_of_pages=57,
pagesize=core.PageSize(width=483.307, height=729.917),
layout=[core.Layout(overview=1, columns=8, rows=7)])
layout=[core.Layout(first_page=2, columns=8, rows=7)])
# 8 cols, 7 rows + 1 overview page = 57

@pytest.fixture
def one_overview_even() -> core.Layout:
return core.Layout(overview=1, columns=8, rows=7)
return core.Layout(first_page=2, columns=8, rows=7)


@pytest.fixture
def one_overview_uneven() -> core.Layout:
return core.Layout(overview=1, columns=9, rows=4)
return core.Layout(first_page=2, columns=9, rows=4)


@pytest.fixture()
def two_overviews() -> [core.Layout, core.Layout]:
first = core.Layout(overview=1, columns=5, rows=5)
second = core.Layout(overview=27, columns=5, rows=5)
first = core.Layout(first_page=2, columns=5, rows=5)
second = core.Layout(first_page=28, columns=5, rows=5)
return [first, second]


Expand Down

0 comments on commit 4d916c9

Please sign in to comment.