コード例 #1
0
    def __init__(self, selection, parent=None):
        ''' Initialise class with *selection* and *parent* widget. '''
        self._result_data = {}

        if not parent:
            parent = hiero.ui.mainWindow()

        super(FtrackReBuildServerTrackDialog, self).__init__(parent)
        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)

        num_tasks = registry.numTasks()
        self._ftrack_tasks = [
            registry.taskName(index) for index in range(num_tasks)
        ]

        self._selection = selection

        if self._selection:
            self.project = self.item_project(self._selection[0])

        self._window_title = 'Build track from ftrack'
        self.setWindowTitle(self._window_title)
        # self.setWindowIcon(QtGui.QPixmap(':ftrack/image/default/ftrackLogoColor'))

        self.setSizeGripEnabled(True)

        layout = QtWidgets.QVBoxLayout()
        formLayout = QtWidgets.QFormLayout()
        self._tracknameField = QtWidgets.QLineEdit()
        self._tracknameField.setToolTip('Name of new track')
        formLayout.addRow('Track name:', self._tracknameField)

        self.tasks_combobox = QtWidgets.QComboBox()
        formLayout.addRow('Task type:', self.tasks_combobox)

        self.asset_type_combobox = QtWidgets.QComboBox()

        formLayout.addRow('Asset type:', self.asset_type_combobox)

        self.asset_status_combobox = QtWidgets.QComboBox()
        formLayout.addRow('Asset Status:', self.asset_status_combobox)

        self.component_combobox = QtWidgets.QComboBox()
        formLayout.addRow('Component name:', self.component_combobox)

        layout.addLayout(formLayout)

        # Add the standard ok/cancel buttons, default to ok.
        self._buttonbox = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.StandardButton.Ok
            | QtWidgets.QDialogButtonBox.StandardButton.Cancel)
        self._buttonbox.button(
            QtWidgets.QDialogButtonBox.StandardButton.Ok).setText('Build')
        self._buttonbox.button(
            QtWidgets.QDialogButtonBox.StandardButton.Ok).setDisabled(True)
        self._buttonbox.button(
            QtWidgets.QDialogButtonBox.StandardButton.Ok).setAutoDefault(True)
        self._buttonbox.accepted.connect(self.accept_test)
        self._buttonbox.rejected.connect(self.reject)
        layout.addWidget(self._buttonbox)

        self.setLayout(layout)

        # populate data
        self.populate_tasks()
        self.populate_asset_types()
        self.populate_components()
        self.populate_asset_statuses()

        # connect signals
        self.tasks_combobox.currentIndexChanged.connect(self.get_components)
        self.asset_type_combobox.currentIndexChanged.connect(
            self.get_components)
        self.component_combobox.currentIndexChanged.connect(
            self.get_components)
        self.asset_status_combobox.currentIndexChanged.connect(
            self.get_components)

        # set suggested track name
        self._tracknameField.setText(self.suggested_track_name)

        # force ui to refresh
        self.get_components()
コード例 #2
0
  def __init__(self, parent=None, session=None, context=None):
    super(BuildAssetTrackDialog, self).__init__(parent)

    self.setWindowTitle("Build Track")

    if not session:
      session = FnAssetAPI.SessionManager.currentSession()
    self.__session = session

    if not context:
      context = session.createContext()
    self.__context = context

    self.__selection = []
    self.__entities = []
    self.__ignoreClips = False

    self.__lastIgnoreClips = None
    self.__lastParentRef = None

    layout = QtWidgets.QVBoxLayout()
    self.setLayout(layout)

     # Asset Manager Widget

    self.__relationshipWidget = session.getManagerWidget(
        kWorkflowRelationshipWidgetId, args=[context,])
    layout.addWidget(self.__relationshipWidget)

    # Stretch
    layout.addStretch()

    # Options

    optionsBox = QtWidgets.QGroupBox("Options")
    optionsLayout = QtWidgets.QVBoxLayout()
    optionsBox.setLayout(optionsLayout)
    layout.addWidget(optionsBox)

    self.__trackName = QtWidgets.QLineEdit()
    trackNameLayout = QtWidgets.QHBoxLayout()
    trackNameLayout.addWidget(QtWidgets.QLabel("Track Name"))
    trackNameLayout.addWidget(self.__trackName)
    optionsLayout.addLayout(trackNameLayout)

    self.__useClipsRadio = QtWidgets.QRadioButton("Match by Clip")
    self.__useShotsRadio = QtWidgets.QRadioButton("Match by Shot")
    optionsLayout.addWidget(self.__useClipsRadio)
    optionsLayout.addWidget(self.__useShotsRadio)

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

    context.access = context.kReadMultiple
    context.retention = context.kTransient
    specification = specifications.ShotSpecification()

    self.__shotParentPicker = self.__session.getManagerWidget(
        FnAssetAPI.ui.constants.kInlinePickerWidgetId, args=[specification, context])
    optionsLayout.addWidget(self.__shotParentPicker)

    # Buttons

    ## @todo disable the ok button if using shots and no valid entity ref

    self.__buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Ok
        | QtWidgets.QDialogButtonBox.Cancel)
    self.__buttons.button(QtWidgets.QDialogButtonBox.Ok).setText('Build')
    layout.addWidget(self.__buttons)

    # Connections

    self.__buttons.accepted.connect(self.accept)
    self.__buttons.rejected.connect(self.reject)

    self.__useShotsRadio.toggled.connect(self.__modeChanged)
    self.__useClipsRadio.toggled.connect(self.__modeChanged)

    self.__relationshipWidget.criteriaChanged.connect(self.__syncUI)
    # This might be better on editingFinished, but there is only one text field
    # some of the time so loosing focus might not happen as required
    self.__trackName.textChanged.connect(self.__syncUI)

    self.__shotParentPicker.selectionChanged.connect(self.__parentChanged)

    self.__syncUI()

    # Make sure the name field is ready for editing as we can't create without
    self.__trackName.setFocus()
コード例 #3
0
    def __init__(self, session, error_data, missing_assets_types,
                 duplicated_components):
        '''Return a validator widget for the given *error_data* and *missing_assets_types*.'''
        super(FtrackSettingsValidator, self).__init__()

        self.setWindowTitle('Validation error')
        self._session = session

        self.logger = logging.getLogger(__name__ + '.' +
                                        self.__class__.__name__)

        ftrack_icon = QtGui.QIcon(':/ftrack/image/default/ftrackLogoLight')
        self.setWindowIcon(ftrack_icon)

        layout = QtWidgets.QVBoxLayout()
        self.setLayout(layout)

        box = QtWidgets.QGroupBox(
            'An error occured in the current schema configuration.')

        self.layout().addWidget(box)

        box_layout = QtWidgets.QVBoxLayout()
        box.setLayout(box_layout)

        form_layout = TaskUIFormLayout()
        box_layout.addLayout(form_layout)
        if duplicated_components:

            form_layout.addDivider(
                '{} Duplicated components name have been found'.format(
                    len(duplicated_components)))

            for component_name, task in duplicated_components:

                ui_property = UIPropertyFactory.create(
                    type(component_name),
                    key='component_name',
                    value=component_name,
                    dictionary=task._preset.properties()['ftrack'],
                    label='Component ' + ':',
                    tooltip='Duplicated component name')
                ui_property.update(True)
                form_layout.addRow('Duplicated component' + ':', ui_property)

                if component_name != task.component_name():
                    component_index = duplicated_components.index(
                        (task.component_name(), task))
                    duplicated_components.pop(component_index)

        for processor, values in error_data.items():
            form_layout.addDivider('Wrong {0} presets'.format(
                processor.__class__.__name__))

            for attribute, valid_values in values.items():
                valid_values.insert(0, '- select a value -')
                key, value, label = attribute, valid_values, ' '.join(
                    attribute.split('_'))
                tooltip = 'Set {0} value'.format(attribute)

                ui_property = UIPropertyFactory.create(
                    type(value),
                    key=key,
                    value=value,
                    dictionary=processor._preset.properties()['ftrack'],
                    label=label + ':',
                    tooltip=tooltip)
                form_layout.addRow(label + ':', ui_property)
                ui_property.update(True)

        if missing_assets_types:
            form_layout.addDivider('Missing asset types')

            for missing_asset in missing_assets_types:
                create_asset_button = QtWidgets.QPushButton(
                    missing_asset.capitalize())
                create_asset_button.clicked.connect(self.create_missing_asset)
                form_layout.addRow('Create asset: ', create_asset_button)

        buttons = QtWidgets.QDialogButtonBox()
        buttons.setOrientation(QtCore.Qt.Horizontal)
        buttons.addButton('Cancel', QtWidgets.QDialogButtonBox.RejectRole)
        buttons.addButton('Accept', QtWidgets.QDialogButtonBox.AcceptRole)
        buttons.accepted.connect(self.accept)
        buttons.rejected.connect(self.reject)
        self.layout().addWidget(buttons)