def __init__(self):
        self.namespace = None

        # if the ui exists then delete it
        old_window = omui.MQtUtil_findWindow('ribbonTools')
        if old_window:
            cmds.deleteUI('ribbonTools')

        # create a new dialog and give it the main maya window as its parent
        # store it as the parent for our current UI to be put inside
        parent = QtWidgets.QDialog(parent=getMayaMainWindow())

        # set its name so that we can find and delete it later
        parent.setObjectName('ribbonTools')
        parent.setWindowTitle('Ribbon Tools')

        super(RibbonTools, self).__init__(parent=parent)

        dlgLayout = QtWidgets.QVBoxLayout(parent)

        self.buildUI()

        self.parent().layout().addWidget(self)

        parent.show()
Example #2
0
    def __init__(self):
        # check to see if window exists, if not delete it
        old_window = omui.MQtUtil_findWindow('testUI')
        if old_window:
            cmds.deleteUI('testUI')
        # Then we create a new dialog and give it the main maya window as its parent
        # we also store it as the parent for our current UI to be put inside
        parent = QtWidgets.QDialog(parent=getMayaMainWindow())
        # We set its name so that we can find and delete it later
        parent.setObjectName('testUI')
        # Then we set the title
        parent.setWindowTitle('Test UI')
        # look up pyqt documentation to see what QWidget's init method takes
        super(MainUI, self).__init__(parent=parent)

        dlgLayout = QtWidgets.QVBoxLayout(parent)

        # We call our buildUI method to construct our UI
        self.buildUI()

        self.parent().layout().addWidget(self)

        parent.show()