fix: redraws pixmap after changing image settings so restart is no longer required

This commit is contained in:
2026-04-04 02:51:45 +02:00
parent cb7e74a224
commit 3de2110a3e
3 changed files with 27 additions and 5 deletions
+3 -1
View File
@@ -15,6 +15,8 @@ class Image(QObject):
parent.installEventFilter(self)
state.image_changed.connect(self.update_image_overlay)
if state.image_path and os.path.exists(state.image_path):
self._load_and_display(state.image_path)
@@ -35,7 +37,7 @@ class Image(QObject):
return
scaled_image = image.scaledToWidth(
int(state.image_width), Qt.TransformationMode.SmoothTransformation
state.image_width, Qt.TransformationMode.SmoothTransformation
)
max_width = parent.width()
+2 -2
View File
@@ -134,7 +134,7 @@ def settings_dialog(self):
image_path_layout = QHBoxLayout()
image_path = QLineEdit()
image_path_layout.addWidget(QLabel("Image Path (requires restart, experimental):"))
image_path_layout.addWidget(QLabel("Image Path:"))
image_path_layout.addWidget(image_path)
image_path_container.setSizePolicy(QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Fixed)
image_path_container.setLayout(image_path_layout)
@@ -167,7 +167,7 @@ def settings_dialog(self):
enable_image_checkbox = QCheckBox()
enable_image_container.setLayout(enable_image_layout)
enable_image_layout.addWidget(QLabel("Enable Image: "))
enable_image_layout.addWidget(QLabel("Enable Image (needs image_path): "))
enable_image_layout.addStretch()
enable_image_checkbox.setChecked(state.image_enabled)
+22 -2
View File
@@ -29,8 +29,8 @@ 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_width: int = 300 # Default to 300px
self._image_offset: int = 50
self.image_enabled: bool = False
# Trackers / Scraping
@@ -61,4 +61,24 @@ class AppState(QObject):
self._image_path = new_path
self.image_changed.emit(new_path)
@property
def image_offset(self) -> int:
return self._image_offset
@image_offset.setter
def image_offset(self, new_offset: int):
if new_offset != self._image_offset:
self._image_offset = new_offset
self.image_changed.emit(self._image_path)
@property
def image_width(self) -> int:
return self._image_width
@image_width.setter
def image_width(self, new_offset: int):
if new_offset != self._image_width:
self._image_width = new_offset
self.image_changed.emit(self._image_path)
state = AppState()