use new snake_case naming for pymupdf 1.23.0 and later

closes: #6
main
parent d0e5c1e48d
commit fab6925674
Signed by: josch
GPG Key ID: F2CBA5C78FBD83E1

@ -712,7 +712,11 @@ class Plakativ:
shape = page.new_shape()
else:
shape = page.newShape()
shape.drawRect(
if hasattr(shape, "draw_rect"):
dr = shape.draw_rect
else:
dr = shape.drawRect
dr(
fitz.Rect(
x0,
y0,
@ -722,7 +726,7 @@ class Plakativ:
)
shape.finish(color=(0, 0, 1))
# outer rectangle
shape.drawRect(
dr(
fitz.Rect(
x0 - left,
y0 - top,
@ -816,9 +820,13 @@ class Plakativ:
shape = page.new_shape()
else:
shape = page.newShape()
if hasattr(shape, "draw_rect"):
dr = shape.draw_rect
else:
dr = shape.drawRect
if guides:
if portrait:
shape.drawRect(
dr(
fitz.Rect(
mm_to_pt(self.layout["border_left"]),
mm_to_pt(self.layout["border_top"]),
@ -827,7 +835,7 @@ class Plakativ:
)
)
else:
shape.drawRect(
dr(
fitz.Rect(
mm_to_pt(self.layout["border_bottom"]),
mm_to_pt(self.layout["border_left"]),
@ -863,7 +871,7 @@ class Plakativ:
)
if border:
if portrait:
shape.drawRect(
dr(
fitz.Rect(
mm_to_pt(self.layout["border_left"] - x),
mm_to_pt(self.layout["border_top"] - y),
@ -880,7 +888,7 @@ class Plakativ:
)
)
else:
shape.drawRect(
dr(
fitz.Rect(
mm_to_pt(self.layout["border_bottom"] - x),
mm_to_pt(self.layout["border_left"] - y),

Loading…
Cancel
Save