from core.infrastructure.plumbing import ThreadPlumbing from core.models.Result import ResultError from gui.v2.infrastructure.ThreadSafetyTool import ThreadSafetyTool from gui.v2.ui.popups.error_popup import ErrorPopup from typing import Callable AUTO_NAVIGATE_REGISTRY = { ResultError.WRONG_LOCATION: "settings" } def take_action(action: Callable, ui_caller: Callable, *args, **kwargs): """PyQt6 GUI implementation of plumbing""" controller = ThreadPlumbing( action=action, ui_dispatcher=ThreadSafetyTool(), # PyQt6 as mainthread error_implementation=ErrorPopup, # PyQt6 ErrorPopup auto_navigate_dict=AUTO_NAVIGATE_REGISTRY, ui_caller=ui_caller, *args, **kwargs ) controller.execute()