def _buildShotsTab(self): l = FnAssetAPI.l # > Shots Tab shotsWidget = QtGui.QWidget() shotsWidget.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) shotsWidgetLayout = QtGui.QVBoxLayout() shotsWidgetLayout.setAlignment(QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop) shotsWidget.setLayout(shotsWidgetLayout) self._tickIcon = QtGui.QIcon("icons:TagGood.png") self._actionIcon = QtGui.QIcon("icons:Add.png") self._shotsList = AdvancedHieroItemSpreadsheet() self._shotsList.setAlternatingRowColors(True) self._shotsList.setIcons(self._actionIcon, self._tickIcon) self._shotsList.setHiddenProperties(("nameHint",)) self._shotsList.setForcedProperties( ("startFrame", "endFrame", "inFrame", "outFrame")) self._shotsList.setStatusText(l("New {shot}"), l("Existing {shot}")) self._shotsList.setDisabledCallback(self.__shotItemIsDisabled) shotsWidgetLayout.addWidget(self._shotsList) # See if we have any options from the manager shotSpec = ShotSpecification() self._managerOptionsShot = self._session.getManagerWidget( FnAssetAPI.ui.constants.kRegistrationManagerOptionsWidgetId, throw=False, args=(shotSpec, self._context)) if self._managerOptionsShot: shotsWidgetLayout.addWidget(self._managerOptionsShot) shotsWidgetLayout.addSpacing(10) # Length Options self._shotLengthGBox = QtGui.QGroupBox("Set Shot Timings from Hiero") self._shotLengthGBox.setCheckable(True) self._shotLengthGBox.setChecked(False) slGbLayout = QtGui.QHBoxLayout() self._shotLengthGBox.setLayout(slGbLayout) self._shotLengthOptionsWidget = TrackItemTimingOptionsWidget() slGbLayout.addWidget(self._shotLengthOptionsWidget) slGbLayout.addStretch() shotsWidgetLayout.addWidget(self._shotLengthGBox) return shotsWidget
def __init__(self, context, parent=None, options=None): super(UpdateShotsWidget, self).__init__(parent=parent) self._tickIcon = QtGui.QIcon("icons:TagGood.png") self._crossIcon = QtGui.QIcon("icons:SwapInputs.png") self._blockIcon = QtGui.QIcon("icons:status/TagOnHold.png") self.__updatingOptions = False self.__trackItems = [] self.__shotItems = [] self.__options = { self.kTargetEntityRef : '', self.kUpdateConflictingShots : True, self.kSetShotTimings : True } self._session = FnAssetAPI.ui.UISessionManager.currentSession() self._context = context # Note, this is a reference self._context.access = context.kWriteMultiple # We'll need to keep track of some lookups to avoid excess traffic self._parentEntity = None self._newShots = [] self._existingShots = [] self._conflictingShots = [] layout = QtGui.QVBoxLayout() self.setLayout(layout) self._buildUI(layout) self._connectUI() if options: self.setOptions(options) else: self._readOptions()
def _populateBookmarks(self): '''Populate bookmarks view.''' # TODO: Extract bookmarks to separate widget. # For now just display non-editable list of projects from ftrack. projects = ftrack.getProjects() self._bookmarksView.setRowCount(len(projects)) # Sort projects by display name. projects = sorted(projects, key=lambda project: project.getName()) for index, project in enumerate(projects): item = QtWidgets.QTableWidgetItem(project.getName()) item.setData(QtCore.Qt.UserRole, project.getEntityRef()) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(':icon-home'), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon) self._bookmarksView.setItem(index, 0, item)
def _getIcon(self, entity): '''Retrieve appropriate icon for *entity*.''' iconPath = None if isinstance(entity, ftrack.Project): iconPath = ':icon-home' elif isinstance(entity, ftrack.Task): objectType = entity.getObjectType() if objectType == 'Sequence': iconPath = ':icon-folder_open' elif objectType == 'Shot': iconPath = ':icon-movie' elif objectType == 'Task': iconPath = ':icon-signup' elif objectType == 'Asset Build': iconPath = ':icon-box' elif objectType is None: # Check for asset build id until getObjectType fixed if (entity.get('object_typeid') == 'ab77c654-df17-11e2-b2f3-20c9d0831e59'): iconPath = ':icon-box' elif isinstance(entity, ftrack.Asset): iconPath = ':icon-layers' if iconPath: icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(iconPath), QtGui.QIcon.Normal, QtGui.QIcon.Off) return icon return None
def _build(self): '''Build and layout widget.''' layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # Header header = ftrack_connect.ui.widget.header.Header( getpass.getuser(), self) header.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) layout.addWidget(header) secondaryHeader = QtWidgets.QFrame() headerLayout = QtWidgets.QHBoxLayout() headerLayout.setContentsMargins(0, 0, 0, 0) secondaryHeader.setLayout(headerLayout) layout.addWidget(secondaryHeader) self._createButton = QtWidgets.QToolButton() self._createButton.setIcon( QtGui.QIcon.fromTheme('plus', QtGui.QIcon(':icon-plus'))) headerLayout.addWidget(self._createButton) self._navigateUpButton = QtWidgets.QToolButton() self._navigateUpButton.setIcon( QtGui.QIcon.fromTheme('go-up', QtGui.QIcon(':icon-arrow-up'))) headerLayout.addWidget(self._navigateUpButton) headerLayout.addStretch(1) # Bookmarks contentSplitter = QtWidgets.QSplitter() layout.addWidget(contentSplitter) self._bookmarksView = QtWidgets.QTableWidget() self._bookmarksView.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._bookmarksView.setGridStyle(QtCore.Qt.NoPen) self._bookmarksView.setColumnCount(1) self._bookmarksView.setColumnCount(1) self._bookmarksView.setRowCount(0) self._bookmarksView.horizontalHeader().setVisible(False) self._bookmarksView.horizontalHeader().setStretchLastSection(True) self._bookmarksView.verticalHeader().setVisible(False) self._bookmarksView.verticalHeader().setDefaultSectionSize(25) contentSplitter.addWidget(self._bookmarksView) # Navigation self._navigator = QtWidgets.QTableWidget() self._navigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._navigator.setGridStyle(QtCore.Qt.NoPen) self._navigator.setColumnCount(1) self._navigator.horizontalHeader().setStretchLastSection(True) self._navigator.verticalHeader().hide() self._navigator.setHorizontalHeaderLabels(['Name']) contentSplitter.addWidget(self._navigator) self._versionsNavigator = QtWidgets.QTableWidget() self._versionsNavigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._versionsNavigator.setGridStyle(QtCore.Qt.NoPen) self._versionsNavigator.setColumnCount(1) self._versionsNavigator.verticalHeader().hide() self._versionsNavigator.setSortingEnabled(False) self._versionsNavigator.setHorizontalHeaderLabels(['Version']) contentSplitter.addWidget(self._versionsNavigator) self._componentsNavigator = QtWidgets.QTableWidget() self._componentsNavigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._componentsNavigator.setColumnCount(1) self._componentsNavigator.horizontalHeader().setStretchLastSection( True) self._componentsNavigator.verticalHeader().hide() self._componentsNavigator.verticalHeader().setStretchLastSection(False) self._componentsNavigator.setHorizontalHeaderLabels(['Component']) contentSplitter.addWidget(self._componentsNavigator) # Details self._detailView = ftrack_connect_foundry.ui.detail_view.DetailView( self._bridge) contentSplitter.addWidget(self._detailView) # Location self._locationField = QtWidgets.QLineEdit() layout.addWidget(self._locationField) self._locationOptions = QtWidgets.QFrame() layout.addWidget(self._locationOptions) locationOptionsLayout = QtWidgets.QHBoxLayout() locationOptionsLayout.setContentsMargins(0, 0, 0, 0) self._locationOptions.setLayout(locationOptionsLayout) self._assetNameField = QtWidgets.QLineEdit() self._assetNameField.setEnabled(False) locationOptionsLayout.addWidget(self._assetNameField) self._overrideNameHintOption = QtWidgets.QCheckBox( 'Specify Asset Name') locationOptionsLayout.addWidget(self._overrideNameHintOption)