예제 #1
0
    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()
예제 #2
0
import avalon.api
import avalon.fusion
import avalon.tools.loader as tool


avalon.api.install(avalon.fusion)
tool.show(use_context=True)
예제 #3
0
 def on_load_clicked(self):
     print("Clicked Load")
     loader.show(use_context=True)
예제 #4
0
def override_toolbox_ui():
    """Add custom buttons in Toolbox as replacement for Maya web help icon."""

    import colorbleed
    res = os.path.join(os.path.dirname(os.path.dirname(colorbleed.__file__)),
                       "res")
    icons = os.path.join(res, "icons")

    import avalon.tools.sceneinventory as inventory
    import avalon.tools.loader as loader
    from avalon.maya.pipeline import launch_workfiles_app

    # Ensure the maya web icon on toolbox exists
    web_button = "ToolBox|MainToolboxLayout|mayaWebButton"
    if not mc.iconTextButton(web_button, query=True, exists=True):
        return

    mc.iconTextButton(web_button, edit=True, visible=False)

    # real = 32, but 36 with padding - according to toolbox mel script
    icon_size = 36
    parent = web_button.rsplit("|", 1)[0]

    # Ensure the parent is a formLayout
    if not mc.objectTypeUI(parent) == "formLayout":
        return

    # Create our controls
    background_color = (0.267, 0.267, 0.267)
    controls = []

    control = mc.iconTextButton("colorbleed_toolbox_workfiles",
                                annotation="Work Files",
                                label="Work Files",
                                image=os.path.join(icons, "workfiles.png"),
                                command=lambda: launch_workfiles_app(),
                                bgc=background_color,
                                width=icon_size,
                                height=icon_size,
                                parent=parent)
    controls.append(control)

    control = mc.iconTextButton("colorbleed_toolbox_loader",
                                annotation="Loader",
                                label="Loader",
                                image=os.path.join(icons, "loader.png"),
                                command=lambda: loader.show(use_context=True),
                                bgc=background_color,
                                width=icon_size,
                                height=icon_size,
                                parent=parent)
    controls.append(control)

    control = mc.iconTextButton("colorbleed_toolbox_manager",
                                annotation="Inventory",
                                label="Inventory",
                                image=os.path.join(icons, "inventory.png"),
                                command=lambda: inventory.show(),
                                bgc=background_color,
                                width=icon_size,
                                height=icon_size,
                                parent=parent)
    controls.append(control)

    control = mc.iconTextButton("colorbleed_toolbox",
                                annotation="Colorbleed",
                                label="Colorbleed",
                                image=os.path.join(
                                    icons, "colorbleed_logo_36x36.png"),
                                bgc=background_color,
                                width=icon_size,
                                height=icon_size,
                                parent=parent)
    controls.append(control)

    # Add the buttons on the bottom and stack
    # them above each other with side padding
    controls.reverse()
    for i, control in enumerate(controls):
        previous = controls[i - 1] if i > 0 else web_button

        mc.formLayout(parent,
                      edit=True,
                      attachControl=[control, "bottom", 0, previous],
                      attachForm=([control, "left", 1], [control, "right", 1]))
예제 #5
0
def override_toolbox_ui():
    """Add custom buttons in Toolbox as replacement for Maya web help icon."""
    inventory = None
    loader = None
    launch_workfiles_app = None
    mayalookassigner = None
    try:
        import avalon.tools.sceneinventory as inventory
    except Exception:
        log.warning("Could not import SceneInventory tool")

    try:
        import avalon.tools.loader as loader
    except Exception:
        log.warning("Could not import Loader tool")

    try:
        from avalon.maya.pipeline import launch_workfiles_app
    except Exception:
        log.warning("Could not import Workfiles tool")

    try:
        from openpype.tools import mayalookassigner
    except Exception:
        log.warning("Could not import Maya Look assigner tool")

    from openpype.api import resources

    icons = resources.get_resource("icons")

    if not any((
        mayalookassigner, launch_workfiles_app, loader, inventory
    )):
        return

    # Ensure the maya web icon on toolbox exists
    web_button = "ToolBox|MainToolboxLayout|mayaWebButton"
    if not mc.iconTextButton(web_button, query=True, exists=True):
        return

    mc.iconTextButton(web_button, edit=True, visible=False)

    # real = 32, but 36 with padding - according to toolbox mel script
    icon_size = 36
    parent = web_button.rsplit("|", 1)[0]

    # Ensure the parent is a formLayout
    if not mc.objectTypeUI(parent) == "formLayout":
        return

    # Create our controls
    background_color = (0.267, 0.267, 0.267)
    controls = []
    if mayalookassigner:
        controls.append(
            mc.iconTextButton(
                "pype_toolbox_lookmanager",
                annotation="Look Manager",
                label="Look Manager",
                image=os.path.join(icons, "lookmanager.png"),
                command=lambda: mayalookassigner.show(),
                bgc=background_color,
                width=icon_size,
                height=icon_size,
                parent=parent
            )
        )

    if launch_workfiles_app:
        controls.append(
            mc.iconTextButton(
                "pype_toolbox_workfiles",
                annotation="Work Files",
                label="Work Files",
                image=os.path.join(icons, "workfiles.png"),
                command=lambda: launch_workfiles_app(),
                bgc=background_color,
                width=icon_size,
                height=icon_size,
                parent=parent
            )
        )

    if loader:
        controls.append(
            mc.iconTextButton(
                "pype_toolbox_loader",
                annotation="Loader",
                label="Loader",
                image=os.path.join(icons, "loader.png"),
                command=lambda: loader.show(use_context=True),
                bgc=background_color,
                width=icon_size,
                height=icon_size,
                parent=parent
            )
        )

    if inventory:
        controls.append(
            mc.iconTextButton(
                "pype_toolbox_manager",
                annotation="Inventory",
                label="Inventory",
                image=os.path.join(icons, "inventory.png"),
                command=lambda: inventory.show(),
                bgc=background_color,
                width=icon_size,
                height=icon_size,
                parent=parent
            )
        )

    # Add the buttons on the bottom and stack
    # them above each other with side padding
    controls.reverse()
    for i, control in enumerate(controls):
        previous = controls[i - 1] if i > 0 else web_button

        mc.formLayout(parent, edit=True,
                      attachControl=[control, "bottom", 0, previous],
                      attachForm=([control, "left", 1],
                                  [control, "right", 1]))