Esempio n. 1
0
def DDTree():

    tree = TreeWidget()

    dialog = QDialog()
    layout = QVBoxLayout()
    layout.addWidget(tree)
    dialog.setLayout(layout)

    if not dialog.exec_():
        return
Esempio n. 2
0
def showSystemSettings(system):
    from brigks.gui.systemSettingsWidget import SystemSettingsWidget
    widget = SystemSettingsWidget(system)

    dialog = QDialog()
    layout = QVBoxLayout()
    layout.addWidget(widget)
    dialog.setLayout(layout)

    if not dialog.exec_():
        return
Esempio n. 3
0
 def _show_bones_hierarchy(self, file_path):
     dlg = QDialog(parent=dcc.get_main_window() or None)
     dlg.setWindowTitle('Select Skeleton Node')
     lyt = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))
     dlg.setLayout(lyt)
     bone_hierarchy_widget = BoneHierarchyWidget(file_path, parent=dlg)
     current_bone = self.text() or ''
     bone_hierarchy_widget.set_bone(current_bone)
     lyt.addWidget(bone_hierarchy_widget)
     dlg.exec_()
     selected_node = bone_hierarchy_widget.selected_node
     if not selected_node:
         return
     self.setText(selected_node)
Esempio n. 4
0
    def _on_open_rig_control_selector(self):

        from tpRigToolkit.tools.controlrig.core import client, tool, toolset

        dlg = QDialog(parent=self)
        dlg.setWindowTitle('Select Control')
        dlg.setWindowIcon(resources.icon('circle'))
        lyt = layouts.VerticalLayout(spacing=0, margins=(0, 0, 0, 0))
        lyt.setSpacing(0)
        lyt.setContentsMargins(0, 0, 0, 0)
        dlg.setLayout(lyt)

        if hasattr(self._rig_object, 'full_path'):
            current_project = self._rig_object
        else:
            current_project = self._rig_object.get_project()
        project_path = current_project.full_path

        # TODO: The project itself should return this path
        controls_path = os.path.join(project_path, 'controls.json')

        self._control_rig_client = client.ControlRigClient.create(
            tool.ControlRigTool.ID)
        control_selector = toolset.ControlRigToolset(
            as_selector=True,
            controls_path=controls_path,
            control_data=self._control_data,
            selector_parent=dlg)
        control_selector.initialize(self._control_rig_client)

        lyt.addWidget(control_selector)
        dlg.resize(600, 700)
        dlg.exec_()
        control_data = control_selector.control_data or dict()
        if not control_data and self._control_data:
            return
        if control_data:
            control_data.pop('control_name', None)
            # control_data.pop('control_data', None)

        self.controlSelected.emit(control_data)
Esempio n. 5
0
    def addAttributeSlot(self):
        """ Adds a new attribute (column) to the table """

        dialog = QDialog(self)
        dialog.setModal(True)
        dialog.setWindowTitle('Add Attribute')

        layout = QVBoxLayout()
        dialog.setLayout(layout)

        form = QFormLayout()
        nameBox = QLineEdit()
        typeCombo = QComboBox()
        for attrType in _attrTypes:
            typeName = partio.TypeName(attrType)
            typeCombo.addItem(typeName)
        typeCombo.setCurrentIndex(partio.FLOAT)
        countBox = QLineEdit()
        countBox.setValidator(QIntValidator())
        countBox.setText('1')
        fixedCheckbox = QCheckBox()
        valueBox = QLineEdit()
        valueBox.setText('0')
        form.addRow('Name:', nameBox)
        form.addRow('Type:', typeCombo)
        form.addRow('Count:', countBox)
        form.addRow('Fixed:', fixedCheckbox)
        form.addRow('Default Value:', valueBox)
        layout.addLayout(form)

        buttons = QHBoxLayout()
        layout.addLayout(buttons)

        add = QPushButton('Add')
        add.clicked.connect(dialog.accept)
        buttons.addWidget(add)

        cancel = QPushButton('Cancel')
        cancel.clicked.connect(dialog.reject)
        buttons.addWidget(cancel)

        if not dialog.exec_():
            return

        name = str(nameBox.text())
        if not name:
            print('Please supply a name for the new attribute')  # TODO: prompt
            return

        attrType = typeCombo.currentIndex()
        count = int(countBox.text())
        fixed = fixedCheckbox.isChecked()
        values = list(str(valueBox.text()).strip().split())
        for i in range(count):
            if i < len(values):
                value = values[i]
            else:
                value = values[-1]
            if attrType == partio.INT or attrType == partio.INDEXEDSTR:
                values[i] = int(value)
            elif attrType == partio.FLOAT or attrType == partio.VECTOR:
                values[i] = float(value)  # pylint:disable=R0204
            else:
                values[i] = 0.0  # pylint:disable=R0204
        value = tuple(values)

        self.data.addAttribute(name, attrType, count, fixed, value)
Esempio n. 6
0
    def addAttributeSlot(self):
        """ Adds a new attribute (column) to the table """

        dialog = QDialog(self)
        dialog.setModal(True)
        dialog.setWindowTitle('Add Attribute')

        layout = QVBoxLayout()
        dialog.setLayout(layout)

        form = QFormLayout()
        nameBox = QLineEdit()
        typeCombo = QComboBox()
        for attrType in _attrTypes:
            typeName = partio.TypeName(attrType)
            typeCombo.addItem(typeName)
        typeCombo.setCurrentIndex(partio.FLOAT)
        countBox = QLineEdit()
        countBox.setValidator(QIntValidator())
        countBox.setText('1')
        fixedCheckbox = QCheckBox()
        valueBox = QLineEdit()
        valueBox.setText('0')
        form.addRow('Name:', nameBox)
        form.addRow('Type:', typeCombo)
        form.addRow('Count:', countBox)
        form.addRow('Fixed:', fixedCheckbox)
        form.addRow('Default Value:', valueBox)
        layout.addLayout(form)

        buttons = QHBoxLayout()
        layout.addLayout(buttons)

        add = QPushButton('Add')
        add.clicked.connect(dialog.accept)
        buttons.addWidget(add)

        cancel = QPushButton('Cancel')
        cancel.clicked.connect(dialog.reject)
        buttons.addWidget(cancel)

        if not dialog.exec_():
            return

        name = str(nameBox.text())
        if not name:
            print 'Please supply a name for the new attribute' # TODO: prompt
            return

        attrType = typeCombo.currentIndex()
        count = int(countBox.text())
        fixed = fixedCheckbox.isChecked()
        values = list(str(valueBox.text()).strip().split())
        for i in range(count):
            if i < len(values):
                value = values[i]
            else:
                value = values[-1]
            if attrType == partio.INT or attrType == partio.INDEXEDSTR:
                values[i] = int(value)
            elif attrType == partio.FLOAT or attrType == partio.VECTOR:
                values[i] = float(value) # pylint:disable=R0204
            else:
                values[i] = 0.0 # pylint:disable=R0204
        value = tuple(values)

        self.data.addAttribute(name, attrType, count, fixed, value)