chore: format with black
This commit is contained in:
parent
585ba739d1
commit
8f4449ca64
@ -86,6 +86,7 @@ class FitzBookmark:
|
|||||||
title: SectionTitle
|
title: SectionTitle
|
||||||
page: PageNumber
|
page: PageNumber
|
||||||
|
|
||||||
|
|
||||||
class FitzDestinations(TypedDict):
|
class FitzDestinations(TypedDict):
|
||||||
page: PageNumber
|
page: PageNumber
|
||||||
to: tuple[int, int]
|
to: tuple[int, int]
|
||||||
|
10
pdf_data.py
10
pdf_data.py
@ -25,9 +25,15 @@ def get_destination_pdf() -> PDFDestination:
|
|||||||
page_ref: PDFPage = get_page_pdf()
|
page_ref: PDFPage = get_page_pdf()
|
||||||
with fitz.Document(page_ref.filepath) as doc:
|
with fitz.Document(page_ref.filepath) as doc:
|
||||||
destinations = cast(FitzDestinations, cast(Any, doc).resolve_names())
|
destinations = cast(FitzDestinations, cast(Any, doc).resolve_names())
|
||||||
page_dests = {k: x for k, x in destinations.items() if cast(Any, x)["page"]+1 == page_ref.page}
|
page_dests = {
|
||||||
|
k: x
|
||||||
|
for k, x in destinations.items()
|
||||||
|
if cast(Any, x)["page"] + 1 == page_ref.page
|
||||||
|
}
|
||||||
|
|
||||||
rofi_res = rofi([f"{k}" for k, _ in page_dests.items()], prompt="Select named destination: ")
|
rofi_res = rofi(
|
||||||
|
[f"{k}" for k, _ in page_dests.items()], prompt="Select named destination: "
|
||||||
|
)
|
||||||
if rofi_res is None or rofi_res.index is None:
|
if rofi_res is None or rofi_res.index is None:
|
||||||
raise RuntimeError("No destination was selected.")
|
raise RuntimeError("No destination was selected.")
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user