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
+7 -6
View File
@@ -1,12 +1,11 @@
from PySide6.QtCore import Qt, QSize, QEvent, QObject
from PySide6.QtGui import QImage, QPixmap
from PySide6.QtWidgets import QLabel
from utils.data.state import state
from PySide6.QtCore import Qt, QSize, QEvent, QObject
import os
class Image(QObject):
TARGET_WIDTH = 300
class Image(QObject):
def __init__(self, parent):
super().__init__(parent)
self.application = parent
@@ -26,6 +25,8 @@ class Image(QObject):
return False
def _load_and_display(self, image_path):
if state.image_enabled is not True:
return
self._current_image_path = image_path
parent = self.application
image = QImage(image_path)
@@ -34,7 +35,7 @@ class Image(QObject):
return
scaled_image = image.scaledToWidth(
self.TARGET_WIDTH, Qt.TransformationMode.SmoothTransformation
int(state.image_width), Qt.TransformationMode.SmoothTransformation
)
max_width = parent.width()
@@ -51,8 +52,8 @@ class Image(QObject):
self.overlay_label.adjustSize()
self.overlay_label.raise_()
x = parent.width() - self.overlay_label.width() - 100
y = parent.height() - self.overlay_label.height() - 100
x = parent.width() - self.overlay_label.width() - int(state.image_offset)
y = parent.height() - self.overlay_label.height() - int(state.image_offset)
self.overlay_label.move(x, y)
self.overlay_label.show()