Added ACC flipping of page
This commit is contained in:
@@ -44,6 +44,7 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
line_spacing: Current line spacing in pixels
|
||||
inter_block_spacing: Current inter-block spacing in pixels
|
||||
word_spacing: Current word spacing in pixels
|
||||
font_family: Current font family name (e.g., "SERIF", "SANS", "MONOSPACE", or None)
|
||||
|
||||
Returns:
|
||||
Composited image with settings overlay
|
||||
@@ -52,6 +53,7 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
line_spacing = kwargs.get('line_spacing', 5)
|
||||
inter_block_spacing = kwargs.get('inter_block_spacing', 15)
|
||||
word_spacing = kwargs.get('word_spacing', 0)
|
||||
font_family = kwargs.get('font_family', 'Default')
|
||||
|
||||
# Calculate panel size (60% width, 70% height)
|
||||
panel_size = self._calculate_panel_size(0.6, 0.7)
|
||||
@@ -62,6 +64,7 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
line_spacing=line_spacing,
|
||||
inter_block_spacing=inter_block_spacing,
|
||||
word_spacing=word_spacing,
|
||||
font_family=font_family,
|
||||
page_size=panel_size
|
||||
)
|
||||
|
||||
@@ -132,7 +135,8 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
font_scale: float,
|
||||
line_spacing: int,
|
||||
inter_block_spacing: int,
|
||||
word_spacing: int = 0) -> Image.Image:
|
||||
word_spacing: int = 0,
|
||||
font_family: str = "Default") -> Image.Image:
|
||||
"""
|
||||
Refresh the settings overlay with updated values and background page.
|
||||
|
||||
@@ -146,6 +150,7 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
line_spacing: Updated line spacing
|
||||
inter_block_spacing: Updated inter-block spacing
|
||||
word_spacing: Updated word spacing
|
||||
font_family: Updated font family
|
||||
|
||||
Returns:
|
||||
Composited image with updated settings overlay
|
||||
@@ -159,6 +164,7 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
line_spacing=line_spacing,
|
||||
inter_block_spacing=inter_block_spacing,
|
||||
word_spacing=word_spacing,
|
||||
font_family=font_family,
|
||||
page_size=panel_size
|
||||
)
|
||||
|
||||
@@ -177,16 +183,26 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
Apply a setting change and refresh the overlay.
|
||||
|
||||
Args:
|
||||
action: Setting action (e.g., "font_increase", "line_spacing_decrease")
|
||||
action: Setting action (e.g., "font_increase", "line_spacing_decrease", "font_family_serif")
|
||||
|
||||
Returns:
|
||||
GestureResponse with SETTING_CHANGED action
|
||||
"""
|
||||
from pyWebLayout.style.fonts import BundledFont
|
||||
|
||||
# Apply the setting change via reader
|
||||
if action == "font_increase":
|
||||
self.reader.increase_font_size()
|
||||
elif action == "font_decrease":
|
||||
self.reader.decrease_font_size()
|
||||
elif action == "font_family_default":
|
||||
self.reader.set_font_family(None)
|
||||
elif action == "font_family_serif":
|
||||
self.reader.set_font_family(BundledFont.SERIF)
|
||||
elif action == "font_family_sans":
|
||||
self.reader.set_font_family(BundledFont.SANS)
|
||||
elif action == "font_family_monospace":
|
||||
self.reader.set_font_family(BundledFont.MONOSPACE)
|
||||
elif action == "line_spacing_increase":
|
||||
new_spacing = self.reader.page_style.line_spacing + 2
|
||||
self.reader.set_line_spacing(new_spacing)
|
||||
@@ -211,18 +227,24 @@ class SettingsOverlay(OverlaySubApplication):
|
||||
page = self.reader.manager.get_current_page()
|
||||
updated_page = page.render()
|
||||
|
||||
# Get font family for display
|
||||
font_family = self.reader.get_font_family()
|
||||
font_family_name = font_family.name if font_family else "Default"
|
||||
|
||||
# Refresh the settings overlay with updated values and page
|
||||
self.refresh(
|
||||
updated_base_page=updated_page,
|
||||
font_scale=self.reader.base_font_scale,
|
||||
line_spacing=self.reader.page_style.line_spacing,
|
||||
inter_block_spacing=self.reader.page_style.inter_block_spacing,
|
||||
word_spacing=self.reader.page_style.word_spacing
|
||||
word_spacing=self.reader.page_style.word_spacing,
|
||||
font_family=font_family_name
|
||||
)
|
||||
|
||||
return GestureResponse(ActionType.SETTING_CHANGED, {
|
||||
"action": action,
|
||||
"font_scale": self.reader.base_font_scale,
|
||||
"font_family": font_family_name,
|
||||
"line_spacing": self.reader.page_style.line_spacing,
|
||||
"inter_block_spacing": self.reader.page_style.inter_block_spacing,
|
||||
"word_spacing": self.reader.page_style.word_spacing
|
||||
|
||||
Reference in New Issue
Block a user