Пример #1
0
    def setupUI(self):
        self.setMinimumHeight(350)
        layout = QtGui.QVBoxLayout(self)
        layout.setContentsMargins(0, 0, 0, 0)
        layout.setSpacing(0)

        self._stats_cbbox = QtGui.QComboBox(self)
        self._stats_cbbox.setObjectName('stat-combo')
        self._stats_cbbox.addItems(self._tracked_elts)
        self._stats_cbbox.setMinimumHeight(25)
        self._stats_cbbox.currentIndexChanged.connect(self.set_graph)

        css_combobox = """
        QComboBox { padding: 2px 18px 2px 3px;
                    border-top-right-radius: 4px;
                    border-top-left-radius: 4px;
                    border-bottom-right-radius: 0px;
                    border-bottom-left-radius: 0px;
                    background: #AAA; color: #333; }
        QComboBox::on { background: #DDD; color: #333; }
        QComboBox::drop-down { subcontrol-origin: padding;
                               subcontrol-position: top right;
                               width: 15px; border: 0px;
                               border-top-right-radius: 4px;
                               border-bottom-right-radius: 0px; }
        QComboBox::down-arrow { image: url(':ftrack/image/integration/branch-open') }
        QAbstractItemView { background: #888; border: 0px; }
        """
        # self._stats_cbbox.setStyleSheet(css_combobox)

        layout.addWidget(self._stats_cbbox)

        self._stackLayout = QtGui.QStackedLayout()
        layout.addLayout(self._stackLayout)
    def _build(self):
        '''Build and layout widget.'''
        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(layout)

        if self._specification.isOfType('group'):
            self.setHidden(True)

        else:
            # Assume asset task type.
            self._taskTypeCombo = QtGui.QComboBox()
            self._taskTypeCombo.addItems(('Compositing', 'Editing'))

            taskLayout = QtGui.QHBoxLayout()
            taskLayout.addWidget(QtGui.QLabel('Create under task: '))
            taskLayout.addWidget(self._taskTypeCombo)
            layout.addLayout(taskLayout)
    def setupUI(self):
        super(ScriptPublisherDialog, self).setupUI()

        self.resize(1226, 790)
        self.setMinimumWidth(1226)
        self.setMinimumHeight(790)

        # self.tasks_frame.setStyleSheet("background-color:grey;")

        # HEADER

        self.asset_conn_container = QtGui.QWidget(self.main_container)
        self.asset_conn_container_layout = QtGui.QHBoxLayout()
        self.asset_conn_container.setLayout(self.asset_conn_container_layout)
        # self.main_container_layout.addWidget(self.asset_conn_container)

        self.asset_conn_label = QtGui.QLabel('Type', self.main_container)
        self.asset_conn_label.setMinimumWidth(60)

        self.asset_conn_combo = QtGui.QComboBox(self.main_container)
        self.asset_conn_combo.setMinimumHeight(23)
        self.asset_conn_combo.addItems(self._connectors_per_type.keys())

        spacer_asset_type = QtGui.QSpacerItem(0, 0,
                                              QtGui.QSizePolicy.Expanding,
                                              QtGui.QSizePolicy.Minimum)

        self.asset_conn_container_layout.addWidget(self.asset_conn_label)
        self.asset_conn_container_layout.addWidget(self.asset_conn_combo)
        self.asset_conn_container_layout.addItem(spacer_asset_type)

        self.tasks_main_container_layout.addWidget(self.asset_conn_container)

        # Create "main content" for the publisher
        self.publish_container = QtGui.QWidget(self.main_container)
        self.publish_container.setSizePolicy(
            QtGui.QSizePolicy.Expanding,
            QtGui.QSizePolicy.Expanding,
        )
        self.publish_container_layout = QtGui.QHBoxLayout()
        self.publish_container_layout.setContentsMargins(0, 0, 0, 0)
        self.publish_container.setLayout(self.publish_container_layout)

        self.main_container_layout.addWidget(self.publish_container)

        # Create "main content" splitter for the publisher
        self.publish_splitter = QtGui.QSplitter(self.publish_container)
        self.publish_splitter.setContentsMargins(0, 0, 0, 0)
        self.publish_splitter.setChildrenCollapsible(False)

        self.publish_container_layout.addWidget(self.publish_splitter)
        self.publish_container_layout.setContentsMargins(0, 0, 0, 0)

        # Create left and right containers for the splitter
        self.publish_left_container = QtGui.QWidget(self.publish_splitter)
        self.publish_right_container = QtGui.QWidget(self.publish_splitter)

        self.publish_left_container_layout = QtGui.QVBoxLayout()
        self.publish_right_container_layout = QtGui.QVBoxLayout()
        self.publish_right_container_layout.setContentsMargins(5, 0, 0, 0)

        self.publish_left_container.setLayout(
            self.publish_left_container_layout)
        self.publish_right_container.setLayout(
            self.publish_right_container_layout)

        # Left Splitter Container
        self.publish_left_container_layout.setContentsMargins(0, 0, 5, 0)

        self.left_tasks_widget = TaskWidget(self.publish_left_container)
        self.left_tasks_widget.set_read_only(False)
        self.left_tasks_widget.set_selection_mode(False)
        self.publish_left_container_layout.addWidget(self.left_tasks_widget)

        # Right Splitter Containers
        css_asset_version = "color: #de8888; font-weight: bold;"

        self.right_top_container = QtGui.QFrame(self.publish_right_container)
        self.right_mid_container = QtGui.QFrame(self.publish_right_container)
        self.right_bot_container = QtGui.QFrame(self.publish_right_container)

        self.right_top_container_layout = QtGui.QHBoxLayout()
        self.right_mid_container_layout = QtGui.QHBoxLayout()
        self.right_bot_container_layout = QtGui.QHBoxLayout()

        self.right_top_container.setLayout(self.right_top_container_layout)
        self.right_mid_container.setLayout(self.right_mid_container_layout)
        self.right_bot_container.setLayout(self.right_bot_container_layout)

        self.publish_right_container_layout.addWidget(self.right_top_container)
        self.publish_right_container_layout.addWidget(self.right_mid_container)
        self.publish_right_container_layout.addWidget(self.right_bot_container)

        # Right Splitter TOP Container
        asset_title_label = QtGui.QLabel('Asset', self.right_top_container)
        self._asset_name = QtGui.QLabel('Loading...', self.right_top_container)
        asset_spacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding,
                                         QtGui.QSizePolicy.Minimum)
        version_title_label = QtGui.QLabel('Version', self.right_top_container)
        self._asset_version = QtGui.QLabel('Loading...',
                                           self.right_top_container)

        self._asset_version.setStyleSheet(css_asset_version)

        self.right_top_container_layout.addWidget(asset_title_label)
        self.right_top_container_layout.addWidget(self._asset_name)
        self.right_top_container_layout.addItem(asset_spacer)
        self.right_top_container_layout.addWidget(version_title_label)
        self.right_top_container_layout.addWidget(self._asset_version)

        # Right Splitter MID Container
        self._snapshotWidget = SnapshotsWidget(self.right_mid_container)
        self.right_mid_container_layout.addWidget(self._snapshotWidget)

        # Right Splitter BOT Container
        self._comment_widget = CommentWidget(self.right_bot_container)
        self.right_bot_container_layout.addWidget(self._comment_widget)

        self._save_btn.setText("Publish and Save script")
        self._save_btn.clicked.disconnect()

        self.modify_layouts(self.asset_conn_container,
                            spacing=0,
                            margin=(0, 0, 0, 0),
                            alignment=QtCore.Qt.AlignTop)

        self.append_css(self.global_css)
        self.set_css(self.main_container)
        self._connect_script_signals()
    def _buildClipsTab(self):

        l = FnAssetAPI.l

        imageSpecification = ImageSpecification()

        # > Media Ta

        mediaWidget = QtGui.QWidget()
        mediaWidget.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                  QtGui.QSizePolicy.Expanding)
        mediaWidgetLayout = QtGui.QVBoxLayout()
        mediaWidgetLayout.setAlignment(QtCore.Qt.AlignLeft
                                       | QtCore.Qt.AlignTop)
        mediaWidget.setLayout(mediaWidgetLayout)

        # - Shared Media

        self._sharedClipsGroup = QtGui.QGroupBox(
            l("Some Source Clips are Shared " +
              "and used in more than one Shot in the Edit"))
        mediaWidgetLayout.addWidget(self._sharedClipsGroup)
        sharedClipsGroupLayout = QtGui.QVBoxLayout()
        self._sharedClipsGroup.setLayout(sharedClipsGroupLayout)

        self._sharedIgnoredRadio = QtGui.QRadioButton(l("Don't {publish}"))
        self._sharedToSequenceRadio = QtGui.QRadioButton(
            l("{publish} at the level above the Shots"))
        self._sharedToCustomRadio = QtGui.QRadioButton(
            l("{publish} to another location"))
        self._sharedIgnoredRadio.setChecked(True)
        sharedClipsGroupLayout.addWidget(self._sharedIgnoredRadio)
        sharedClipsGroupLayout.addWidget(self._sharedToSequenceRadio)
        sharedClipsGroupLayout.addWidget(self._sharedToCustomRadio)

        ## @todo Use the project entityReferences Parent if we have one?

        pickerCls = self._session.getManagerWidget(
            FnAssetAPI.ui.constants.kInlinePickerWidgetId, instantiate=False)

        self._sharedClipParentPicker = pickerCls(imageSpecification,
                                                 self._context)
        self._sharedClipParentPicker.setVisible(False)
        sharedClipsGroupLayout.addWidget(self._sharedClipParentPicker)

        self._previewWidget = PublishShotClipsSummaryWidget()
        self._previewWidget.setSizePolicy(QtGui.QSizePolicy.Expanding,
                                          QtGui.QSizePolicy.Expanding)
        mediaWidgetLayout.addWidget(self._previewWidget)

        # - Options

        self._clipOptionsGroup = QtGui.QGroupBox(l("Options"))
        optionsGroupLayout = QtGui.QVBoxLayout()
        self._clipOptionsGroup.setLayout(optionsGroupLayout)
        mediaWidgetLayout.addWidget(self._clipOptionsGroup)

        # See if we have any options from the manager
        self._managerOptionsClip = self._session.getManagerWidget(
            FnAssetAPI.ui.constants.kRegistrationManagerOptionsWidgetId,
            throw=False,
            args=(imageSpecification, self._context))

        if self._managerOptionsClip:
            optionsGroupLayout.addWidget(self._managerOptionsClip)
            optionsGroupLayout.addSpacing(10)

        hieroOptionsGrid = QtGui.QGridLayout()

        ## @todo we should have some base widget for this

        hieroOptionsGrid.addWidget(QtGui.QLabel(l("{asset} name:")), 0, 0)

        self._clipNameCombo = QtGui.QComboBox()
        self._clipNameCombo.addItems(("Clip Name", "Custom"))
        hieroOptionsGrid.addWidget(self._clipNameCombo, 0, 1)

        self._clipNameCustomField = QtGui.QLineEdit()
        hieroOptionsGrid.addWidget(self._clipNameCustomField, 0, 2)

        self._replaceClipSource = QtGui.QCheckBox(
            l("Link Source Clips to " + "{published} {assets}"))
        hieroOptionsGrid.addWidget(self._replaceClipSource, 1, 1, 1, 2)

        self._ignorePublishedClips = QtGui.QCheckBox(
            l("Ignore Source Clips that are " + "already {published}"))
        hieroOptionsGrid.addWidget(self._ignorePublishedClips, 2, 1, 1, 2)

        # Make sure we don't stretch the grid layout too much and make the last
        #column really wide
        hieroOptionsHBox = QtGui.QHBoxLayout()
        optionsGroupLayout.addLayout(hieroOptionsHBox)
        hieroOptionsHBox.addLayout(hieroOptionsGrid)
        hieroOptionsHBox.addStretch()

        return mediaWidget