def __init__(self, *args, **kw): '''Initialise line edit.''' self._actionButtons = [] self._iconSize = QtCore.QSize( LineEditIconButton.iconSize + 2, LineEditIconButton.iconSize + 2 ) self._iconRegion = QtCore.QSize( self._iconSize.width() + LineEditIconButton.iconMargin, self._iconSize.height() ) super(LineEdit, self).__init__(*args, **kw)
def _createTreeItem(self, item): t = super(AdvancedHieroItemSpreadsheet, self)._createTreeItem(item) if t: disabled = self._itemIsDisabled(item) icon = self._enabledIcon status = self._enabledText if disabled: icon = self._disabledIcon status = self._disabledText if self._textCallback: status = self._textCallback(item) if self._iconCallback: icon = self._iconCallback(item) if self._iconIndex > -1 and icon: t.setIcon(self._iconIndex, icon) if self._statusIndex > -1: t.setText(self._statusIndex, status) if self._disableItems: t.setDisabled(disabled) t.setSizeHint(self._statusIndex, QtCore.QSize(100, 22)) return t
def sizeHint(self, option, index): '''Return preferred size hint.''' options = QtWidgets.QStyleOptionViewItem(option) self.initStyleOption(options, index) data = index.data(role=QtCore.Qt.UserRole) document = self.getTextDocument(option, data) return QtCore.QSize(document.idealWidth(), document.size().height())
def resizeEvent(self, event): wrapper = self.findChild(QtWidgets.QWidget) flow = wrapper.findChild(FlowLayout) if wrapper and flow: width = self.viewport().width() height = flow.heightForWidth(width) size = QtCore.QSize(width, height) point = self.viewport().rect().topLeft() flow.setGeometry(QtCore.QRect(point, size)) self.viewport().update() super(ResizeScrollArea, self).resizeEvent(event)
def __init__(self, *args, **kwargs): '''Instantiate the entity selector widget.''' super(EntitySelector, self).__init__(*args, **kwargs) self._entity = None # Create widget used to select an entity. selectionWidget = QtWidgets.QFrame() selectionWidget.setLayout(QtWidgets.QHBoxLayout()) selectionWidget.layout().setContentsMargins(0, 0, 0, 0) self.insertWidget(0, selectionWidget) self.entityBrowser = _entity_browser.EntityBrowser(parent=self) self.entityBrowser.setMinimumSize(600, 400) self.entityBrowser.selectionChanged.connect( self._onEntityBrowserSelectionChanged) self.entityBrowseButton = QtWidgets.QPushButton('Browse') # TODO: Once the link is available through the API change this to a # combo with assigned tasks. self.assignedContextSelector = QtWidgets.QLineEdit() self.assignedContextSelector.setReadOnly(True) selectionWidget.layout().addWidget(self.assignedContextSelector) selectionWidget.layout().addWidget(self.entityBrowseButton) # Create widget used to present current selection. presentationWidget = QtWidgets.QFrame() presentationWidget.setLayout(QtWidgets.QHBoxLayout()) presentationWidget.layout().setContentsMargins(0, 0, 0, 0) self.insertWidget(1, presentationWidget) self.entityPath = _entity_path.EntityPath() presentationWidget.layout().addWidget(self.entityPath) self.discardEntityButton = QtWidgets.QPushButton() removeIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/light/remove')) self.discardEntityButton.setIconSize(QtCore.QSize(20, 20)) self.discardEntityButton.setIcon(removeIcon) self.discardEntityButton.setFixedWidth(20) self.discardEntityButton.clicked.connect( self._onDiscardEntityButtonClicked) presentationWidget.layout().addWidget(self.discardEntityButton) self.entityChanged.connect(self.entityPath.setEntity) self.entityChanged.connect(self._updateIndex) self.entityBrowseButton.clicked.connect( self._onEntityBrowseButtonClicked)
def sizeHint(self): '''Return preferred size hint.''' option = QtWidgets.QStyleOptionComboBox() self.initStyleOption(option) data = self.itemData(self.currentIndex()) # Get QTextDocument from delegate to use for calculating size hint. delegate = self.itemDelegate() document = delegate.getTextDocument(option, data) # Adjust the size to fix issue occurring on windows. size = QtCore.QSize(document.idealWidth(), document.size().height() + 5) return size
def create_overlay_widgets(self, congrat_text, success_text): '''Create overlay widgets to report publish result.''' self.activeWidget = QtWidgets.QWidget() self.activeWidget.setLayout(QtWidgets.QVBoxLayout()) self.layout().addWidget(self.activeWidget) main_layout = self.activeWidget.layout() icon = QtGui.QPixmap(':ftrack/image/default/ftrackLogoLabelNew') icon = icon.scaled(QtCore.QSize(85, 85), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) self.ftrack_icon = QtWidgets.QLabel() self.ftrack_icon.setPixmap(icon) main_layout.addStretch(1) main_layout.insertWidget(1, self.ftrack_icon, alignment=QtCore.Qt.AlignCenter) congrat_label = QtWidgets.QLabel(congrat_text) congrat_label.setAlignment(QtCore.Qt.AlignCenter) success_label = QtWidgets.QLabel(success_text) success_label.setAlignment(QtCore.Qt.AlignCenter) main_layout.addWidget(congrat_label) main_layout.addWidget(success_label) main_layout.addStretch(1) buttons_layout = QtWidgets.QHBoxLayout() main_layout.addLayout(buttons_layout) self.details_button = QtWidgets.QPushButton('Details') buttons_layout.addWidget(self.details_button) self.details_button.clicked.connect(self.on_show_details) if self.details_window_callback is None: self.details_button.setDisabled(True) self.open_in_ftrack = QtWidgets.QPushButton('Open in ftrack') buttons_layout.addWidget(self.open_in_ftrack) self.open_in_ftrack.clicked.connect(self.on_open_in_ftrack) if self.asset_version is None: self.open_in_ftrack.setDisabled(True)
def __init__(self, parent=None): '''Instantiate message widget.''' super(MessageBox, self).__init__(parent=parent) self.setObjectName('ftrack-message-box') self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setSpacing(0) self.main_layout.setAlignment(QtCore.Qt.AlignTop) self.setLayout(self.main_layout) self.label = QtWidgets.QLabel(parent=self) self.label.resize(QtCore.QSize(900, 80)) self.label.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.label.hide() self.label.setObjectName('ftrack-header-message-info') self.main_layout.addWidget(self.label)
def paintEvent(self, event): '''Handle paint *event*.''' painter = QtWidgets.QPainter(self) # Note: isDown should ideally use the 'active' state, but in most styles # this has no proper feedback. state = QtGui.QIcon.Disabled if self.isEnabled(): state = QtGui.QIcon.Normal if self.isDown(): state = QtGui.QIcon.Selected iconPixmap = self.icon().pixmap( QtCore.QSize(self.iconSize, self.iconSize), state, QtGui.QIcon.Off ) iconRegion = QtCore.QRect( 0, 0, iconPixmap.width(), iconPixmap.height() ) iconRegion.moveCenter(self.rect().center()) painter.drawPixmap(iconRegion, iconPixmap)
def setupUi(self, AssetManager): '''Setup ui for *AssetManager*.''' AssetManager.setObjectName('AssetManager') AssetManager.resize(549, 419) self.verticalLayout = QtWidgets.QVBoxLayout(AssetManager) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName('verticalLayout') self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName('horizontalLayout') self.AssetManagerComboBox = QtWidgets.QComboBox(AssetManager) self.AssetManagerComboBox.setMaximumSize(QtCore.QSize(120, 16777215)) self.AssetManagerComboBox.setObjectName('AssetManagerComboBox') self.horizontalLayout.addWidget(self.AssetManagerComboBox) self.versionDownButton = QtWidgets.QPushButton(AssetManager) self.versionDownButton.setMinimumSize(QtCore.QSize(20, 0)) self.versionDownButton.setMaximumSize(QtCore.QSize(20, 16777215)) self.versionDownButton.setObjectName('versionDownButton') self.horizontalLayout.addWidget(self.versionDownButton) self.versionUpButton = QtWidgets.QPushButton(AssetManager) self.versionUpButton.setMinimumSize(QtCore.QSize(20, 0)) self.versionUpButton.setMaximumSize(QtCore.QSize(20, 16777215)) self.versionUpButton.setObjectName('versionUpButton') self.horizontalLayout.addWidget(self.versionUpButton) self.latestButton = QtWidgets.QPushButton(AssetManager) self.latestButton.setMinimumSize(QtCore.QSize(60, 0)) self.latestButton.setMaximumSize(QtCore.QSize(60, 16777215)) self.latestButton.setObjectName('latestButton') self.horizontalLayout.addWidget(self.latestButton) self.selectAllButton = QtWidgets.QPushButton(AssetManager) self.selectAllButton.setMinimumSize(QtCore.QSize(80, 0)) self.selectAllButton.setMaximumSize(QtCore.QSize(80, 16777215)) self.selectAllButton.setObjectName('selectAllButton') self.horizontalLayout.addWidget(self.selectAllButton) self.menuButton = QtWidgets.QPushButton(AssetManager) self.menuButton.setMaximumSize(QtCore.QSize(70, 16777215)) self.menuButton.setObjectName('menuButton') self.horizontalLayout.addWidget(self.menuButton) self.whiteSpaceLabel = QtWidgets.QLabel(AssetManager) self.whiteSpaceLabel.setText('') self.whiteSpaceLabel.setObjectName('whiteSpaceLabel') self.horizontalLayout.addWidget(self.whiteSpaceLabel) self.refreshButton = QtWidgets.QPushButton(AssetManager) self.refreshButton.setMaximumSize(QtCore.QSize(80, 16777215)) self.refreshButton.setObjectName('refreshButton') self.horizontalLayout.addWidget(self.refreshButton) self.verticalLayout.addLayout(self.horizontalLayout) self.AssertManagerTableWidget = QtWidgets.QTableWidget(AssetManager) self.AssertManagerTableWidget.setFrameShape(QtWidgets.QFrame.Box) self.AssertManagerTableWidget.setFrameShadow(QtWidgets.QFrame.Sunken) self.AssertManagerTableWidget.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) self.AssertManagerTableWidget.setObjectName('AssertManagerTableWidget') self.AssertManagerTableWidget.setColumnCount(0) self.AssertManagerTableWidget.setRowCount(0) self.verticalLayout.addWidget(self.AssertManagerTableWidget) self.retranslateUi(AssetManager) # Connect signals. self.refreshButton.clicked.connect(AssetManager.refreshAssetManager) self.AssetManagerComboBox.currentIndexChanged[int].connect( AssetManager.filterAssets) self.versionDownButton.clicked.connect( AssetManager.versionDownSelected) self.versionUpButton.clicked.connect(AssetManager.versionUpSelected) self.latestButton.clicked.connect(AssetManager.versionLatestSelected) self.selectAllButton.clicked.connect(AssetManager.selectAll) QtCore.QMetaObject.connectSlotsByName(AssetManager)
def minimumSize(self): w = self.geometry().width() h = self.doLayout(QtCore.QRect(0, 0, w, 0), True) return QtCore.QSize(w, h)
def setupUi(self, ExportOptions): ExportOptions.setObjectName("ExportOptions") ExportOptions.resize(339, 266) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( ExportOptions.sizePolicy().hasHeightForWidth()) ExportOptions.setSizePolicy(sizePolicy) self.verticalLayout = QtWidgets.QVBoxLayout(ExportOptions) self.verticalLayout.setSpacing(3) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.optionsPlaceHolderLayout = QtWidgets.QHBoxLayout() self.optionsPlaceHolderLayout.setObjectName("optionsPlaceHolderLayout") self.verticalLayout.addLayout(self.optionsPlaceHolderLayout) self.label_4 = QtWidgets.QLabel(ExportOptions) self.label_4.setObjectName("label_4") self.verticalLayout.addWidget(self.label_4) self.gridLayout_4 = QtWidgets.QGridLayout() self.gridLayout_4.setObjectName("gridLayout_4") self.thumbnailLineEdit = QtWidgets.QLineEdit(ExportOptions) self.thumbnailLineEdit.setObjectName("thumbnailLineEdit") self.gridLayout_4.addWidget(self.thumbnailLineEdit, 2, 0, 1, 1) self.pushButton = QtWidgets.QPushButton(ExportOptions) self.pushButton.setObjectName("pushButton") self.gridLayout_4.addWidget(self.pushButton, 2, 1, 1, 1) self.screenshotButton = QtWidgets.QPushButton(ExportOptions) self.screenshotButton.setObjectName("screenshotButton") self.gridLayout_4.addWidget(self.screenshotButton, 2, 2, 1, 1) self.verticalLayout.addLayout(self.gridLayout_4) self.label_5 = QtWidgets.QLabel(ExportOptions) self.label_5.setObjectName("label_5") self.verticalLayout.addWidget(self.label_5) self.commentTextEdit = QtWidgets.QPlainTextEdit(ExportOptions) self.commentTextEdit.setMaximumSize(QtCore.QSize(16777215, 80)) self.commentTextEdit.setObjectName("commentTextEdit") self.verticalLayout.addWidget(self.commentTextEdit) self.publishButton = QtWidgets.QPushButton(ExportOptions) self.publishButton.setObjectName("publishButton") self.verticalLayout.addWidget(self.publishButton) self.progressBar = QtWidgets.QProgressBar(ExportOptions) self.progressBar.setProperty("value", 24) self.progressBar.setObjectName("progressBar") self.verticalLayout.addWidget(self.progressBar) self.publishMessageLabel = QtWidgets.QLabel(ExportOptions) self.publishMessageLabel.setText("") self.publishMessageLabel.setObjectName("publishMessageLabel") self.verticalLayout.addWidget(self.publishMessageLabel) spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.retranslateUi(ExportOptions) QtCore.QObject.connect(self.pushButton, QtCore.SIGNAL("clicked()"), ExportOptions.setThumbnailFilename) QtCore.QObject.connect(self.screenshotButton, QtCore.SIGNAL("clicked()"), ExportOptions.takeScreenshot) QtCore.QMetaObject.connectSlotsByName(ExportOptions)
def __init__(self, actions, parent=None): '''Initialize action item with *actions* *actions* should be a list of action dictionaries with the same label. Each action may contain a the following: label To be displayed as text icon An URL to an image or one of the provided icons. variant A variant of the action. Will be shown in the menu shown for multiple actions, or as part of the label for a single action. description A optional description of the action to be shown on hover. Label, icon and description will be retrieved from the first action if multiple actions are specified. ''' super(ActionItem, self).__init__(parent=parent) self.logger = logging.getLogger(__name__ + '.' + self.__class__.__name__) self.setMouseTracking(True) self.setFixedSize(QtCore.QSize(80, 80)) layout = QtWidgets.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignCenter) layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) if not actions: raise ValueError('No actions specified') self._actions = actions self._label = actions[0].get('label', 'Untitled action') self._icon = actions[0].get('icon', None) self._description = actions[0].get('description', None) self._variants = [ u'{0} {1}'.format(action.get('label', 'Untitled action'), action.get('variant', '')).strip() for action in actions ] if len(actions) == 1: if actions[0].get('variant'): self._label = u'{0} {1}'.format(self._label, actions[0].get('variant')) self._hoverIcon = 'play' self._multiple = False else: self._hoverIcon = 'menu' self._multiple = True self._iconLabel = ActionIcon(self) self._iconLabel.setAlignment(QtCore.Qt.AlignCenter) self._iconLabel.setFixedSize(QtCore.QSize(80, 45)) layout.addWidget(self._iconLabel) self._textLabel = QtWidgets.QLabel(self) self._textLabel.setAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignTop) self._textLabel.setWordWrap(True) self._textLabel.setFixedSize(QtCore.QSize(80, 35)) layout.addWidget(self._textLabel) self.setText(self._label) self.setIcon(self._icon) if self._description: self.setToolTip(self._description)
def __init__(self, session, parent): '''Instantiate with *session*.''' super(CreateAssetTypeOverlay, self).__init__(parent=parent) self.session = session self.main_layout = QtWidgets.QVBoxLayout() self.setLayout(self.main_layout) icon = QtGui.QPixmap(':ftrack/image/default/ftrackLogoColor') icon = icon.scaled(QtCore.QSize(85, 85), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) self.ftrack_icon = QtWidgets.QLabel() self.ftrack_icon.setPixmap(icon) self.main_layout.addStretch(1) self.main_layout.insertWidget(1, self.ftrack_icon, alignment=QtCore.Qt.AlignCenter) self.main_layout.addStretch(1) self.main_layout.setContentsMargins(20, 20, 20, 20) # create asset type widget self.create_asset_widget = QtWidgets.QFrame() self.create_asset_widget.setVisible(False) create_asset_layout = QtWidgets.QVBoxLayout() create_asset_layout.setContentsMargins(20, 20, 20, 20) create_asset_layout.addStretch(1) buttons_layout = QtWidgets.QHBoxLayout() self.create_asset_widget.setLayout(create_asset_layout) self.create_asset_label_top = QtWidgets.QLabel() self.create_asset_label_bottom = QtWidgets.QLabel( '<h4>Do you want to create one ?</h4>') create_asset_layout.insertWidget(1, self.create_asset_label_top, alignment=QtCore.Qt.AlignCenter) create_asset_layout.insertWidget(2, self.create_asset_label_bottom, alignment=QtCore.Qt.AlignCenter) self.create_asset_button = QtWidgets.QPushButton('Create') self.cancel_asset_button = QtWidgets.QPushButton('Cancel') create_asset_layout.addLayout(buttons_layout) buttons_layout.addWidget(self.create_asset_button) buttons_layout.addWidget(self.cancel_asset_button) # result create asset type self.create_asset_widget_result = QtWidgets.QFrame() self.create_asset_widget_result.setVisible(False) create_asset_layout_result = QtWidgets.QVBoxLayout() create_asset_layout_result.setContentsMargins(20, 20, 20, 20) create_asset_layout_result.addStretch(1) self.create_asset_widget_result.setLayout(create_asset_layout_result) self.create_asset_label_result = QtWidgets.QLabel() self.continue_button = QtWidgets.QPushButton('Continue') create_asset_layout_result.insertWidget( 1, self.create_asset_label_result, alignment=QtCore.Qt.AlignCenter) create_asset_layout_result.insertWidget( 2, self.continue_button, alignment=QtCore.Qt.AlignCenter) # error on create asset self.create_asset_widget_error = QtWidgets.QFrame() self.create_asset_widget_error.setVisible(False) create_asset_layout_error = QtWidgets.QVBoxLayout() create_asset_layout_error.setContentsMargins(20, 20, 20, 20) create_asset_layout_error.addStretch(1) self.create_asset_widget_error.setLayout(create_asset_layout_error) self.create_asset_label_error = QtWidgets.QLabel() self.close_button = QtWidgets.QPushButton('Close') create_asset_layout_error.insertWidget(1, self.create_asset_label_error, alignment=QtCore.Qt.AlignCenter) create_asset_layout_error.insertWidget(2, self.close_button, alignment=QtCore.Qt.AlignCenter) # parent all. self.main_layout.addWidget(self.create_asset_widget) self.main_layout.addWidget(self.create_asset_widget_result) self.main_layout.addWidget(self.create_asset_widget_error) self.main_layout.addStretch(1) # signals self.create_asset_button.clicked.connect(self.on_create_asset) self.continue_button.clicked.connect(self.on_continue) self.close_button.clicked.connect(self.on_fail) self.cancel_asset_button.clicked.connect(self.on_fail)
def loadResource(self, resource): '''Update current pixmap using *resource*.''' pixmap = QtGui.QPixmap(QtCore.QSize(self.width(), self.height())) pixmap.load(resource) self._scaleAndSetPixmap(pixmap)
def setupUi(self, ExportAssetOptions): ExportAssetOptions.setObjectName("ExportAssetOptions") ExportAssetOptions.resize(429, 130) self.verticalLayout = QtWidgets.QVBoxLayout(ExportAssetOptions) self.verticalLayout.setSpacing(3) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName("gridLayout") self.assetTaskLabel = QtWidgets.QLabel(ExportAssetOptions) self.assetTaskLabel.setMinimumSize(QtCore.QSize(120, 0)) self.assetTaskLabel.setMaximumSize(QtCore.QSize(120, 16777215)) self.assetTaskLabel.setObjectName("assetTaskLabel") self.gridLayout.addWidget(self.assetTaskLabel, 1, 0, 1, 1) self.ListAssetsComboBox = QtWidgets.QComboBox(ExportAssetOptions) self.ListAssetsComboBox.setMinimumSize(QtCore.QSize(100, 0)) self.ListAssetsComboBox.setMaximumSize(QtCore.QSize(200, 16777215)) self.ListAssetsComboBox.setObjectName("ListAssetsComboBox") self.gridLayout.addWidget(self.ListAssetsComboBox, 0, 1, 1, 1) self.ListAssetNamesComboBox = QtWidgets.QComboBox(ExportAssetOptions) self.ListAssetNamesComboBox.setMinimumSize(QtCore.QSize(100, 0)) self.ListAssetNamesComboBox.setMaximumSize(QtCore.QSize(200, 16777215)) self.ListAssetNamesComboBox.setObjectName("ListAssetNamesComboBox") self.gridLayout.addWidget(self.ListAssetNamesComboBox, 3, 1, 1, 1) self.AssetNameLineEdit = QtWidgets.QLineEdit(ExportAssetOptions) self.AssetNameLineEdit.setEnabled(True) self.AssetNameLineEdit.setMinimumSize(QtCore.QSize(100, 0)) self.AssetNameLineEdit.setMaximumSize(QtCore.QSize(200, 16777215)) self.AssetNameLineEdit.setObjectName("AssetNameLineEdit") self.gridLayout.addWidget(self.AssetNameLineEdit, 4, 1, 1, 1) self.AssetTaskComboBox = QtWidgets.QComboBox(ExportAssetOptions) self.AssetTaskComboBox.setMinimumSize(QtCore.QSize(100, 0)) self.AssetTaskComboBox.setMaximumSize(QtCore.QSize(200, 16777215)) self.AssetTaskComboBox.setObjectName("AssetTaskComboBox") self.gridLayout.addWidget(self.AssetTaskComboBox, 1, 1, 1, 1) self.labelAssetType = QtWidgets.QLabel(ExportAssetOptions) self.labelAssetType.setMinimumSize(QtCore.QSize(120, 0)) self.labelAssetType.setMaximumSize(QtCore.QSize(120, 16777215)) self.labelAssetType.setObjectName("labelAssetType") self.gridLayout.addWidget(self.labelAssetType, 0, 0, 1, 1) self.assetNameLabel = QtWidgets.QLabel(ExportAssetOptions) self.assetNameLabel.setMinimumSize(QtCore.QSize(120, 0)) self.assetNameLabel.setMaximumSize(QtCore.QSize(120, 16777215)) self.assetNameLabel.setObjectName("assetNameLabel") self.gridLayout.addWidget(self.assetNameLabel, 4, 0, 1, 1) spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem, 0, 2, 1, 1) self.label_2 = QtWidgets.QLabel(ExportAssetOptions) self.label_2.setMinimumSize(QtCore.QSize(120, 0)) self.label_2.setMaximumSize(QtCore.QSize(120, 16777215)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 3, 0, 1, 1) self.assetTaskLabel_2 = QtWidgets.QLabel(ExportAssetOptions) self.assetTaskLabel_2.setMinimumSize(QtCore.QSize(120, 0)) self.assetTaskLabel_2.setMaximumSize(QtCore.QSize(120, 16777215)) self.assetTaskLabel_2.setObjectName("assetTaskLabel_2") self.gridLayout.addWidget(self.assetTaskLabel_2, 2, 0, 1, 1) self.ListStatusComboBox = QtWidgets.QComboBox(ExportAssetOptions) self.ListStatusComboBox.setMinimumSize(QtCore.QSize(100, 0)) self.ListStatusComboBox.setMaximumSize(QtCore.QSize(200, 16777215)) self.ListStatusComboBox.setObjectName("ListStatusComboBox") self.gridLayout.addWidget(self.ListStatusComboBox, 2, 1, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.retranslateUi(ExportAssetOptions) self.ListAssetsComboBox.currentIndexChanged[int].connect( ExportAssetOptions.setFilter) self.ListAssetsComboBox.currentIndexChanged[int].connect( ExportAssetOptions.emitAssetType) QtCore.QMetaObject.connectSlotsByName(ExportAssetOptions)
def _buildClipsTree(self, shotItems, parentEntity, sharedParentEntity, context): tickIcon = QtGui.QIcon("icons:TagGood.png") crossIcon = QtGui.QIcon("icons:status/TagBad.png") blockIcon = QtGui.QIcon("icons:status/TagOnHold.png") addIcon = QtGui.QIcon("icons:Add.png") l = FnAssetAPI.l shotParentTreeItem = GroupingTreeItem() shotParentTreeItem.setSizeHint(0, QtCore.QSize(300, 22)) shotParentTreeItem.setSizeHint(1, QtCore.QSize(120, 22)) shotParentTreeItem.setSizeHint(4, QtCore.QSize(120, 22)) shotParentTreeItem.setEntity(parentEntity, context) boldFont = shotParentTreeItem.font(0) boldFont.setBold(True) italicFont = shotParentTreeItem.font(0) italicFont.setItalic(True) shotParentTreeItem.setFont(0, boldFont) newShots, existingShots, unused = cmdUtils.shot.analyzeHieroShotItems( shotItems, parentEntity, context, checkForConflicts=False) clips, sharedClips = cmdUtils.shot.analyzeHeiroShotItemClips( shotItems, asItems=False) ignorePublished = self.__options.get('ignorePublishedClips', True) publishShared = self.__options.get('publishSharedClips', False) customName = '' if self.__options.get('clipsUseCustomName', False): customName = self.__options.get('customClipName', '') processsedSharedClips = set() allSharedClips = [] for s in shotItems: shotTreeItem = GroupingTreeItem() shotTreeItem.setItem(s) shotTreeItem.setText(1, l("{shot}")) status = "" shotDisabled = False if s in newShots: status = l("Unable to find matching {shot}") shotDisabled = True shotTreeItem.setIcon(2, blockIcon) shotTreeItem.setText(3, status) clips = cmdUtils.shot.clipsFromHieroShotTrackItem(s) for c in clips: clipItem = items.HieroClipItem(c) clipIsAssetised = bool(clipItem.getEntity()) clipTreeItem = ClipTreeItem() clipTreeItem.setItem(clipItem) status = l("{publish}") disabled = False icon = addIcon if clipIsAssetised: if ignorePublished: status = l("Already {published}") disabled = True icon = tickIcon else: status = l("{publish} New Version") clipTreeItem.setText(3, status) clipTreeItem.setDisabled(disabled) clipTreeItem.setIcon(2, icon) clipTreeItem.setText(1, "Clip") if c in sharedClips: clipTreeItem.setText(1, "Shared Clip") if c not in processsedSharedClips: if publishShared: if not clipIsAssetised or (clipIsAssetised and not ignorePublished): if not shotDisabled: allSharedClips.append(clipTreeItem) processsedSharedClips.add(c) placeholderTreeItem = ClipTreeItem() placeholderTreeItem.setItem(clipItem) placeholderTreeItem.setText(1, "Shared Clip") placeholderTreeItem.setFont(0, italicFont) if not clipTreeItem.isDisabled(): if publishShared: if sharedParentEntity: msg = l("{publish} to '%s'") % sharedParentEntity.getName(context) icon = tickIcon else: msg = "No Shared Clip destination chosen" icon = blockIcon placeholderTreeItem.setText(3, msg) else: placeholderTreeItem.setText(3, l("Shared Clip {publish} disabled")) icon = crossIcon else: placeholderTreeItem.setText(3, clipTreeItem.text(3)) placeholderTreeItem.setIcon(2, icon) if shotDisabled: placeholderTreeItem.setText(3, '') placeholderTreeItem.setIcon(2, QtGui.QIcon()) placeholderTreeItem.setDisabled(True) shotTreeItem.addChild(placeholderTreeItem) else: if shotDisabled: clipTreeItem.setText(3, '') clipTreeItem.setIcon(2, QtGui.QIcon()) clipTreeItem.setDisabled(True) if customName and len(clips)==1: origName = clipTreeItem.text(0) clipTreeItem.setText(4, origName) clipTreeItem.setText(0, customName) shotTreeItem.addChild(clipTreeItem) if shotDisabled: shotTreeItem.setDisabled(True) shotTreeItem.stopExpand = shotDisabled shotParentTreeItem.addChild(shotTreeItem) # We need to figure out if our sharedParentEntity is either the same # as parentEntity, or one of its (for now, immediate) children. sharedInTree = False sharedParentTreeItem = None if sharedParentEntity: if parentEntity.reference == sharedParentEntity.reference: sharedParentTreeItem = shotParentTreeItem sharedInTree = True else: for i in range(shotParentTreeItem.childCount()): treeItem = shotParentTreeItem.child(i) shotEntity = treeItem.entity if shotEntity and shotEntity.reference == sharedParentEntity.reference: sharedParentTreeItem = treeItem sharedInTree = True break if sharedParentEntity and not sharedParentTreeItem: sharedParentTreeItem = GroupingTreeItem() sharedParentTreeItem.setFont(0, boldFont) sharedParentTreeItem.setEntity(sharedParentEntity, context) if allSharedClips and sharedParentTreeItem: sharedParentTreeItem.insertChildren(0, allSharedClips) treeItems = [] treeItems.append(shotParentTreeItem) if sharedParentTreeItem and not sharedInTree: treeItems.append(sharedParentTreeItem) return treeItems
def sizeHint(self): return QtCore.QSize(400, 300)
def sizeHint(self): return QtCore.QSize(700, 500)