diff --git a/openpype/hosts/aftereffects/api/lib.py b/openpype/hosts/aftereffects/api/lib.py index 8e3b7d22bf..dac6b5d28f 100644 --- a/openpype/hosts/aftereffects/api/lib.py +++ b/openpype/hosts/aftereffects/api/lib.py @@ -35,7 +35,6 @@ def main(*subprocess_args): launcher.start() if os.environ.get("HEADLESS_PUBLISH"): - # reusing ConsoleTrayApp approach as it was already implemented launcher.execute_in_main_thread(lambda: headless_publish( log, "CloseAE", diff --git a/openpype/hosts/harmony/api/lib.py b/openpype/hosts/harmony/api/lib.py index 4ce9960316..05f2b55d88 100644 --- a/openpype/hosts/harmony/api/lib.py +++ b/openpype/hosts/harmony/api/lib.py @@ -18,7 +18,7 @@ from Qt import QtWidgets from .server import Server -from openpype.tools.tray_app.app import ConsoleTrayApp +from openpype.tools.stdout_broker.app import StdOutBroker from openpype.tools.utils import host_tools self = sys.modules[__name__] @@ -33,8 +33,9 @@ self.port = None self.log = logging.getLogger(__name__) self.log.setLevel(logging.DEBUG) + def execute_in_main_thread(func, *args, **kwargs): - ConsoleTrayApp.instance().execute_in_main_thread(func, *args, **kwargs) + StdOutBroker.instance().execute_in_main_thread(func, *args, **kwargs) def signature(postfix="func") -> str: @@ -66,14 +67,14 @@ def main(*subprocess_args): # Harmony always connected, not waiting return True - # coloring in ConsoleTrayApp + # coloring in StdOutBroker os.environ["OPENPYPE_LOG_NO_COLORS"] = "False" app = QtWidgets.QApplication([]) app.setQuitOnLastWindowClosed(False) - instance = ConsoleTrayApp('harmony', launch, - subprocess_args, is_host_connected) - ConsoleTrayApp._instance = instance + instance = StdOutBroker('harmony', launch, + subprocess_args, is_host_connected) + StdOutBroker._instance = instance sys.exit(app.exec_()) @@ -279,13 +280,13 @@ def launch_zip_file(filepath): return print("Launching {}".format(scene_path)) - ConsoleTrayApp.instance().websocket_server = self.server - ConsoleTrayApp.instance().process = subprocess.Popen( + StdOutBroker.instance().websocket_server = self.server + StdOutBroker.instance().process = subprocess.Popen( [self.application_path, scene_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL ) - self.pid = ConsoleTrayApp.instance().process.pid + self.pid = StdOutBroker.instance().process.pid def on_file_changed(path, threaded=True): @@ -350,7 +351,7 @@ def show(module_name): if tool_name == "loader": kwargs["use_context"] = True - ConsoleTrayApp.instance().execute_in_main_thread( + StdOutBroker.instance().execute_in_main_thread( lambda: host_tools.show_tool_by_name(tool_name, **kwargs) ) diff --git a/openpype/hosts/photoshop/api/lib.py b/openpype/hosts/photoshop/api/lib.py index 707cd476c5..fc5ecc6692 100644 --- a/openpype/hosts/photoshop/api/lib.py +++ b/openpype/hosts/photoshop/api/lib.py @@ -26,7 +26,7 @@ def main(*subprocess_args): avalon.api.install(api) sys.excepthook = safe_excepthook - # coloring in ConsoleTrayApp + # coloring in StdOutBroker os.environ["OPENPYPE_LOG_NO_COLORS"] = "False" app = QtWidgets.QApplication([]) app.setQuitOnLastWindowClosed(False) diff --git a/openpype/lib/remote_publish.py b/openpype/lib/remote_publish.py index 9632e63ea0..10a458ea49 100644 --- a/openpype/lib/remote_publish.py +++ b/openpype/lib/remote_publish.py @@ -21,9 +21,6 @@ FINISHED_OK_STATUS = "finished_ok" def headless_publish(log, close_plugin_name=None, is_test=False): """Runs publish in a opened host with a context and closes Python process. - - Host is being closed via ClosePS pyblish plugin which triggers 'exit' - method in ConsoleTrayApp. """ if not is_test: dbcon = get_webpublish_conn() diff --git a/openpype/modules/webserver/host_console_listener.py b/openpype/modules/webserver/host_console_listener.py index bcf4cadf6a..19428adce3 100644 --- a/openpype/modules/webserver/host_console_listener.py +++ b/openpype/modules/webserver/host_console_listener.py @@ -34,7 +34,7 @@ class HostListener: webserver.add_route('*', "/ws/host_listener", self.websocket_handler) def _host_is_connecting(self, host_name, label): - from openpype.tools.tray_app.app import ConsoleDialog + from openpype.tools.stdout_broker.app import ConsoleDialog """ Initialize dialog, adds to submenu. """ services_submenu = self.module._services_submenu diff --git a/openpype/tools/tray_app/__init__.py b/openpype/tools/stdout_broker/__init__.py similarity index 100% rename from openpype/tools/tray_app/__init__.py rename to openpype/tools/stdout_broker/__init__.py diff --git a/openpype/tools/tray_app/app.py b/openpype/tools/stdout_broker/app.py similarity index 97% rename from openpype/tools/tray_app/app.py rename to openpype/tools/stdout_broker/app.py index aee5eda3a2..6632ae6664 100644 --- a/openpype/tools/tray_app/app.py +++ b/openpype/tools/stdout_broker/app.py @@ -15,7 +15,8 @@ from Qt import QtWidgets, QtCore log = Logger.get_logger(__name__) -class ConsoleTrayApp: + +class StdOutBroker: """ Application showing console in Services tray for non python hosts instead of cmd window. @@ -318,8 +319,8 @@ class ConsoleTrayApp: @staticmethod def color(message): """ Color message with html tags. """ - message = ConsoleTrayApp._multiple_replace(message, - ConsoleTrayApp.sdict) + message = StdOutBroker._multiple_replace(message, + StdOutBroker.sdict) return message @@ -358,5 +359,4 @@ class ConsoleDialog(QtWidgets.QDialog): while new_text: text = new_text.popleft() if text: - self.plain_text.appendHtml( - ConsoleTrayApp.color(text)) + self.plain_text.appendHtml(StdOutBroker.color(text))