mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
added force option to tray
# Conflicts: # client/ayon_core/tools/tray/lib.py
This commit is contained in:
parent
d00676eeb5
commit
90bb6a841b
3 changed files with 18 additions and 9 deletions
|
|
@ -59,13 +59,20 @@ def main_cli(ctx):
|
|||
|
||||
|
||||
@main_cli.command()
|
||||
def tray():
|
||||
@click.option(
|
||||
"--force",
|
||||
is_flag=True,
|
||||
help="Force to start tray and close any existing one.")
|
||||
def tray(force):
|
||||
"""Launch AYON tray.
|
||||
|
||||
Default action of AYON command is to launch tray widget to control basic
|
||||
aspects of AYON. See documentation for more information.
|
||||
"""
|
||||
Commands.launch_tray()
|
||||
|
||||
from ayon_core.tools.tray import main
|
||||
|
||||
main(force)
|
||||
|
||||
|
||||
@main_cli.group(help="Run command line arguments of AYON addons")
|
||||
|
|
|
|||
|
|
@ -13,12 +13,6 @@ class Commands:
|
|||
|
||||
Most of its methods are called by :mod:`cli` module.
|
||||
"""
|
||||
@staticmethod
|
||||
def launch_tray():
|
||||
from ayon_core.tools.tray import main
|
||||
|
||||
main()
|
||||
|
||||
@staticmethod
|
||||
def publish(
|
||||
path: str,
|
||||
|
|
|
|||
|
|
@ -344,12 +344,20 @@ def is_tray_running(
|
|||
return state != TrayState.NOT_RUNNING
|
||||
|
||||
|
||||
def main():
|
||||
def main(force=False):
|
||||
from ayon_core.tools.tray.ui import main
|
||||
|
||||
Logger.set_process_name("Tray")
|
||||
|
||||
state = get_tray_state()
|
||||
if force and state in (TrayState.RUNNING, TrayState.STARTING):
|
||||
file_info = get_tray_file_info() or {}
|
||||
pid = file_info.get("pid")
|
||||
if pid is not None:
|
||||
_kill_tray_process(pid)
|
||||
remove_tray_server_url(force=True)
|
||||
state = TrayState.NOT_RUNNING
|
||||
|
||||
if state == TrayState.RUNNING:
|
||||
print("Tray is already running.")
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue