Update trim dimensions and cover export functionality in Blurb Photo Book Editor
This commit is contained in:
+56
-44
@@ -74,10 +74,10 @@ class PhotoPage:
|
||||
class PrintProfile:
|
||||
"""Trim dimensions plus exact final PDF dimensions supplied by Blurb."""
|
||||
|
||||
trim_width_in: float = 9.5
|
||||
trim_height_in: float = 8.0
|
||||
pdf_width_in: float | None = None
|
||||
pdf_height_in: float | None = None
|
||||
trim_width_in: float = 9.625
|
||||
trim_height_in: float = 8.25
|
||||
pdf_width_in: float | None = 9.625
|
||||
pdf_height_in: float | None = 8.25
|
||||
trim_binding_in: float = 0.0
|
||||
trim_outside_in: float = 0.0
|
||||
trim_top_in: float = 0.0
|
||||
@@ -135,10 +135,18 @@ class PrintProfile:
|
||||
if not data:
|
||||
return cls()
|
||||
return cls(
|
||||
trim_width_in=_to_float(data.get("trim_width_in"), 9.5),
|
||||
trim_height_in=_to_float(data.get("trim_height_in"), 8.0),
|
||||
pdf_width_in=_optional_float(data.get("pdf_width_in")),
|
||||
pdf_height_in=_optional_float(data.get("pdf_height_in")),
|
||||
trim_width_in=_to_float(data.get("trim_width_in"), 9.625),
|
||||
trim_height_in=_to_float(data.get("trim_height_in"), 8.25),
|
||||
pdf_width_in=(
|
||||
_optional_float(data.get("pdf_width_in"))
|
||||
if "pdf_width_in" in data
|
||||
else 9.625
|
||||
),
|
||||
pdf_height_in=(
|
||||
_optional_float(data.get("pdf_height_in"))
|
||||
if "pdf_height_in" in data
|
||||
else 8.25
|
||||
),
|
||||
trim_binding_in=_to_float(
|
||||
data.get("trim_binding_in", data.get("trim_left_in")), 0.0
|
||||
),
|
||||
@@ -147,8 +155,8 @@ class PrintProfile:
|
||||
"trim_outside_in",
|
||||
max(
|
||||
0.0,
|
||||
_to_float(data.get("pdf_width_in"), 9.5)
|
||||
- _to_float(data.get("trim_width_in"), 9.5)
|
||||
_to_float(data.get("pdf_width_in"), 9.625)
|
||||
- _to_float(data.get("trim_width_in"), 9.625)
|
||||
- _to_float(data.get("trim_left_in"), 0.0),
|
||||
),
|
||||
),
|
||||
@@ -171,28 +179,28 @@ class CoverLayout:
|
||||
subtitle: str = ""
|
||||
front_title: str = ""
|
||||
front_subtitle: str = ""
|
||||
front_font_family: str = "Arial"
|
||||
front_title_font_size_pt: float = 36.0
|
||||
front_subtitle_font_size_pt: float = 20.0
|
||||
front_title_x: float = 0.5
|
||||
front_title_y: float = 0.17
|
||||
front_subtitle_x: float = 0.5
|
||||
front_subtitle_y: float = 0.28
|
||||
title_font_family: str = "Arial"
|
||||
title_font_size_pt: float = 10.0
|
||||
front_font_family: str = "MV Boli"
|
||||
front_title_font_size_pt: float = 48.0
|
||||
front_subtitle_font_size_pt: float = 24.0
|
||||
front_title_x: float = 0.6511959815448585
|
||||
front_title_y: float = 0.22590834010644723
|
||||
front_subtitle_x: float = 0.7505046203361379
|
||||
front_subtitle_y: float = 0.3083317165255237
|
||||
title_font_family: str = "MV Boli"
|
||||
title_font_size_pt: float = 20.0
|
||||
title_color: str = "#fff03f"
|
||||
subtitle_font_family: str = "Arial"
|
||||
subtitle_font_size_pt: float = 8.0
|
||||
subtitle_font_family: str = "MV Boli"
|
||||
subtitle_font_size_pt: float = 14.0
|
||||
subtitle_color: str = "#fff03f"
|
||||
spine_title_y_in: float | None = None
|
||||
spine_subtitle_y_in: float | None = None
|
||||
spine_subtitle_y_in: float | None = 1.1093844419391201
|
||||
face_width_in: float = 10.074
|
||||
face_height_in: float = 9.0
|
||||
spine_width_in: float = 0.46
|
||||
margin_left_in: float | None = 0.125
|
||||
margin_right_in: float | None = 0.125
|
||||
margin_top_in: float | None = 0.125
|
||||
margin_bottom_in: float | None = 0.125
|
||||
spine_width_in: float = 0.57
|
||||
margin_left_in: float | None = 0.0
|
||||
margin_right_in: float | None = 0.0
|
||||
margin_top_in: float | None = 0.0
|
||||
margin_bottom_in: float | None = 0.0
|
||||
|
||||
@property
|
||||
def has_content(self) -> bool:
|
||||
@@ -368,28 +376,32 @@ class CoverLayout:
|
||||
subtitle=str(data.get("subtitle", "")),
|
||||
front_title=str(data.get("front_title", "")),
|
||||
front_subtitle=str(data.get("front_subtitle", "")),
|
||||
front_font_family=str(data.get("front_font_family") or "Arial"),
|
||||
front_title_font_size_pt=_to_float(data.get("front_title_font_size_pt"), 36.0),
|
||||
front_subtitle_font_size_pt=_to_float(data.get("front_subtitle_font_size_pt"), 20.0),
|
||||
front_title_x=_to_float(data.get("front_title_x"), 0.5),
|
||||
front_title_y=_to_float(data.get("front_title_y"), 0.17),
|
||||
front_subtitle_x=_to_float(data.get("front_subtitle_x"), 0.5),
|
||||
front_subtitle_y=_to_float(data.get("front_subtitle_y"), 0.28),
|
||||
title_font_family=str(data.get("title_font_family") or "Arial"),
|
||||
title_font_size_pt=_to_float(data.get("title_font_size_pt"), 10.0),
|
||||
front_font_family=str(data.get("front_font_family") or "MV Boli"),
|
||||
front_title_font_size_pt=_to_float(data.get("front_title_font_size_pt"), 48.0),
|
||||
front_subtitle_font_size_pt=_to_float(data.get("front_subtitle_font_size_pt"), 24.0),
|
||||
front_title_x=_to_float(data.get("front_title_x"), 0.6511959815448585),
|
||||
front_title_y=_to_float(data.get("front_title_y"), 0.22590834010644723),
|
||||
front_subtitle_x=_to_float(data.get("front_subtitle_x"), 0.7505046203361379),
|
||||
front_subtitle_y=_to_float(data.get("front_subtitle_y"), 0.3083317165255237),
|
||||
title_font_family=str(data.get("title_font_family") or "MV Boli"),
|
||||
title_font_size_pt=_to_float(data.get("title_font_size_pt"), 20.0),
|
||||
title_color=str(data.get("title_color") or "#fff03f"),
|
||||
subtitle_font_family=str(data.get("subtitle_font_family") or "Arial"),
|
||||
subtitle_font_size_pt=_to_float(data.get("subtitle_font_size_pt"), 8.0),
|
||||
subtitle_font_family=str(data.get("subtitle_font_family") or "MV Boli"),
|
||||
subtitle_font_size_pt=_to_float(data.get("subtitle_font_size_pt"), 14.0),
|
||||
subtitle_color=str(data.get("subtitle_color") or "#fff03f"),
|
||||
spine_title_y_in=_optional_float(data.get("spine_title_y_in")),
|
||||
spine_subtitle_y_in=_optional_float(data.get("spine_subtitle_y_in")),
|
||||
spine_subtitle_y_in=(
|
||||
_optional_float(data.get("spine_subtitle_y_in"))
|
||||
if "spine_subtitle_y_in" in data
|
||||
else 1.1093844419391201
|
||||
),
|
||||
face_width_in=_to_float(data.get("face_width_in"), 10.074),
|
||||
face_height_in=_to_float(data.get("face_height_in"), 9.0),
|
||||
spine_width_in=_to_float(data.get("spine_width_in"), 0.46),
|
||||
margin_left_in=_to_float(data.get("margin_left_in"), 0.125),
|
||||
margin_right_in=_to_float(data.get("margin_right_in"), 0.125),
|
||||
margin_top_in=_to_float(data.get("margin_top_in"), 0.125),
|
||||
margin_bottom_in=_to_float(data.get("margin_bottom_in"), 0.125),
|
||||
spine_width_in=_to_float(data.get("spine_width_in"), 0.57),
|
||||
margin_left_in=_to_float(data.get("margin_left_in"), 0.0),
|
||||
margin_right_in=_to_float(data.get("margin_right_in"), 0.0),
|
||||
margin_top_in=_to_float(data.get("margin_top_in"), 0.0),
|
||||
margin_bottom_in=_to_float(data.get("margin_bottom_in"), 0.0),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user