feat: Add image position presets and sliders

Introduce image positioning presets and UI improvements for image overlay control. image.py: compute overlay coordinates for top-left/top-right/bottom-left/bottom-right/center positions and respect corner offset and opacity. settings.py: replace spinboxes with horizontal sliders (with value labels and custom style), add Wallpaper Mode checkbox and Position combo, wire controls to state and include them in the settings tab; ensure dialog rollback restores new temp settings. config/config.py & utils/settings.py: persist and load new image_as_wallpaper and image_position settings and extend save_settings to accept them. data/state.py: add new state fields and properties for image_position, custom position flags and x/y coordinates; change default image_as_wallpaper to false. These changes enable preset positioning, improved UX for sizing/offset/opacity, and persistence of new image options.
This commit is contained in:
Vxrtrauter
2026-04-05 06:12:54 +02:00
parent 2ad02435a1
commit 9e3d1cf90a
5 changed files with 139 additions and 18 deletions
+5 -1
View File
@@ -35,7 +35,9 @@ def create_config():
"enable_image": str(state.image_enabled),
"image_width": str(state.image_width),
"image_offset": str(state.image_offset),
"image_opacity": str(state.image_opacity)
"image_opacity": str(state.image_opacity),
"image_as_wallpaper": str(state.image_as_wallpaper),
"image_position": str(state.image_position)
}
if platform.system() == "Windows":
@@ -102,6 +104,8 @@ def read_config():
state.image_width = config.getint("Image", "image_width", fallback=state.image_width)
state.image_offset = config.getint("Image", "image_offset", fallback=state.image_offset)
state.image_opacity = config.getint("Image", "image_opacity", fallback=state.image_opacity)
state.image_as_wallpaper = config.getboolean("Image", "image_as_wallpaper", fallback=state.image_as_wallpaper)
state.image_position = config.get("Image", "image_position", fallback=state.image_position)
create_config()
+5 -1
View File
@@ -5,7 +5,7 @@ from utils.data.state import state
def save_settings(close=lambda: None, apiurl=None, download_path=None, down_speed_limit=None, up_speed_limit=None, image_path=None, autoresume=None, max_connections=None, max_downloads=None, bound_interface=None, image_width=None, image_offset=None, image_opacity=None):
def save_settings(close=lambda: None, apiurl=None, download_path=None, down_speed_limit=None, up_speed_limit=None, image_path=None, autoresume=None, max_connections=None, max_downloads=None, bound_interface=None, image_width=None, image_offset=None, image_opacity=None, image_as_wallpaper=None, image_position=None):
if apiurl is not None:
state.api_url = apiurl
if download_path is not None:
@@ -30,6 +30,10 @@ def save_settings(close=lambda: None, apiurl=None, download_path=None, down_spee
state.image_offset = image_offset
if image_opacity is not None:
state.image_opacity = image_opacity
if image_as_wallpaper is not None:
state.image_as_wallpaper = image_as_wallpaper
if image_position is not None:
state.image_position = image_position
update_settings() # Update LibTorrent Session Settings
consoleLog("Saved Settings")
+42 -1
View File
@@ -35,7 +35,8 @@ class AppState(QObject):
self._image_width: int = 300 # Default to 300px
self._image_offset: int = 50
self._image_opacity: int = 100
self._image_as_wallpaper: bool = True
self._image_as_wallpaper: bool = False
self._image_position: str = "bottom-right" # top-left, top-right, bottom-left, bottom-right, center
# Trackers / Scraping
self.posts: list[Dict[str,str]] | None = None # titles, urls, author, seeders, leechers
@@ -115,4 +116,44 @@ class AppState(QObject):
self._image_as_wallpaper = new_state
self.image_changed.emit(self._image_path)
@property
def image_position(self) -> str:
return self._image_position
@image_position.setter
def image_position(self, new_pos: str):
if new_pos != self._image_position:
self._image_position = new_pos
self.image_changed.emit(self._image_path)
@property
def image_custom_position(self) -> bool:
return self._image_custom_position
@image_custom_position.setter
def image_custom_position(self, new_state: bool):
if new_state != self._image_custom_position:
self._image_custom_position = new_state
self.image_changed.emit(self._image_path)
@property
def image_x(self) -> int:
return self._image_x
@image_x.setter
def image_x(self, val: int):
if val != self._image_x:
self._image_x = val
self.image_changed.emit(self._image_path)
@property
def image_y(self) -> int:
return self._image_y
@image_y.setter
def image_y(self, val: int):
if val != self._image_y:
self._image_y = val
self.image_changed.emit(self._image_path)
state = AppState()