Пример #1
0
    def __show_ui(self):
        self.setObjectName("PurgeConfirm")
        self.setWindowTitle("Purge")

        self.container = QtWidgets.QWidget(self)
        self.warning = QtWidgets.QLabel(
            "Purge all data?\nWARNING: THIS CANNOT BE UNDONE")

        self.confirm_button = QtWidgets.QPushButton("OK")
        self.confirm_button.clicked.connect(self.__button_click)

        self.VLayout = QtWidgets.QVBoxLayout(self.container)
        self.HLayout = QtWidgets.QHBoxLayout(self.container)

        self.icon_label = QtWidgets.QLabel(self.container)
        self.icon_label.setPixmap(QtGui.QPixmap(":/SP_MessageBoxCritical.png"))

        self.container.setLayout(self.VLayout)
        self.HLayout.addWidget(self.icon_label)
        self.HLayout.addWidget(self.warning)
        self.VLayout.addLayout(self.HLayout)
        self.VLayout.addWidget(self.confirm_button)
        self.setCentralWidget(self.container)
Пример #2
0
    def __setup_ui(self):
        self.setWindowTitle("Constraint Manager")
        self.setObjectName("ConManWindow")
        self.resize(250, 425)
        self.setMinimumSize(250, 425)
        self.setMaximumSize(250, 425)
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setFamily("Arial")
        self.setFont(font)
        self.setTabShape(QtWidgets.QTabWidget.Rounded)

        self.centralwidget = QtWidgets.QWidget(self)
        self.centralwidget.setMinimumSize(QtCore.QSize(250, 425))
        self.centralwidget.setMaximumSize(QtCore.QSize(250, 425))

        self.verticalLayoutWidget = QtWidgets.QWidget(self.centralwidget)
        self.verticalLayoutWidget.setGeometry(QtCore.QRect(0, 0, 250, 425))

        self.LayoutVert1 = QtWidgets.QVBoxLayout(self.verticalLayoutWidget)
        self.LayoutVert1.setSpacing(2)
        self.LayoutVert1.setContentsMargins(5, -1, 5, -1)

        self.ObjList = QtWidgets.QListWidget()
        self.ObjList.setMinimumSize(QtCore.QSize(240, 125))
        self.ObjList.setMaximumSize(QtCore.QSize(240, 125))
        self.ObjList.setFrameShape(QtWidgets.QFrame.NoFrame)
        self.ObjList.setFrameShadow(QtWidgets.QFrame.Plain)
        self.ObjList.setToolTip(
            "Click to see switching options.\nDouble click to select constrained object."
        )

        self.ButtonRow1 = QtWidgets.QHBoxLayout()
        self.ButtonRow1.setSpacing(0)

        self.ButtonAdd = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonAdd.setEnabled(True)
        self.ButtonAdd.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonAdd.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonAdd.setText("")
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap(":/pickHandlesComp.png"),
                       QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.ButtonAdd.setIcon(icon)
        self.ButtonAdd.setIconSize(QtCore.QSize(40, 40))
        self.ButtonAdd.setFlat(False)
        self.ButtonAdd.setToolTip("Add selected constraint nodes to the list.")

        self.ButtonParent = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonParent.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonParent.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonParent.setText("")
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap(":/parentConstraint.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.ButtonParent.setIcon(icon1)
        self.ButtonParent.setIconSize(QtCore.QSize(40, 40))
        self.ButtonParent.setFlat(False)
        self.ButtonParent.setToolTip(
            "Create a parent constraint with options below.")

        self.ButtonPoint = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonPoint.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonPoint.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonPoint.setText("")
        icon2 = QtGui.QIcon()
        icon2.addPixmap(QtGui.QPixmap(":/posConstraint.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.ButtonPoint.setIcon(icon2)
        self.ButtonPoint.setIconSize(QtCore.QSize(40, 40))
        self.ButtonPoint.setFlat(False)
        self.ButtonPoint.setToolTip(
            "Create a point constraint with options below.")

        self.ButtonOrient = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonOrient.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonOrient.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonOrient.setText("")
        icon3 = QtGui.QIcon()
        icon3.addPixmap(QtGui.QPixmap(":/orientConstraint.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.ButtonOrient.setIcon(icon3)
        self.ButtonOrient.setIconSize(QtCore.QSize(40, 40))
        self.ButtonOrient.setFlat(False)
        self.ButtonOrient.setToolTip(
            "Create an orient constraint with options below.")

        self.ButtonScale = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonScale.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonScale.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonScale.setText("")
        icon4 = QtGui.QIcon()
        icon4.addPixmap(QtGui.QPixmap(":/scaleConstraint.png"),
                        QtGui.QIcon.Normal, QtGui.QIcon.On)
        self.ButtonScale.setIcon(icon4)
        self.ButtonScale.setIconSize(QtCore.QSize(40, 40))
        self.ButtonScale.setFlat(False)
        self.ButtonScale.setToolTip(
            "Create a scale constraint with options below.")

        self.ButtonRemove = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonRemove.setMinimumSize(QtCore.QSize(40, 40))
        self.ButtonRemove.setMaximumSize(QtCore.QSize(40, 40))
        self.ButtonRemove.setText("")
        icon5 = QtGui.QIcon()
        icon5.addPixmap(QtGui.QPixmap(":/smallTrash.png"), QtGui.QIcon.Normal,
                        QtGui.QIcon.On)
        self.ButtonRemove.setIcon(icon5)
        self.ButtonRemove.setIconSize(QtCore.QSize(40, 40))
        self.ButtonRemove.setFlat(False)
        self.ButtonRemove.setToolTip("Remove constraint from the scene.")

        self.tabWidget = QtWidgets.QTabWidget(self.verticalLayoutWidget)
        self.tabWidget.setMinimumSize(QtCore.QSize(240, 205))
        self.tabWidget.setMaximumSize(QtCore.QSize(240, 205))
        self.tabWidget.setFont(font)
        self.tabWidget.setTabPosition(QtWidgets.QTabWidget.North)
        self.tabWidget.setTabShape(QtWidgets.QTabWidget.Rounded)

        self.tabBar = QtWidgets.QTabBar(self.verticalLayoutWidget)
        self.tabWidget.setTabBar(self.tabBar)

        self.ConstraintOptions = QtWidgets.QWidget()

        self.gridLayoutWidget = QtWidgets.QWidget(self.ConstraintOptions)
        self.gridLayoutWidget.setGeometry(QtCore.QRect(0, 0, 240, 185))

        self.OptionsGrid = QtWidgets.QGridLayout(self.gridLayoutWidget)
        self.OptionsGrid.setContentsMargins(-1, -1, -1, -1)
        self.OptionsGrid.setHorizontalSpacing(2)
        self.OptionsGrid.setVerticalSpacing(2)

        # Labels
        self.LabelOffset = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelOffset.setFont(font)
        self.LabelOffset.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignTrailing
                                      | QtCore.Qt.AlignVCenter)
        self.LabelOffset.setText("Offset")

        self.LabelMOffset = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelMOffset.setFont(font)
        self.LabelMOffset.setAlignment(QtCore.Qt.AlignRight
                                       | QtCore.Qt.AlignTrailing
                                       | QtCore.Qt.AlignVCenter)
        self.LabelMOffset.setText("Maintain Off")

        self.LabelTr = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelTr.setFont(font)
        self.LabelTr.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.LabelTr.setText("Translate")

        self.LabelRo = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelRo.setFont(font)
        self.LabelRo.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.LabelRo.setText("Rotate")

        self.LabelSc = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelSc.setFont(font)
        self.LabelSc.setAlignment(QtCore.Qt.AlignRight
                                  | QtCore.Qt.AlignTrailing
                                  | QtCore.Qt.AlignVCenter)
        self.LabelSc.setText("Scale")

        self.LabelWeight = QtWidgets.QLabel(self.gridLayoutWidget)
        self.LabelWeight.setFont(font)
        self.LabelWeight.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.LabelWeight.setAlignment(QtCore.Qt.AlignRight
                                      | QtCore.Qt.AlignTrailing
                                      | QtCore.Qt.AlignVCenter)
        self.LabelWeight.setText("Weight")

        # Checkboxes
        self.CheckOffset = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckOffset.setChecked(True)
        self.CheckOffset.setText("")

        # Translate checkboxes
        self.CheckTrAll = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckTrAll.setFont(font)
        self.CheckTrAll.setChecked(True)
        self.CheckTrAll.setText("All")

        self.CheckTrX = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckTrX.setFont(font)
        self.CheckTrX.setText("X")

        self.CheckTrY = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckTrY.setFont(font)
        self.CheckTrY.setText("Y")

        self.CheckTrZ = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckTrZ.setFont(font)
        self.CheckTrZ.setText("Z")

        # Rotate checkboxes
        self.CheckRoAll = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckRoAll.setFont(font)
        self.CheckRoAll.setChecked(True)
        self.CheckRoAll.setText("All")

        self.CheckRoX = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckRoX.setFont(font)
        self.CheckRoX.setText("X")

        self.CheckRoY = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckRoY.setFont(font)
        self.CheckRoY.setText("Y")

        self.CheckRoZ = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckRoZ.setFont(font)
        self.CheckRoZ.setText("Z")

        # Scale checkboxes
        self.CheckScAll = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckScAll.setFont(font)
        self.CheckScAll.setChecked(True)
        self.CheckScAll.setText("All")

        self.CheckScX = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckScX.setFont(font)
        self.CheckScX.setText("X")

        self.CheckScY = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckScY.setFont(font)
        self.CheckScY.setText("Y")

        self.CheckScZ = QtWidgets.QCheckBox(self.gridLayoutWidget)
        self.CheckScZ.setFont(font)
        self.CheckScZ.setText("Z")

        # Spin boxes
        self.SpinOffsetX = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget)
        self.SpinOffsetX.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)

        self.SpinOffsetY = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget)
        self.SpinOffsetY.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)

        self.SpinOffsetZ = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget)
        self.SpinOffsetZ.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)

        self.SpinWeight = QtWidgets.QDoubleSpinBox(self.gridLayoutWidget)
        self.SpinWeight.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons)
        self.SpinWeight.setMaximum(1.0)
        self.SpinWeight.setSingleStep(0.1)
        self.SpinWeight.setProperty("value", 1.0)

        self.Switch = QtWidgets.QWidget()

        self.verticalLayoutWidget_2 = QtWidgets.QWidget(self.Switch)
        self.verticalLayoutWidget_2.setGeometry(QtCore.QRect(0, 0, 235, 110))

        self.SwitchCol = QtWidgets.QVBoxLayout(self.verticalLayoutWidget_2)
        self.SwitchCol.setSpacing(4)
        self.SwitchCol.setContentsMargins(5, 5, 5, 5)

        self.MenuSwitchTarget = QtWidgets.QComboBox(
            self.verticalLayoutWidget_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred,
                                           QtWidgets.QSizePolicy.Preferred)
        self.MenuSwitchTarget.setSizePolicy(sizePolicy)
        self.MenuSwitchTarget.setSizeAdjustPolicy(
            QtWidgets.QComboBox.AdjustToContents)
        self.MenuSwitchTarget.setFrame(True)
        self.MenuSwitchTarget.setToolTip("Select a target to switch to...")

        self.ButtonRow3 = QtWidgets.QHBoxLayout()
        self.ButtonRow3.setSpacing(4)

        self.ButtonOff = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
        self.ButtonOff.setMinimumHeight(25)
        self.ButtonOff.setToolTip("Turn all target weights OFF.")
        self.ButtonOff.setText("OFF")

        self.ButtonAll = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
        self.ButtonAll.setMinimumHeight(25)
        self.ButtonAll.setToolTip("Turn all target weights ON.")
        self.ButtonAll.setText("ALL")

        self.ButtonSwitch = QtWidgets.QPushButton(self.verticalLayoutWidget_2)
        self.ButtonSwitch.setText("Switch")
        self.ButtonSwitch.setMinimumHeight(25)
        self.ButtonSwitch.setToolTip("Weight constraint to a single target.")

        self.CheckVisTrans = QtWidgets.QCheckBox(self.verticalLayoutWidget_2)
        self.CheckVisTrans.setChecked(True)
        self.CheckVisTrans.setToolTip(
            "Keep object in the same position\nby updating constraint offsets."
        )
        self.CheckVisTrans.setText("Maintain Visual Transforms")

        self.CheckKey = QtWidgets.QCheckBox(self.verticalLayoutWidget_2)
        self.CheckKey.setChecked(True)
        self.CheckKey.setToolTip(
            "Key offsets, transforms and blend attributes.")
        self.CheckKey.setText("Key")

        self.ButtonRow2 = QtWidgets.QHBoxLayout()
        self.ButtonRow2.setSpacing(0)

        self.ButtonHelp = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonHelp.setMinimumHeight(30)
        self.ButtonHelp.setFont(font)
        self.ButtonHelp.setToolTip("Open help documentation.")
        self.ButtonHelp.setText("Help")

        self.ButtonPurge = QtWidgets.QPushButton(self.verticalLayoutWidget)
        self.ButtonPurge.setMinimumHeight(30)
        self.ButtonPurge.setFont(font)
        self.ButtonPurge.setToolTip(
            "Remove all ConMan data. \nWARNING: CANNOT BE UNDONE")
        self.ButtonPurge.setText("Purge...")

        self.__place_ui()
        self.__set_connections()
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(self)
        self.__set_tab_order()