def open_window(cls, show=True, auto_raise=True, delete=False, dock=False):
        s = time.time()
        if (cls is not None and uiutils.isValidQtObject(cls.instance) is True):
            if delete is True:
                cls.instance.close()
                cls.instance.deleteLater()

        if (cls.instance is None
                or uiutils.isValidQtObject(cls.instance) is False):
            name = cls.name
            app, parent = uiutils.getParent()
            cls.instance = cls(parent=parent, name=name)
            cls.instance.setDockableParameters(dockable=dock)

        # Make sure the user can see this window.
        if cls.instance.isHidden():
            if show is True:
                cls.instance.show()
        if auto_raise is True:
            # Force the window state to bring the window to the
            # front, and "restore" the state, even if the window
            # is minimised. Confirmed to work on MS Windows 10.
            state = cls.instance.windowState()
            state = QtCore.Qt.WindowNoState
            state |= QtCore.Qt.WindowActive
            cls.instance.setWindowState(state)

            cls.instance.raise_()
            cls.instance.show()
            cls.instance.activateWindow()
        e = time.time()
        LOG.debug('BaseWindow init: %r seconds', e - s)
        return cls.instance
Exemplo n.º 2
0
def main(col, attr_list):
    app, parent_window = uiutils.getParent()
    dialog = Dialog(parent=parent_window)
    dialog.set_attributes(col, attr_list)
    ret = dialog.exec_()
    status = ret == QtWidgets.QDialog.Accepted
    return status, dialog
def main(show=True, widthHeight=(400, 100)):
    global MM_SOLVER_CHAN_SENSE_UI

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

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

    if ((isinstance(widthHeight, (tuple, list)) is True)
            and (len(widthHeight) == 2)):
        pos = MM_SOLVER_CHAN_SENSE_UI.pos()
        MM_SOLVER_CHAN_SENSE_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 MM_SOLVER_CHAN_SENSE_UI
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.º 5
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
    def open_window(cls, show=True, auto_raise=True, delete=False):
        if (cls is not None
                and uiutils.isValidQtObject(cls.instance) is False):
            if delete is True:
                cls.instance.close()
                cls.instance.deleteLater()

        if (cls.instance is None
                or uiutils.isValidQtObject(cls.instance) is False):
            name = cls.name
            app, parent = uiutils.getParent()
            cls.instance = cls(parent=parent, name=name)

        # Make sure the user can see this window.
        if cls.instance.isHidden():
            if show is True:
                cls.instance.show()
        else:
            if auto_raise is True:
                cls.instance.raise_()
                cls.instance.activateWindow()
        return cls.instance
Exemplo n.º 7
0
def main(show=True, widthHeight=(800, 400)):
    global UI

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

    name = 'LoadMarkerWindow'
    app, parent = uiutils.getParent()
    UI = LoadMarkerWindow(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.º 8
0
def warn_user(title, text):
    LOG.warn(text.replace('\n', ' '))
    app, parent_window = uiutils.getParent()
    Qt.QtWidgets.QMessageBox.warning(parent_window, title, text)
    return