Exemplo n.º 1
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()
Exemplo n.º 2
0
    def add_element(self, field=None, field_layout=None):
        """Adds a new field to the Array.

        :param field: Optional field to add. If omitted, a copy of the last element will be added.
        """
        if field is None:
            if not self.fields:
                raise RuntimeError('No default field set in the ArrayField.')
            field = copy.deepcopy(self.fields[-1])
            self.fields.append(field)
        if field_layout:
            element_widget = QtWidgets.QWidget()
            field_layout.insertWidget(field_layout.count() - 1, element_widget)
            hbox = QtWidgets.QHBoxLayout(element_widget)
            hbox.setContentsMargins(0, 0, 0, 0)

            field_widget = field.widget()
            hbox.addWidget(field_widget)

            action = QtWidgets.QAction('Remove', field_layout)
            action.triggered.connect(
                partial(self.remove_element, field_layout, element_widget))

            icon = QtGui.QIcon(QtGui.QPixmap(':/smallTrash.png'))
            action.setIcon(icon)
            action.setToolTip('Remove')
            action.setStatusTip('Remove')
            delete_button = QtWidgets.QToolButton()
            delete_button.setDefaultAction(action)
            hbox.addWidget(delete_button)
Exemplo n.º 3
0
    def widget(self):
        """Get the QWidget of the Field."""
        widget = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout(widget)
        hbox.setContentsMargins(0, 0, 0, 0)
        if self._multi:
            node_widget = QtWidgets.QListWidget()
            node_widget.addItems(self._value)

            def on_rows_changed(*args, **kwargs):
                field = kwargs['field']
                node_widget = kwargs['node_widget']
                values = [
                    node_widget.item(x).text()
                    for x in range(node_widget.count())
                ]
                field.set_value(values)

            model = node_widget.model()
            model.rowsInserted.connect(
                partial(on_rows_changed, field=self, node_widget=node_widget))
            model.rowsRemoved.connect(
                partial(on_rows_changed, field=self, node_widget=node_widget))
        else:
            node_widget = QtWidgets.QLineEdit(self._value)
            node_widget.textChanged.connect(self.set_value)
        node_widget.setToolTip(self.help_text)
        hbox.addWidget(node_widget)
        button = QtWidgets.QPushButton('Set')
        button.setToolTip('Populate the field with the selected node.')
        button.released.connect(partial(self.set_from_selected, node_widget))
        hbox.addWidget(button)
        return widget
Exemplo n.º 4
0
    def widget(self):
        """Get the QWidget of the Field."""
        widget = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout(widget)
        hbox.setContentsMargins(0, 0, 0, 0)
        label = QtWidgets.QLabel('Relative to')
        label.setSizePolicy(QtWidgets.QSizePolicy.Maximum,
                            QtWidgets.QSizePolicy.Fixed)
        hbox.addWidget(label)
        relative_combobox = QtWidgets.QComboBox()
        relative_combobox.addItems(FilePathField.relative_to_choices)
        index = relative_combobox.findText(self.relative_to)
        if index != -1:
            relative_combobox.setCurrentIndex(index)
        relative_combobox.currentIndexChanged.connect(self.set_relative_to)
        hbox.addWidget(relative_combobox)

        line_edit = QtWidgets.QLineEdit(self._value)
        line_edit.setToolTip(self.help_text)
        line_edit.setSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                QtWidgets.QSizePolicy.Fixed)
        line_edit.textChanged.connect(self.set_value)
        hbox.addWidget(line_edit)
        button = QtWidgets.QPushButton('Browse')
        button.released.connect(
            partial(self.browse, line_edit, relative_combobox))
        hbox.addWidget(button)
        return widget
Exemplo n.º 5
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)
Exemplo n.º 6
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.QFormLayout(widget)
        for field in self.fields:
            if field.display_name:
                layout.addRow(field.verbose_name, field.widget())
            else:
                layout.addWidget(field.widget())
        return widget
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 9
0
    def widget(self):
        """Get the QWidget of the Field."""
        widget = QtWidgets.QWidget()
        hbox = QtWidgets.QHBoxLayout(widget)
        hbox.setContentsMargins(0, 0, 0, 0)
        validator = QtGui.QDoubleValidator(-999999.0, 999999.0, self.precision)
        widget_x = QtWidgets.QLineEdit(str(self._value[0]))
        widget_x.setToolTip(self.help_text)
        widget_x.setValidator(validator)
        widget_x.textChanged.connect(self.set_value_x)
        hbox.addWidget(widget_x)

        widget_y = QtWidgets.QLineEdit(str(self._value[1]))
        widget_y.setToolTip(self.help_text)
        widget_y.setValidator(validator)
        widget_y.textChanged.connect(self.set_value_y)
        hbox.addWidget(widget_y)

        widget_z = QtWidgets.QLineEdit(str(self._value[2]))
        widget_z.setToolTip(self.help_text)
        widget_z.setValidator(validator)
        widget_z.textChanged.connect(self.set_value_z)
        hbox.addWidget(widget_z)
        return widget