Add configurable image overlay settings

Introduce configurable image overlay options and persist them. Added new state fields (image_width, image_offset, image_enabled) with defaults and wired them into the image overlay: the image display now respects the enabled flag, uses image_width for scaling and image_offset for placement. Extended the Settings dialog (resized, API field sizing) with a new Image tab containing enable checkbox, width and offset spinboxes, and included these values when saving. Updated config read/write to include an Image section so settings persist across runs and extended save_settings to accept image_width and image_offset. Minor import/order cleanup in image dialog.
This commit is contained in:
Vxrtrauter
2026-04-04 02:06:06 +02:00
parent b59768bcff
commit cb7e74a224
5 changed files with 77 additions and 10 deletions
+12
View File
@@ -28,6 +28,12 @@ def create_config():
"image_path": f"{state.image_path}"
}
config["Image"] = {
"enable_image": f"{state.image_enabled}",
"image_width": f"{state.image_width}",
"image_offset": f"{state.image_offset}"
}
if platform.system() == "Windows":
config_dir = os.environ.get("APPDATA", os.path.expanduser("~\\AppData\\Roaming"))
else:
@@ -77,4 +83,10 @@ def read_config():
state.download_path = config.get("Paths", "download_path", fallback=state.download_path)
state.image_path = config.get("Paths", "image_path", fallback=state.image_path)
# Image
state.image_enabled = config.getboolean("Image", "enable_image", fallback=state.image_enabled)
state.image_width = config.getint("Image", "image_width", fallback=state.image_width)
state.image_offset = config.getint("Image", "image_offset", fallback=state.image_offset)
create_config()
+6 -2
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):
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):
if apiurl is not None:
state.api_url = apiurl
if download_path is not None:
@@ -24,8 +24,12 @@ def save_settings(close=lambda: None, apiurl=None, download_path=None, down_spee
state.max_downloads = max_downloads
if bound_interface is not None:
state.bound_interface = None if bound_interface == "None" else bound_interface
if image_width is not None:
state.image_width = image_width
if image_offset is not None:
state.image_offset = image_offset
update_settings()
update_settings() # Update LibTorrent Session Settings
consoleLog("Saved Settings")
create_config()
close()
+3
View File
@@ -29,6 +29,9 @@ class AppState(QObject):
self.interfaces: List = []
self.active_interfaces: List = []
self.bound_interface: Any = None
self.image_width: int = 300 # Default to 300px
self.image_offset: int = 50
self.image_enabled: bool = False
# Trackers / Scraping
self.posts: list[Dict[str,str]] | None = None # titles, urls, author, seeders, leechers