mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
moved standalonepublish action into standalone publish host
This commit is contained in:
parent
f9c49fcaef
commit
ffaa0b7adf
2 changed files with 6 additions and 0 deletions
|
|
@ -0,0 +1,6 @@
|
|||
from standalonepublish_module import StandAlonePublishModule
|
||||
|
||||
|
||||
__all__ = (
|
||||
"StandAlonePublishModule",
|
||||
)
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
import os
|
||||
import platform
|
||||
import subprocess
|
||||
from openpype.lib import get_openpype_execute_args
|
||||
from openpype.modules import OpenPypeModule
|
||||
from openpype_interfaces import ITrayAction
|
||||
|
||||
|
||||
class StandAlonePublishAction(OpenPypeModule, ITrayAction):
|
||||
label = "Publish"
|
||||
name = "standalonepublish_tool"
|
||||
|
||||
def initialize(self, modules_settings):
|
||||
import openpype
|
||||
self.enabled = modules_settings[self.name]["enabled"]
|
||||
self.publish_paths = [
|
||||
os.path.join(
|
||||
openpype.PACKAGE_DIR,
|
||||
"hosts",
|
||||
"standalonepublisher",
|
||||
"plugins",
|
||||
"publish"
|
||||
)
|
||||
]
|
||||
|
||||
def tray_init(self):
|
||||
return
|
||||
|
||||
def on_action_trigger(self):
|
||||
self.run_standalone_publisher()
|
||||
|
||||
def connect_with_modules(self, enabled_modules):
|
||||
"""Collect publish paths from other modules."""
|
||||
publish_paths = self.manager.collect_plugin_paths()["publish"]
|
||||
self.publish_paths.extend(publish_paths)
|
||||
|
||||
def run_standalone_publisher(self):
|
||||
args = get_openpype_execute_args("standalonepublisher")
|
||||
kwargs = {}
|
||||
if platform.system().lower() == "darwin":
|
||||
new_args = ["open", "-na", args.pop(0), "--args"]
|
||||
new_args.extend(args)
|
||||
args = new_args
|
||||
|
||||
detached_process = getattr(subprocess, "DETACHED_PROCESS", None)
|
||||
if detached_process is not None:
|
||||
kwargs["creationflags"] = detached_process
|
||||
|
||||
subprocess.Popen(args, **kwargs)
|
||||
Loading…
Add table
Add a link
Reference in a new issue