Skip to content

Commit

Permalink
FIXUP: Remove filenames parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
deeplow committed Jan 10, 2024
1 parent 73497b9 commit 969178f
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions dangerzone/conversion/doc_to_pixels.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ class DocumentToPixels(DangerzoneConverter):
async def write_page_count(self, count: int) -> None:
return await self.write_int(count)

async def write_page_width(self, width: int, filename: str) -> None:
async def write_page_width(self, width: int) -> None:
return await self.write_int(width)

async def write_page_height(self, height: int, filename: str) -> None:
async def write_page_height(self, height: int) -> None:
return await self.write_int(height)

async def write_page_data(self, data: bytes, filename: str) -> None:
async def write_page_data(self, data: bytes) -> None:
return await self.write_bytes(data)

async def convert(self) -> None:
Expand Down Expand Up @@ -220,19 +220,16 @@ async def convert(self) -> None:
for page in doc.pages():
# TODO check if page.number is doc-controlled
page_num = page.number + 1 # pages start in 1
rgb_filename = f"{page_base}-{page_num}.rgb"
width_filename = f"{page_base}-{page_num}.width"
height_filename = f"{page_base}-{page_num}.height"

self.percentage += percentage_per_page
self.update_progress(
f"Converting page {page_num}/{doc.page_count} to pixels"
)
pix = page.get_pixmap(dpi=DEFAULT_DPI)
rgb_buf = pix.samples_mv
await self.write_page_width(pix.width, width_filename)
await self.write_page_height(pix.height, height_filename)
await self.write_page_data(rgb_buf, rgb_filename)
await self.write_page_width(pix.width)
await self.write_page_height(pix.height)
await self.write_page_data(rgb_buf)

self.update_progress("Converted document to pixels")

Expand Down

0 comments on commit 969178f

Please sign in to comment.