mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
standalone publisher has it's own cli command
This commit is contained in:
parent
61ef0cbb0d
commit
1f42ebc736
6 changed files with 62 additions and 52 deletions
|
|
@ -31,6 +31,12 @@ def settings(dev=False):
|
|||
PypeCommands().launch_settings_gui(dev)
|
||||
|
||||
|
||||
@main.command()
|
||||
def standalonepublisher():
|
||||
"""Show Pype Standalone publisher UI."""
|
||||
PypeCommands().launch_standalone_publisher()
|
||||
|
||||
|
||||
@main.command()
|
||||
@click.option("-d", "--debug",
|
||||
is_flag=True, help=("Run pype tray in debug mode"))
|
||||
|
|
|
|||
|
|
@ -30,16 +30,8 @@ class StandAlonePublishAction(PypeModule, ITrayAction):
|
|||
self.publish_paths.extend(publish_paths)
|
||||
|
||||
def run_standalone_publisher(self):
|
||||
# TODO add command to cli.py
|
||||
from pype import tools
|
||||
standalone_publisher_tool_path = os.path.join(
|
||||
os.path.dirname(os.path.abspath(tools.__file__)),
|
||||
"standalonepublish"
|
||||
)
|
||||
args = [
|
||||
*get_pype_execute_args(),
|
||||
"run",
|
||||
standalone_publisher_tool_path,
|
||||
os.pathsep.join(self.publish_paths).replace("\\", "/")
|
||||
"standalonepublisher"
|
||||
]
|
||||
subprocess.Popen(args, creationflags=subprocess.DETACHED_PROCESS)
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ class PypeCommands:
|
|||
)
|
||||
return run_event_server(*args)
|
||||
|
||||
@staticmethod
|
||||
def launch_standalone_publisher():
|
||||
from pype.tools import standalonepublish
|
||||
standalonepublish.main()
|
||||
|
||||
def publish(self, gui, paths):
|
||||
pass
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
from .app import (
|
||||
show,
|
||||
cli
|
||||
main,
|
||||
Window
|
||||
)
|
||||
|
||||
|
||||
__all__ = (
|
||||
"main",
|
||||
"Window"
|
||||
)
|
||||
__all__ = [
|
||||
"show",
|
||||
"cli"
|
||||
]
|
||||
|
|
|
|||
|
|
@ -1,35 +0,0 @@
|
|||
import os
|
||||
import sys
|
||||
import app
|
||||
import ctypes
|
||||
import signal
|
||||
from Qt import QtWidgets, QtGui
|
||||
from avalon import style
|
||||
from pype.api import resources
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
# Allow to change icon of running process in windows taskbar
|
||||
if os.name == "nt":
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
u"standalonepublish"
|
||||
)
|
||||
|
||||
qt_app = QtWidgets.QApplication([])
|
||||
# app.setQuitOnLastWindowClosed(False)
|
||||
qt_app.setStyleSheet(style.load_stylesheet())
|
||||
icon = QtGui.QIcon(resources.pype_icon_filepath())
|
||||
qt_app.setWindowIcon(icon)
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
print("You pressed Ctrl+C. Process ended.")
|
||||
qt_app.quit()
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
window = app.Window(sys.argv[-1].split(os.pathsep))
|
||||
window.show()
|
||||
|
||||
sys.exit(qt_app.exec_())
|
||||
|
|
@ -1,7 +1,18 @@
|
|||
import os
|
||||
import sys
|
||||
import ctypes
|
||||
import signal
|
||||
|
||||
from bson.objectid import ObjectId
|
||||
from Qt import QtWidgets, QtCore
|
||||
from widgets import AssetWidget, FamilyWidget, ComponentsWidget, ShadowWidget
|
||||
from Qt import QtWidgets, QtCore, QtGui
|
||||
|
||||
from .widgets import (
|
||||
AssetWidget, FamilyWidget, ComponentsWidget, ShadowWidget
|
||||
)
|
||||
from avalon import style
|
||||
from pype.api import resources
|
||||
from avalon.api import AvalonMongoDB
|
||||
from pype.modules import ModulesManager
|
||||
|
||||
|
||||
class Window(QtWidgets.QDialog):
|
||||
|
|
@ -194,3 +205,32 @@ class Window(QtWidgets.QDialog):
|
|||
data.update(self.widget_components.collect_data())
|
||||
|
||||
return data
|
||||
|
||||
|
||||
def main():
|
||||
# Allow to change icon of running process in windows taskbar
|
||||
if os.name == "nt":
|
||||
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(
|
||||
u"standalonepublish"
|
||||
)
|
||||
|
||||
qt_app = QtWidgets.QApplication([])
|
||||
# app.setQuitOnLastWindowClosed(False)
|
||||
qt_app.setStyleSheet(style.load_stylesheet())
|
||||
icon = QtGui.QIcon(resources.pype_icon_filepath())
|
||||
qt_app.setWindowIcon(icon)
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
print("You pressed Ctrl+C. Process ended.")
|
||||
qt_app.quit()
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
modules_manager = ModulesManager()
|
||||
module = modules_manager.modules_by_name["standalonepublish_tool"]
|
||||
|
||||
window = Window(module.publish_paths)
|
||||
window.show()
|
||||
|
||||
sys.exit(qt_app.exec_())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue