Beispiel #1
0
    def widget(self, container):
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.StyledPanel)
        main_vbox = QtWidgets.QVBoxLayout(widget)

        hbox = QtWidgets.QHBoxLayout(widget)
        main_vbox.addLayout(hbox)
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel(container['drivers'].verbose_name)
        hbox.addWidget(label)
        drivers_widget = container['drivers'].widget()
        drivers_widget.setMaximumHeight(65)
        hbox.addWidget(drivers_widget)

        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)

        hbox1 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox1)
        label = QtWidgets.QLabel(container['driven'].verbose_name)
        hbox1.addWidget(label)
        hbox1.addWidget(container['driven'].widget())
        hbox1.addWidget(container['maintain_offset'].widget())

        hbox2 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox2)
        hbox2.setContentsMargins(0, 0, 0, 0)
        hbox2.addWidget(container['skip_x'].widget())
        hbox2.addWidget(container['skip_y'].widget())
        hbox2.addWidget(container['skip_z'].widget())
        hbox2.addStretch()

        hbox = QtWidgets.QHBoxLayout(widget)
        main_vbox.addLayout(hbox)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(QtWidgets.QLabel(container['aim_vector'].verbose_name))
        hbox.addWidget(container['aim_vector'].widget())
        hbox.addWidget(QtWidgets.QLabel(container['up_vector'].verbose_name))
        hbox.addWidget(container['up_vector'].widget())

        hbox = QtWidgets.QHBoxLayout(widget)
        main_vbox.addLayout(hbox)
        hbox.setContentsMargins(0, 0, 0, 0)
        hbox.addWidget(
            QtWidgets.QLabel(container['world_up_type'].verbose_name))
        hbox.addWidget(container['world_up_type'].widget())
        hbox.addWidget(
            QtWidgets.QLabel(container['world_up_object'].verbose_name))
        hbox.addWidget(container['world_up_object'].widget())
        hbox.addWidget(
            QtWidgets.QLabel(container['world_up_vector'].verbose_name))
        hbox.addWidget(container['world_up_vector'].widget())

        return widget
Beispiel #2
0
    def __init__(self, parent=None):
        super(CQueueWindow, self).__init__(parent)
        self.setWindowTitle('CQueue')
        self.setObjectName('CQueueWindow')
        self.resize(1280, 600)
        self.recent_menu = None
        self.create_menu()

        main_widget = QtWidgets.QWidget(self)
        main_vbox = QtWidgets.QVBoxLayout(main_widget)
        self.setCentralWidget(main_widget)

        splitter = QtWidgets.QSplitter()
        splitter.setSizePolicy(QtWidgets.QSizePolicy.Preferred,
                               QtWidgets.QSizePolicy.Expanding)
        main_vbox.addWidget(splitter)

        # Create the list of available components
        widget = QtWidgets.QWidget()
        vbox = QtWidgets.QVBoxLayout(widget)
        vbox.setContentsMargins(0, 0, 0, 0)
        self.component_tree = QtWidgets.QTreeView()
        self.component_tree.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        self.component_tree.setDragEnabled(True)
        vbox.addWidget(self.component_tree)
        splitter.addWidget(widget)

        widget = QtWidgets.QWidget()
        splitter.addWidget(widget)
        vbox = QtWidgets.QVBoxLayout(widget)
        scroll_area = QtWidgets.QScrollArea()
        scroll_area.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                  QtWidgets.QSizePolicy.Expanding)
        self.queue_widget = QueueWidget(parent=self)
        self.queue_widget.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                        QtWidgets.QSizePolicy.Expanding)
        scroll_area.setWidget(self.queue_widget)
        scroll_area.setWidgetResizable(True)
        vbox.addWidget(scroll_area)
        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        button = QtWidgets.QPushButton('Execute')
        button.released.connect(self.queue_widget.execute_queue)
        hbox.addWidget(button)

        splitter.setSizes([50, 300])
        splitter.setStretchFactor(0, 0.5)

        self.populate_components()
Beispiel #3
0
    def __init__(self, *args, **kwargs):
        super(MayaTestRunnerDialog, self).__init__(*args, **kwargs)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.setWindowTitle('CMT Unit Test Runner')
        self.resize(1000, 600)
        self.rollback_importer = RollbackImporter()

        menubar = self.menuBar()
        menu = menubar.addMenu('Settings')
        action = menu.addAction('Buffer Output')
        action.setToolTip('Only display output during a failed test.')
        action.setCheckable(True)
        action.setChecked(mayaunittest.Settings.buffer_output)
        action.toggled.connect(mayaunittest.set_buffer_output)
        action = menu.addAction('New Scene Between Test')
        action.setToolTip('Creates a new scene file after each test.')
        action.setCheckable(True)
        action.setChecked(mayaunittest.Settings.file_new)
        action.toggled.connect(mayaunittest.set_file_new)
        menu = menubar.addMenu('Help')
        action = menu.addAction('Documentation')
        action.triggered.connect(documentation)

        toolbar = self.addToolBar('Tools')
        action = toolbar.addAction('Run All Tests')
        action.setIcon(QtGui.QIcon(QtGui.QPixmap(os.path.join(ICON_DIR, 'cmt_run_all_tests.png'))))
        action.triggered.connect(self.run_all_tests)
        action.setToolTip('Run all tests.')

        action = toolbar.addAction('Run Selected Tests')
        action.setIcon(QtGui.QIcon(QtGui.QPixmap(os.path.join(ICON_DIR, 'cmt_run_selected_tests.png'))))
        action.setToolTip('Run all selected tests.')
        action.triggered.connect(self.run_selected_tests)

        action = toolbar.addAction('Run Failed Tests')
        action.setIcon(QtGui.QIcon(QtGui.QPixmap(os.path.join(ICON_DIR, 'cmt_run_failed_tests.png'))))
        action.setToolTip('Run all failed tests.')
        action.triggered.connect(self.run_failed_tests)

        widget = QtWidgets.QWidget()
        self.setCentralWidget(widget)
        vbox = QtWidgets.QVBoxLayout(widget)

        splitter = QtWidgets.QSplitter(orientation=QtCore.Qt.Horizontal)
        self.test_view = QtWidgets.QTreeView()
        self.test_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
        splitter.addWidget(self.test_view)
        self.output_console = QtWidgets.QTextEdit()
        self.output_console.setReadOnly(True)
        splitter.addWidget(self.output_console)
        vbox.addWidget(splitter)
        splitter.setStretchFactor(1, 4)
        self.stream = TestCaptureStream(self.output_console)

        test_suite = mayaunittest.get_tests()
        root_node = TestNode(test_suite)
        self.model = TestTreeModel(root_node, self)
        self.test_view.setModel(self.model)
        self.expand_tree(root_node)
Beispiel #4
0
 def __init__(self, queue=None, parent=None):
     super(QueueWidget, self).__init__(parent)
     self.setAcceptDrops(True)
     self.queue_layout = QtWidgets.QVBoxLayout(self)
     self.queue_layout.addStretch()
     self.queue = queue if queue else core.ComponentQueue()
     self.drop_indicator = DropIndicator()
     self.hide_indicator()
Beispiel #5
0
    def __init__(self, parent=None):
        super(WeightRemapDialog, self).__init__(parent)
        self.setWindowTitle('Remap Weights')
        self.setObjectName('remapWeightsUI')
        self.setModal(True)
        self.resize(600, 400)
        self.mapping = {}

        mainvbox = QtWidgets.QVBoxLayout(self)

        label = QtWidgets.QLabel('The following influences have no corresponding influence from the ' \
                             'imported file.  You can either remap the influences or skip them.')
        label.setWordWrap(True)
        mainvbox.addWidget(label)

        hbox = QtWidgets.QHBoxLayout()
        mainvbox.addLayout(hbox)

        # The existing influences that didn't have weight imported
        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)
        vbox.addWidget(QtWidgets.QLabel('Unmapped influences'))
        self.existing_influences = QtWidgets.QListWidget()
        vbox.addWidget(self.existing_influences)

        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)
        vbox.addWidget(QtWidgets.QLabel('Available imported influences'))
        widget = QtWidgets.QScrollArea()
        self.imported_influence_layout = QtWidgets.QVBoxLayout(widget)
        vbox.addWidget(widget)

        hbox = QtWidgets.QHBoxLayout()
        mainvbox.addLayout(hbox)
        hbox.addStretch()
        btn = QtWidgets.QPushButton('Ok')
        btn.released.connect(self.accept)
        hbox.addWidget(btn)
Beispiel #6
0
    def widget(self, container):
        # The fields will be arranged in two row containers
        # [[driver, driven], [name, twist, swing, twistAxis]]
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.StyledPanel)
        vbox = QtWidgets.QVBoxLayout(widget)

        for attrs in [
            ['driver', 'driven'],
            ['name', 'twist', 'swing', 'twist_axis'],
        ]:
            hbox = QtWidgets.QHBoxLayout(widget)
            vbox.addLayout(hbox)
            hbox.setContentsMargins(0, 0, 0, 0)
            for attr in attrs:
                hbox.addWidget(QtWidgets.QLabel(container[attr].verbose_name))
                hbox.addWidget(container[attr].widget())

        return widget
Beispiel #7
0
 def widget(self):
     """Get the QWidget of the Field."""
     widget = QtWidgets.QWidget()
     field_layout = QtWidgets.QVBoxLayout(widget)
     field_layout.setContentsMargins(0, 0, 0, 0)
     button_layout = QtWidgets.QHBoxLayout()
     button_layout.setContentsMargins(0, 0, 0, 0)
     # Monkey path the button_layout onto the widget in case Components want to add more buttons to it.
     widget.field_layout = field_layout
     widget.button_layout = button_layout
     button = QtWidgets.QPushButton(self.add_label_text)
     button.released.connect(
         partial(self.add_element, field_layout=field_layout))
     button.setToolTip('Add a new element to list.')
     button_layout.addWidget(button)
     for field in self.fields:
         self.add_element(field, field_layout)
     field_layout.addLayout(button_layout)
     return widget
Beispiel #8
0
    def widget(self):
        """Get a the QWidget displaying the Component data.

        Users can override this method if they wish to customize the layout of the component.
        :return: A QWidget containing all the Component fields.
        """
        widget = QtWidgets.QWidget()
        layout = QtWidgets.QHBoxLayout(widget)
        layout.setContentsMargins(0, 0, 0, 0)
        self.list_widget = self.control_list.widget()
        layout.addWidget(self.list_widget)

        vbox = QtWidgets.QVBoxLayout()
        vbox.setContentsMargins(0, 0, 0, 0)
        layout.addLayout(vbox)
        button = QtWidgets.QPushButton('Store Controls')
        button.released.connect(self.store_controls)
        vbox.addWidget(button)
        vbox.addStretch()
        return widget
Beispiel #9
0
    def widget(self, container):
        widget = QtWidgets.QFrame()
        widget.setFrameStyle(QtWidgets.QFrame.StyledPanel)

        hbox = QtWidgets.QHBoxLayout(widget)
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel(container['drivers'].verbose_name)
        hbox.addWidget(label)
        drivers_widget = container['drivers'].widget()
        drivers_widget.setMaximumHeight(65)
        hbox.addWidget(drivers_widget)

        vbox = QtWidgets.QVBoxLayout()
        hbox.addLayout(vbox)

        hbox1 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox1)
        label = QtWidgets.QLabel(container['driven'].verbose_name)
        hbox1.addWidget(label)
        hbox1.addWidget(container['driven'].widget())
        hbox1.addWidget(container['maintain_offset'].widget())

        hbox2 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox2)
        hbox2.setContentsMargins(0, 0, 0, 0)
        hbox2.addWidget(container['skip_tx'].widget())
        hbox2.addWidget(container['skip_ty'].widget())
        hbox2.addWidget(container['skip_tz'].widget())
        hbox2.addStretch()

        hbox3 = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox3)
        hbox3.setContentsMargins(0, 0, 0, 0)
        hbox3.addWidget(container['skip_rx'].widget())
        hbox3.addWidget(container['skip_ry'].widget())
        hbox3.addWidget(container['skip_rz'].widget())
        hbox3.addStretch()

        return widget
Beispiel #10
0
    def __init__(self, comp, queue, parent=None):
        super(ComponentWidget, self).__init__(parent)
        self.setMouseTracking(True)
        self.queue_layout = parent.queue_layout
        self.queue = queue
        self.comp = comp
        vbox = QtWidgets.QVBoxLayout(self)
        self.setFrameStyle(QtWidgets.QFrame.StyledPanel)
        self.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                           QtWidgets.QSizePolicy.Maximum)
        self.over_grab_hotspot = False
        self.color = ComponentWidget.normal_color

        # Header
        hbox = QtWidgets.QHBoxLayout()
        self.header_layout = hbox
        hbox.setContentsMargins(16, 4, 4, 4)
        vbox.addLayout(hbox)

        # Expand toggle
        expand_action = QtWidgets.QAction('Toggle', self)
        expand_action.setCheckable(True)
        icon = QtGui.QIcon(QtGui.QPixmap(':/arrowDown.png'))
        expand_action.setIcon(icon)
        expand_action.setToolTip('Toggle details')
        expand_action.setStatusTip('Toggle details')
        button = QtWidgets.QToolButton()
        button.setDefaultAction(expand_action)
        hbox.addWidget(button)

        # Enable checkbox
        enabled = QtWidgets.QCheckBox()
        enabled.setToolTip('Enable/Disable Component')
        hbox.addWidget(enabled)

        # Breakpoint
        self.break_point_action = QtWidgets.QAction('Breakpoint', self)
        self.break_point_action.setCheckable(True)
        self.break_point_action.setIcon(self.break_point_disabled_icon)
        self.break_point_action.setToolTip('Set break point at component.')
        self.break_point_action.setStatusTip('Set break point at component.')
        self.break_point_action.toggled.connect(self.set_break_point)
        button = QtWidgets.QToolButton()
        button.setDefaultAction(self.break_point_action)
        hbox.addWidget(button)

        # Execute button
        action = QtWidgets.QAction('Execute', self)
        icon = QtGui.QIcon(QtGui.QPixmap(':/timeplay.png'))
        action.setIcon(icon)
        action.setToolTip('Execute the component')
        action.setStatusTip('Execute the component')
        action.triggered.connect(
            partial(self.execute_component,
                    on_error=parent.on_component_execution_error))
        button = QtWidgets.QToolButton()
        button.setDefaultAction(action)
        hbox.addWidget(button)

        # Image label
        label = QtWidgets.QLabel()
        label.setPixmap(comp.image(size=24))
        label.setToolTip(comp.__class__.__doc__)
        hbox.addWidget(label)

        # Name label
        label = QtWidgets.QLabel(comp.name().split('.')[-1])
        label.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                            QtWidgets.QSizePolicy.Fixed)
        label.setToolTip(comp.__class__.__doc__)
        font = QtGui.QFont()
        font.setPointSize(14)
        label.setFont(font)
        hbox.addWidget(label)
        hbox.addStretch()

        if comp.help_url():
            action = QtWidgets.QAction('Help', self)
            icon = QtGui.QIcon(QtGui.QPixmap(':/help.png'))
            action.setIcon(icon)
            action.setToolTip('Open help documentation.')
            action.setStatusTip('Open help documentation.')
            action.triggered.connect(partial(webbrowser.open, comp.help_url()))
            button = QtWidgets.QToolButton()
            button.setDefaultAction(action)
            hbox.addWidget(button)

        action = QtWidgets.QAction('Delete', self)
        icon = QtGui.QIcon(QtGui.QPixmap(':/smallTrash.png'))
        action.setIcon(icon)
        message = 'Delete Component'
        action.setToolTip(message)
        action.setStatusTip(message)
        action.triggered.connect(partial(self.remove, prompt=True))
        button = QtWidgets.QToolButton()
        button.setDefaultAction(action)
        hbox.addWidget(button)

        content_vbox = QtWidgets.QVBoxLayout()
        content_vbox.setContentsMargins(16, 0, 0, 0)
        vbox.addLayout(content_vbox)

        content_widget = comp.widget()
        content_vbox.addWidget(content_widget)
        enabled.toggled.connect(content_widget.setEnabled)
        enabled.setChecked(comp.enabled)
        enabled.toggled.connect(comp.set_enabled)
        expand_action.toggled.connect(content_widget.setVisible)
        content_widget.setVisible(False)
Beispiel #11
0
    def __init__(self, parent=None):
        super(ControlWindow, self).__init__(parent)
        self.setWindowTitle('CMT Control Creator')
        self.resize(300, 500)
        vbox = QtWidgets.QVBoxLayout(self)

        size = 20
        label_width = 60
        icon_left = QtGui.QIcon(
            QtGui.QPixmap(':/nudgeLeft.png').scaled(size, size))
        icon_right = QtGui.QIcon(
            QtGui.QPixmap(':/nudgeRight.png').scaled(size, size))
        validator = QtGui.QDoubleValidator(-180.0, 180.0, 2)
        grid = QtWidgets.QGridLayout()
        vbox.addLayout(grid)

        # Rotate X
        label = QtWidgets.QLabel('Rotate X')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 0, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_x, direction=-1))
        grid.addWidget(b, 0, 1)
        self.offset_x = QtWidgets.QLineEdit('45.0')
        self.offset_x.setValidator(validator)
        grid.addWidget(self.offset_x, 0, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_x, direction=1))
        grid.addWidget(b, 0, 3)

        # Rotate Y
        label = QtWidgets.QLabel('Rotate Y')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 1, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_y, direction=-1))
        grid.addWidget(b, 1, 1)
        self.offset_y = QtWidgets.QLineEdit('45.0')
        self.offset_y.setValidator(validator)
        grid.addWidget(self.offset_y, 1, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_y, direction=1))
        grid.addWidget(b, 1, 3)

        # Rotate Z
        label = QtWidgets.QLabel('Rotate Z')
        label.setMaximumWidth(label_width)
        grid.addWidget(label, 2, 0, QtCore.Qt.AlignRight)
        b = QtWidgets.QPushButton(icon_left, '')
        b.released.connect(partial(self.rotate_z, direction=-1))
        grid.addWidget(b, 2, 1)
        self.offset_z = QtWidgets.QLineEdit('45.0')
        self.offset_z.setValidator(validator)
        grid.addWidget(self.offset_z, 2, 2)
        b = QtWidgets.QPushButton(icon_right, '')
        b.released.connect(partial(self.rotate_z, direction=1))
        grid.addWidget(b, 2, 3)
        grid.setColumnStretch(2, 2)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        b = QtWidgets.QPushButton('Export Selected')
        b.released.connect(self.dump_controls)
        hbox.addWidget(b)

        b = QtWidgets.QPushButton('Set Color')
        b.released.connect(self.set_color)
        hbox.addWidget(b)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        b = QtWidgets.QPushButton('Create Selected')
        b.released.connect(self.create_selected)
        hbox.addWidget(b)

        b = QtWidgets.QPushButton('Remove Selected')
        b.released.connect(self.remove_selected)
        hbox.addWidget(b)

        hbox = QtWidgets.QHBoxLayout()
        vbox.addLayout(hbox)
        self.stack_count = QtWidgets.QSpinBox()
        self.stack_count.setValue(2)
        hbox.addWidget(self.stack_count)

        b = QtWidgets.QPushButton('Create Transform Stack')
        b.released.connect(self.create_transform_stack)
        b.setToolTip('Creates a transform stack above each selected node.')
        hbox.addWidget(b)

        self.control_list = QtWidgets.QListWidget()
        self.control_list.setSelectionMode(
            QtWidgets.QAbstractItemView.ExtendedSelection)
        vbox.addWidget(self.control_list)

        self.populate_controls()