def __init__(self, username, parent=None): '''Instantiate the header widget for a user with *username*.''' super(Header, self).__init__(parent=parent) self.setObjectName('ftrack-header-widget') self.main_layout = QtWidgets.QVBoxLayout() self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setAlignment(QtCore.Qt.AlignTop) self.setLayout(self.main_layout) # Logo & User ID self.id_container = QtWidgets.QWidget(self) self.id_container_layout = QtWidgets.QHBoxLayout() self.id_container_layout.setContentsMargins(0, 0, 0, 0) self.id_container_layout.setSpacing(0) self.id_container_layout.setAlignment(QtCore.Qt.AlignTop) self.id_container.setLayout(self.id_container_layout) spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.logo = Logo(self) self.user = User(username, self) self.id_container_layout.addWidget(self.logo) self.id_container_layout.addItem(spacer) self.id_container_layout.addWidget(self.user) # Message self.message_container = QtWidgets.QWidget(self) self.message_container.hide() self.message_container_layout = QtWidgets.QHBoxLayout() self.message_container_layout.setContentsMargins(0, 0, 0, 0) self.message_container_layout.setSpacing(0) self.message_container.setLayout(self.message_container_layout) self.message_box = MessageBox(self) self.message_container_layout.addWidget(self.message_box) # Add (Logo & User ID) & Message self.main_layout.addWidget(self.id_container) self.main_layout.addWidget(self.message_container)
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, parent=None, connector=None, currentEntity=None): if not connector: raise ValueError( 'Please provide a connector object for {0}'.format( self.__class__.__name__ ) ) self.connector = connector if not parent: self.parent = self.connector.getMainWindow() self.currentEntity = currentEntity super(PublishAssetDialog, self).__init__(self.parent) self.setSizePolicy( QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding ) ) applyTheme(self, 'integration') self.assetType = None self.assetName = None self.status = None self.mainLayout = QtWidgets.QVBoxLayout(self) self.mainLayout.setContentsMargins(0, 0, 0, 0) self.mainWidget = QtWidgets.QWidget(self) self.scrollLayout = QtWidgets.QVBoxLayout(self.mainWidget) self.scrollLayout.setSpacing(6) self.scrollArea = QtWidgets.QScrollArea(self) self.mainLayout.addWidget(self.scrollArea) self.scrollArea.setWidgetResizable(True) self.scrollArea.setObjectName("scrollArea") self.scrollArea.setLineWidth(0) self.scrollArea.setFrameShape(QtWidgets.QFrame.NoFrame) self.scrollArea.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff ) self.scrollArea.setWidget(self.mainWidget) self.headerWidget = header.Header(getpass.getuser(), self) self.scrollLayout.addWidget(self.headerWidget) if 'FTRACK_TASKID' in os.environ: self.browseMode = 'Task' else: self.browseMode = 'Shot' self.browseTasksWidget = ContextSelector( currentEntity=self.currentEntity, parent=self ) self.scrollLayout.addWidget(self.browseTasksWidget) self.exportAssetOptionsWidget = ExportAssetOptionsWidget( self, browseMode=self.browseMode ) self.scrollLayout.addWidget(self.exportAssetOptionsWidget) self.exportOptionsWidget = ExportOptionsWidget( self, connector=self.connector ) self.scrollLayout.addWidget(self.exportOptionsWidget) spacerItem = QtWidgets.QSpacerItem( 20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding ) self.scrollLayout.addItem(spacerItem) self.setObjectName('ftrackPublishAsset') self.setWindowTitle("ftrackPublishAsset") panelComInstance = ftrack_connector.panelcom.PanelComInstance.instance() panelComInstance.addSwitchedShotListener(self.reset_context_browser) panelComInstance.addSwitchedShotListener(self.resetOptions) self.exportAssetOptionsWidget.clickedAssetTypeSignal.connect( self.exportOptionsWidget.setStackedWidget ) self.browseTasksWidget.entityChanged.connect( self.exportAssetOptionsWidget.updateView ) self.exportOptionsWidget.ui.publishButton.clicked.connect( self.publishAsset ) panelComInstance.publishProgressSignal.connect( self.exportOptionsWidget.setProgress ) self.browseTasksWidget.reset()
def initStackedOptions(self, xmlstring, fromFile=False): '''Initiate stacked options widget with *xmlstring*.''' self.stackedIndex = dict() self.stackedOptions = dict() doc = QtXml.QDomDocument('optionsDocument') if fromFile: pass else: doc.setContent(xmlstring) assetTypeElements = doc.elementsByTagName('assettype') assetTypePages = dict() connectorName = self.connector.getConnectorName() maxRowCount = 0 for i in range(assetTypeElements.length()): assetTypePages[i] = QtWidgets.QWidget() assetTypePages[i].setObjectName('page' + str(i)) assetTypeElement = assetTypeElements.item(i).toElement() mainLayout = QtWidgets.QVBoxLayout() mainLayout.setContentsMargins(0, 0, 0, 0) mainLayout.setSpacing(0) assetTypePages[i].setLayout(mainLayout) assetTypeName = assetTypeElement.attribute('name') self.stackedIndex[assetTypeName] = i self.stackedOptions[assetTypeName] = [] tabElements = assetTypeElement.elementsByTagName('tab') if tabElements.length() > 0: tabWidget = QtWidgets.QTabWidget() mainLayout.addWidget(tabWidget) for j in range(tabElements.length()): tab = QtWidgets.QWidget() tabLayout = QtWidgets.QVBoxLayout() tabLayout.setSpacing(2) tab.setLayout(tabLayout) tabElement = tabElements.item(j).toElement() tabName = tabElement.attribute('name') tabEnabled = tabElement.attribute('enabled') if tabEnabled == 'False': tab.setEnabled(False) accepts = tabElement.attribute('accepts') acceptsSplit = accepts.split(',') if accepts == '' or connectorName in acceptsSplit: rowElements = tabElement.elementsByTagName('row') rowCount = 0 for k in range(rowElements.length()): rowElement = rowElements.item(k).toElement() rowLayout, optionsCount = self.parseRow( rowElement, connectorName, mainLayout, assetTypeName) if rowLayout: rowCount += optionsCount tabLayout.addLayout(rowLayout) maxRowCount = max(rowCount, maxRowCount) tabWidget.addTab(tab, tabName) spacerItem3 = QtWidgets.QSpacerItem( 1, 1, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) tabLayout.addItem(spacerItem3) self.addWidget(assetTypePages[i])
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)