From c11a74737578bfac89917ddfead2bfde4450fff6 Mon Sep 17 00:00:00 2001 From: Petr Kalis Date: Tue, 25 Jan 2022 14:45:15 +0100 Subject: [PATCH] OP-2424 - switched ConsoleTrayApp to singleton pattern --- openpype/hosts/harmony/api/lib.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openpype/hosts/harmony/api/lib.py b/openpype/hosts/harmony/api/lib.py index ed99ffe94f..77c3bd22d0 100644 --- a/openpype/hosts/harmony/api/lib.py +++ b/openpype/hosts/harmony/api/lib.py @@ -70,7 +70,9 @@ def main(*subprocess_args): app = QtWidgets.QApplication([]) app.setQuitOnLastWindowClosed(False) - ConsoleTrayApp('harmony', launch, subprocess_args, is_host_connected) + instance = ConsoleTrayApp('harmony', launch, + subprocess_args, is_host_connected) + ConsoleTrayApp._instance = instance sys.exit(app.exec_()) @@ -205,13 +207,13 @@ def launch_zip_file(filepath): return print("Launching {}".format(scene_path)) - ConsoleTrayApp.websocket_server = self.server - ConsoleTrayApp.process = subprocess.Popen( + ConsoleTrayApp.instance().websocket_server = self.server + ConsoleTrayApp.instance().process = subprocess.Popen( [self.application_path, scene_path], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL ) - self.pid = ConsoleTrayApp.process.pid + self.pid = ConsoleTrayApp.instance().process.pid def on_file_changed(path, threaded=True): @@ -276,7 +278,7 @@ def show(module_name): if tool_name == "loader": kwargs["use_context"] = True - ConsoleTrayApp.execute_in_main_thread( + ConsoleTrayApp.instance().execute_in_main_thread( lambda: host_tools.show_tool_by_name(tool_name, **kwargs) )