mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
OP-2414 - renamed ConsoleTrayApp to StdOutBroker
This commit is contained in:
parent
2fa24b23b7
commit
041f5db196
7 changed files with 18 additions and 21 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
Loading…
Add table
Add a link
Reference in a new issue