def handle(self): # self.request is the TCP socket connected to the client self.data = self.request.recv(1024).strip() print(f"{self.client_address[0]} wrote: {self.data}") global QT_APP if self.data == b"START": self.request.sendall(b"confirmed") if self.data == b"OPEN workfiles": self.request.sendall(b"Wrapper will open the workfiles-tool") self.openworkfiles() if self.data == b"OPEN creator": self.request.sendall(b"Wrapper will open the Creator-tool") self.opencreator() if self.data == b"OPEN loader": loader.show() QT_APP.exec() if self.data == b"OPEN publish": pyblish.api.register_target("submarine.tvpaint") publish.show() #QT_APP.exec() if self.data == b"END": def shut_me_down(server): server.shutdown() _thread.start_new_thread(shut_me_down, (wrapperserver, )) self.request.sendall(b"Shutting down the python_wrapper-server") tvp.send_release()
def avalon_api_publish(data, gui=True): ''' Launches Pyblish (GUI by default) :param data: Should include data for pyblish and standalone collector :type data: dict :param gui: Pyblish will be launched in GUI mode if set to True :type gui: bool ''' io.install() # Create hash name folder in temp chars = "".join([random.choice(string.ascii_letters) for i in range(15)]) staging_dir = tempfile.mkdtemp(chars) # create also json and fill with data json_data_path = staging_dir + os.path.basename(staging_dir) + '.json' with open(json_data_path, 'w') as outfile: json.dump(data, outfile) args = ["-pp", os.pathsep.join(pyblish.api.registered_paths())] envcopy = os.environ.copy() envcopy["PYBLISH_HOSTS"] = "standalonepublisher" envcopy["SAPUBLISH_INPATH"] = json_data_path if gui: av_publish.show() else: returncode = execute([sys.executable, "-u", "-m", "pyblish"] + args, env=envcopy) io.uninstall()
def main(): # prepare all environments _prepare_publish_environments() # Registers pype's Global pyblish plugins pype.install() for path in PUBLISH_PATHS: path = os.path.normpath(path) if not os.path.exists(path): continue log.info(f"Registering path: {path}") pyblish.api.register_plugin_path(path) pyblish.api.register_host(publish_host) # Register project specific plugins project_name = os.environ["AVALON_PROJECT"] project_plugins_paths = os.getenv("PYPE_PROJECT_PLUGINS", "") for path in project_plugins_paths.split(os.pathsep): plugin_path = os.path.join(path, project_name, "plugins") if os.path.exists(plugin_path): pyblish.api.register_plugin_path(plugin_path) return publish.show()
def main(): # prepare all environments _prepare_publish_environments() # Registers pype's Global pyblish plugins pype.install() if os.path.exists(PUBLISH_PATH): log.info(f"Registering path: {PUBLISH_PATH}") pyblish.api.register_plugin_path(PUBLISH_PATH) pyblish.api.register_host(publish_host) return publish.show()
def main(env): from avalon.tools import publish # Registers pype's Global pyblish plugins openpype.install() # Register additional paths addition_paths_str = env.get("PUBLISH_PATHS") or "" addition_paths = addition_paths_str.split(os.pathsep) for path in addition_paths: path = os.path.normpath(path) if not os.path.exists(path): continue pyblish.api.register_plugin_path(path) return publish.show()
def main(env): # Registers pype's Global pyblish plugins pype.install() # Register Host (and it's pyblish plugins) host_name = env["AVALON_APP"] # TODO not sure if use "pype." or "avalon." for host import host_import_str = f"pype.{host_name}" try: host_module = importlib.import_module(host_import_str) except ModuleNotFoundError: log.error((f"Host \"{host_name}\" can't be imported." f" Import string \"{host_import_str}\" failed.")) return False avalon.api.install(host_module) # Register additional paths addition_paths_str = env.get("PUBLISH_PATHS") or "" addition_paths = addition_paths_str.split(os.pathsep) for path in addition_paths: path = os.path.normpath(path) if not os.path.exists(path): continue pyblish.api.register_plugin_path(path) # Register project specific plugins project_name = os.environ["AVALON_PROJECT"] project_plugins_paths = env.get("PYPE_PROJECT_PLUGINS") or "" for path in project_plugins_paths.split(os.pathsep): plugin_path = os.path.join(path, project_name, "plugins") if os.path.exists(plugin_path): pyblish.api.register_plugin_path(plugin_path) return publish.show()
def publish(parent): """Shorthand to publish from within host""" from avalon.tools import publish return publish.show(parent)
def publish(parent): """Shorthand to publish from within host""" return _publish.show(parent)
def install(): """ Installing menu into Nukestudio """ # here is the best place to add menu from avalon.tools import publish, cbloader from avalon.vendor.Qt import QtGui menu_name = os.environ['AVALON_LABEL'] context_label = "{0}, {1}".format(Session["AVALON_ASSET"], Session["AVALON_TASK"]) self._change_context_menu = context_label try: check_made_menu = findMenuAction(menu_name) except Exception: check_made_menu = None if not check_made_menu: # Grab Hiero's MenuBar menu = hiero.ui.menuBar().addMenu(menu_name) else: menu = check_made_menu.menu() context_label_action = menu.addAction(context_label) context_label_action.setEnabled(False) menu.addSeparator() workfiles_action = menu.addAction("Work Files...") workfiles_action.setIcon(QtGui.QIcon("icons:Position.png")) workfiles_action.triggered.connect(set_workfiles) default_tags_action = menu.addAction("Create Default Tags...") default_tags_action.setIcon(QtGui.QIcon("icons:Position.png")) default_tags_action.triggered.connect(add_tags_from_presets) menu.addSeparator() publish_action = menu.addAction("Publish...") publish_action.setIcon(QtGui.QIcon("icons:Output.png")) publish_action.triggered.connect( lambda *args: publish.show(hiero.ui.mainWindow())) loader_action = menu.addAction("Load...") loader_action.setIcon(QtGui.QIcon("icons:CopyRectangle.png")) loader_action.triggered.connect(cbloader.show) menu.addSeparator() reload_action = menu.addAction("Reload pipeline...") reload_action.setIcon(QtGui.QIcon("icons:ColorAdd.png")) reload_action.triggered.connect(reload_config) # Is this required? # hiero.ui.registerAction(context_label_action) # hiero.ui.registerAction(workfiles_action) # hiero.ui.registerAction(default_tags_action) # hiero.ui.registerAction(publish_action) # hiero.ui.registerAction(loader_action) # hiero.ui.registerAction(reload_action) self.context_label_action = context_label_action self.workfile_actions = workfiles_action self.default_tags_action = default_tags_action self.publish_action = publish_action self.reload_action = reload_action