Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion modules/ui/BaseTrainUIView.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def show_window(self, window): pass
def connect_window_closed(self, window, callback): pass

def sync_cloud_secrets(self):
self.ui_state.get_var("secrets.cloud").update(self.controller.train_config.secrets.cloud)
# Called from training thread — defer to main thread
self.schedule_on_main_thread(
lambda: self.ui_state.get_var("secrets.cloud").update(self.controller.train_config.secrets.cloud)
)

def start_training(self):
self.controller.start_training()
Expand Down
12 changes: 10 additions & 2 deletions modules/ui/PySide6VideoToolUIView.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from modules.util.ui.PySide6UIState import PySide6UIState

from PIL.ImageQt import ImageQt
from PySide6.QtCore import Qt
from PySide6.QtCore import Qt, QTimer
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import (
QDialog,
Expand Down Expand Up @@ -112,14 +112,22 @@ def _create_textbox(self, master, row, col, width, height, ui_state, var_name):
widget.textChanged.connect(lambda: var.set(widget.toPlainText()))
return widget

def schedule_on_main_thread(self, fn):
QTimer.singleShot(0, self, fn)

def update_status(self, status_text: str):
self._status_box.append(status_text)
# Called from the video tool's worker thread — defer to main thread
self.schedule_on_main_thread(lambda: self._status_box.append(status_text))

def clear_status(self):
self._status_box.clear()

def update_preview(self, preview_image, label_text: str):
# Called from the video tool's worker thread — defer to main thread
pixmap = QPixmap.fromImage(ImageQt(preview_image.convert("RGBA")))
self.schedule_on_main_thread(lambda: self._do_update_preview(pixmap, label_text))

def _do_update_preview(self, pixmap: QPixmap, label_text: str):
self._preview_label.setPixmap(
pixmap.scaled(150, 150, Qt.KeepAspectRatio, Qt.SmoothTransformation)
)
Expand Down