Exemplo n.º 1
0
def main(show=True, auto_raise=True, delete=False):
    """
    Open the Solver UI window.

    :param show: Show the UI.
    :type show: bool

    :param auto_raise: If the UI is open, raise it to the front?
    :type auto_raise: bool

    :param delete: Delete the existing UI and rebuild it? Helpful when
                   developing the UI in Maya script editor.
    :type delete: bool

    :returns: A new solver window, or None if the window cannot be
              opened.
    :rtype: SolverWindow or None.
    """
    # Force the Plug-in to load.  If the plug-in cannot load, the UI
    # will not open and an error will be given.
    lib_maya_utils.ensure_plugin_loaded()

    win = SolverWindow.open_window(show=show,
                                   auto_raise=auto_raise,
                                   delete=delete)
    return win
def main(show=True, widthHeight=(800, 600)):
    # Force the Plug-in to load.  If the plug-in cannot load, the UI
    # will not open and an error will be given.
    lib_maya_utils.ensure_plugin_loaded()

    global UI

    valid = uiutils.isValidQtObject(UI)
    if UI is not None and valid is True:
        UI.close()

    name = 'SolverWindow'
    app, parent = uiutils.getParent()
    UI = SolverWindow(parent=parent, name=name)
    if not UI:
        return UI
    if show:
        UI.show()

    if ((isinstance(widthHeight, (tuple, list)) is True)
            and (len(widthHeight) == 2)):
        pos = UI.pos()
        UI.setGeometry(pos.x(), pos.y(), widthHeight[0], widthHeight[1])

    # Enter Qt application main loop
    if app is not None:
        sys.exit(app.exec_())
    return UI
Exemplo n.º 3
0
def main(show=True, widthHeight=(800, 600)):
    """
    Open the Solver UI window.

    :param show: Should we show the window?
    :type show: bool

    :param widthHeight: Width and height of the window to open.
    :type widthHeight: int, int

    :returns: A new solver window, or None if the window cannot be
              opened.
    :rtype: SolverWindow or None.
    """
    # Force the Plug-in to load.  If the plug-in cannot load, the UI
    # will not open and an error will be given.
    lib_maya_utils.ensure_plugin_loaded()

    win = get_window_instance()
    if win is not None:
        win.close()

    name = 'SolverWindow'
    app, parent = uiutils.getParent()
    win = SolverWindow(parent=parent, name=name)
    __set_window_instance(win)
    if not win:
        return win
    if show is True:
        win.show()

    if ((isinstance(widthHeight, (tuple, list)) is True)
         and (len(widthHeight) == 2)):
        pos = win.pos()
        win.setGeometry(pos.x(), pos.y(), widthHeight[0], widthHeight[1])

    # Enter Qt application main loop
    if app is not None:
        sys.exit(app.exec_())
    return win