def __init__( self, name, userId, group=None, applications=None, parent=None ): '''Initialise widget with initial component *value* and *parent*.''' super(User, self).__init__(parent) if applications is None: applications = {} self._userId = userId self._applications = applications self._group = group self.setObjectName('user') self.setLayout(QtWidgets.QHBoxLayout()) self.thumbnail = ftrack_connect.ui.widget.thumbnail.User() self.thumbnail.setFixedWidth(30) self.thumbnail.setFixedHeight(30) self.thumbnail.load(userId) self.layout().addWidget(self.thumbnail) self.layout().setContentsMargins(0, 0, 0, 0) nameAndActivity = QtWidgets.QWidget() nameAndActivity.setLayout(QtWidgets.QVBoxLayout()) nameAndActivity.layout().setContentsMargins(0, 0, 0, 0) self.countLabel = QtWidgets.QLabel() self.countLabel.setObjectName('user-conversation-count') self.countLabel.hide() self.nameLabel = ftrack_connect.ui.widget.label.Label() self.nameLabel.setText(name) self.nameLabel.setObjectName('name') nameAndActivity.layout().addWidget(self.nameLabel) self.activityLabel = ftrack_connect.ui.widget.label.Label() self.activityLabel.setObjectName('user-activity') self.nameAndCountLayout = QtWidgets.QHBoxLayout() self.nameAndCountLayout.addWidget(self.nameLabel, stretch=1) self.nameAndCountLayout.addWidget(self.countLabel, stretch=0) self.nameAndCountLayout.addSpacing(5) nameAndActivity.layout().addLayout(self.nameAndCountLayout) nameAndActivity.layout().addWidget(self.activityLabel) self.layout().addWidget(nameAndActivity) self._refreshStyles() self._updateActivity()
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 __init__(self, *args, **kwargs): '''Initialise widget.''' super(ThumbnailDropZone, self).__init__(*args, **kwargs) self.setObjectName('ftrack-connect-thumbnail-drop-zone') layout = QtWidgets.QHBoxLayout() layout.addSpacing(0) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.setAcceptDrops(True) self.setProperty('ftrackDropZone', True) self._filePath = None self._imageWidth = 200 self._imageHeight = 50 self.imageLabel = QtWidgets.QLabel() self.setDropZoneText() layout.addWidget(self.imageLabel, alignment=QtCore.Qt.AlignLeft) # TODO: Add theme support. removeIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/light/trash')) self.removeButton = QtWidgets.QPushButton() self.removeButton.setVisible(False) self.removeButton.setFlat(True) self.removeButton.setIcon(removeIcon) self.removeButton.clicked.connect(self.removeThumbnail) layout.addWidget(self.removeButton, alignment=QtCore.Qt.AlignRight)
def __init__(self, currentEntity, parent=None): '''Initialise with the *currentEntity* and *parent* widget.''' super(ContextSelector, self).__init__(parent=parent) self.setObjectName('context-selector-widget') self._entity = currentEntity self.entityBrowser = EntityBrowser() self.entityBrowser.setMinimumWidth(600) self.entityPath = EntityPath() self.entityBrowseButton = QtWidgets.QPushButton('Change') self.entityBrowseButton.setFixedWidth(110) self.entityBrowseButton.setFixedHeight(35) layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(10, 0, 10, 0) self.setMinimumHeight(50) self.setLayout(layout) layout.addWidget(self.entityPath) layout.addWidget(self.entityBrowseButton) self.entityBrowseButton.clicked.connect( self._onEntityBrowseButtonClicked ) self.entityChanged.connect(self.entityPath.setEntity) self.entityBrowser.selectionChanged.connect( self._onEntityBrowserSelectionChanged ) self.setEntity(self._entity)
def parseRow(self, rowElement, connectorName, mainLayout, assetTypeName): '''Parse xml *rowElement*.''' accepts = rowElement.attribute('accepts') acceptsSplit = accepts.split(',') if accepts == '' or connectorName in acceptsSplit: rowLayout = QtWidgets.QHBoxLayout() rowName = rowElement.attribute('name') rowEnabled = rowElement.attribute('enabled') optionLabel = QtWidgets.QLabel(rowName) optionLabel.setFixedWidth(160) rowLayout.addWidget(optionLabel) if rowEnabled == 'False': enabled = False optionLabel.setEnabled(False) else: enabled = True optionElements = rowElement.elementsByTagName('option') optionsCount = self.parseOptions(rowLayout, optionElements, assetTypeName, enabled) return rowLayout, optionsCount else: return None, 0
def __init__(self, *args, **kwargs): '''Instantiate the asset options.''' super(AssetOptions, self).__init__(*args, **kwargs) self.logger = logging.getLogger( __name__ + '.' + self.__class__.__name__ ) self._entity = None self._hasEditedName = False self.radioButtonFrame = QtWidgets.QFrame() self.radioButtonFrame.setLayout(QtWidgets.QHBoxLayout()) self.radioButtonFrame.layout().setContentsMargins(5, 5, 5, 5) self.newAssetButton = QtWidgets.QRadioButton('Create new') self.newAssetButton.toggled.connect(self._onNewAssetToggled) self.radioButtonFrame.layout().addWidget(self.newAssetButton) self.existingAssetButton = QtWidgets.QRadioButton('Version up existing') self.existingAssetButton.toggled.connect(self._onExistingAssetToggled) self.radioButtonFrame.layout().addWidget(self.existingAssetButton) self.existingAssetSelector = _asset_selector.AssetSelector() self.assetTypeSelector = _asset_type_selector.AssetTypeSelector() self.assetNameLineEdit = _asset_name_edit.AssetNameEdit( self.existingAssetSelector, self.assetTypeSelector ) self.assetTypeSelector.currentIndexChanged.connect(self._onAssetTypeChanged) self.assetNameLineEdit.textEdited.connect(self._onAssetNameEdited)
def __init__(self, username, session, parent=None): '''Instantiate user name and logo widget using *username*.''' super(User, self).__init__(parent=parent) self.setObjectName('ftrack-userid-widget') self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setAlignment(QtCore.Qt.AlignRight) self.setLayout(self.main_layout) self.session = session self.label = QtWidgets.QLabel(self) self.image = thumbnail.User(self) self.image.setFixedSize(30, 30) self.main_layout.addWidget(self.label) self.main_layout.addWidget(self.image) self.username = username self.image.load(username) if username in NAME_CACHE: self.set_user_fullname() else: self.load_user_fullname()
def __init__(self, parent=None, title=None, headerWidgets=None): '''Instantiate widget with optional *parent* and *title*. *headerWidgets* is an optional list of widgets to append to the header of the time log widget. ''' super(TimeLogList, self).__init__(widgetFactory=self._createWidget, widgetItem=lambda widget: widget.value(), parent=parent) self.setObjectName('time-log-list') self.list.setShowGrid(False) # Disable selection on internal list. self.list.setSelectionMode(QtWidgets.QAbstractItemView.NoSelection) headerLayout = QtWidgets.QHBoxLayout() self.titleLabel = QtWidgets.QLabel(title) self.titleLabel.setProperty('title', True) headerLayout.addWidget(self.titleLabel, stretch=1) # TODO: Refacor and make use of QToolBar and QAction. # Also consider adding 'addAction'/'removeAction'. if headerWidgets: for widget in headerWidgets: headerLayout.addWidget(widget, stretch=0) self.layout().insertLayout(0, headerLayout)
def __init__(self, parent=None, connector=None): ''''Initialize dialog with *parent* and *connector* instance.''' 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() super(FtrackTasksDialog, self).__init__(self.parent) applyTheme(self, 'integration') self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.setMinimumWidth(500) self.centralwidget = QtWidgets.QWidget(self) self.verticalMainLayout = QtWidgets.QVBoxLayout(self) self.horizontalLayout = QtWidgets.QHBoxLayout() self.headerWidget = Header(getpass.getuser(), self) self.headerWidget.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.verticalMainLayout.addWidget(self.headerWidget) self.tasksWidget = WebViewWidget(self) url = ftrack.getWebWidgetUrl('tasks', theme='tf') self.tasksWidget.setUrl(url) self.horizontalLayout.addWidget(self.tasksWidget) self.verticalMainLayout.addLayout(self.horizontalLayout) self.setObjectName('ftrackTasks') self.setWindowTitle("ftrackTasks")
def __init__(self, parent=None): '''Initialise widget with *parent*''' super(Notification, self).__init__(parent=parent) self._context = defaultdict(list) layout = QtWidgets.QVBoxLayout() toolbar = QtWidgets.QHBoxLayout() self.setLayout(layout) reloadIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/dark/reload')) self.reloadButton = QtWidgets.QPushButton(reloadIcon, '') self.reloadButton.clicked.connect(self.reload) toolbar.addWidget(QtWidgets.QWidget(), stretch=1) toolbar.addWidget(self.reloadButton, stretch=0) layout.addLayout(toolbar) self._list = NotificationList(self) self._list.setObjectName('notification-list') layout.addWidget(self._list, stretch=1) self.overlay = ftrack_connect.ui.widget.overlay.BusyOverlay( self, message='Loading') self.overlay.hide() self.loadStarted.connect(self._onLoadStarted) self.loadEnded.connect(self._onLoadEnded)
def createVersionWidget(self): ''' Override to disable version widget. Return an empty QWidget. ''' widget = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) widget.setLayout(layout) return widget
def __init__(self): '''Initialize widget''' super(ThumbnailField, self).__init__() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.thumbnail = thumbnail_drop_zone.ThumbnailDropZone() self.layout().addWidget(self.thumbnail) self.thumbnail.updated.connect(self.notify_changed)
def __init__(self, placeholder): '''Initialize widget.''' super(TextAreaField, self).__init__() layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.textarea = textarea.TextArea(placeholder) self.layout().addWidget(self.textarea) self.textarea.textChanged.connect(self.notify_changed)
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 __init__(self, title=None, description=None, data=None, parent=None): '''Initialise time log. *title* should be the title entry to display for the time log whilst *description* can provide an optional longer description. *data* is optional data that can be stored for future reference (for example a link to an ftrack task that the time log represents). *parent* should be the optional parent of this widget. ''' super(TimeLog, self).__init__(parent=parent) self.setObjectName('time-log') self._data = None layout = QtWidgets.QHBoxLayout() self.setLayout(layout) self.labelLayout = QtWidgets.QVBoxLayout() layout.addLayout(self.labelLayout, stretch=1) self.titleLabel = ftrack_connect.ui.widget.label.Label() self.titleLabel.setProperty('title', True) self.labelLayout.addWidget(self.titleLabel) self.descriptionLabel = ftrack_connect.ui.widget.label.Label() self.labelLayout.addWidget(self.descriptionLabel) # TODO: Add theme support. playIcon = QtGui.QIcon( QtGui.QPixmap(':/ftrack/image/light/play') ) self.playButton = QtWidgets.QPushButton(playIcon, '') self.playButton.setFlat(True) self.playButton.clicked.connect(self._onPlayButtonClicked) layout.addWidget(self.playButton) self.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed ) # Set initial values. self.setValue({ 'title': title, 'description': description, 'data': data })
def __init__(self, parent=None): '''Instantiate logo widget.''' super(Logo, self).__init__(parent=parent) self.setObjectName('ftrack-logo-widget') 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) logoPixmap = QtGui.QPixmap(':ftrack/image/default/ftrackLogoLabel') self.setPixmap( logoPixmap.scaled(self.size(), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation))
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 setupUi(self, ImportOptions): '''Setup UI for *ImportOptions*.''' ImportOptions.setObjectName("ImportOptions") ImportOptions.resize(451, 16) self.verticalLayout = QtWidgets.QVBoxLayout(ImportOptions) self.verticalLayout.setSpacing(0) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.optionsPlaceHolderLayout = QtWidgets.QHBoxLayout() self.optionsPlaceHolderLayout.setSizeConstraint( QtWidgets.QLayout.SetMinimumSize ) self.optionsPlaceHolderLayout.setObjectName("optionsPlaceHolderLayout") self.verticalLayout.addLayout(self.optionsPlaceHolderLayout) self.retranslateUi(ImportOptions) QtCore.QMetaObject.connectSlotsByName(ImportOptions)
def setupUi(self, WebView): '''Setup UI for *WebView*.''' WebView.setObjectName('WebView') WebView.resize(688, 555) self.horizontalLayout = QtWidgets.QHBoxLayout(WebView) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName('horizontalLayout') self.WebViewView = QtWebCompat.QWebView(WebView) font = QtGui.QFont() font.setFamily('Anonymous Pro') self.WebViewView.setFont(font) self.WebViewView.setUrl(QtCore.QUrl('about:blank')) self.WebViewView.setObjectName('WebViewView') self.horizontalLayout.addWidget(self.WebViewView) self.retranslateUi(WebView) QtCore.QMetaObject.connectSlotsByName(WebView)
def __init__(self, event=None, date=None, parent=None): '''Initialise widget with initial component *event* and *parent*.''' super(Notification, self).__init__(parent=parent) self.horizontalLayout = QtWidgets.QHBoxLayout() verticalLayout = QtWidgets.QVBoxLayout() self.setLayout(self.horizontalLayout) self.horizontalLayout.addLayout(verticalLayout, stretch=1) self.textLabel = QtWidgets.QLabel() verticalLayout.addWidget(self.textLabel) self.dateLabel = QtWidgets.QLabel() verticalLayout.addWidget(self.dateLabel) self.setDate(event['created_at']) self.setEvent(event)
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 __init__(self, start_frame, end_frame): '''Instantiate start and end frame field.''' super(StartEndFrameField, self).__init__() self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.start_frame = QtWidgets.QDoubleSpinBox() self.start_frame.setValue(start_frame) self.start_frame.setMaximum(sys.maxint) self.start_frame.setDecimals(0) self.start_frame.valueChanged.connect(self.notify_changed) self.end_frame = QtWidgets.QDoubleSpinBox() self.end_frame.setValue(end_frame) self.end_frame.setMaximum(sys.maxint) self.end_frame.setDecimals(0) self.end_frame.valueChanged.connect(self.notify_changed) self.layout().addWidget(QtWidgets.QLabel('Frame Range')) self.layout().addWidget(self.start_frame) self.layout().addWidget(self.end_frame)
def __init__(self, results): '''Instantiate and show results.''' super(Dialog, self).__init__() self.setObjectName('ftrack-result-dialog') self.setMinimumSize(1080, 720) main_layout = QtWidgets.QVBoxLayout(self) self.setLayout(main_layout) filter_layout = QtWidgets.QHBoxLayout() filter_label = QtWidgets.QLabel('Filter log') self.filter_field = QtWidgets.QLineEdit() self.filter_field.setObjectName('ftrack-log-filter-field') self.filter_field.textChanged.connect(self.on_search) filter_layout.addWidget(filter_label) filter_layout.addWidget(self.filter_field) main_layout.addLayout(filter_layout) log_list = QtWidgets.QTableView() log_list.verticalHeader().hide() log_list.setObjectName('ftrack-log-view') log_list.setAlternatingRowColors(True) log_list.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) log_list.horizontalHeader().setStretchLastSection(True) log_items = self._parse_results(results) log_model = ftrack_connect_pipeline.ui.model.log_table.LogTableModel( self, log_items) self.log_sort_model = ftrack_connect_pipeline.ui.model.log_table.FilterProxyModel( ) self.log_sort_model.setDynamicSortFilter(True) self.log_sort_model.setSourceModel(log_model) log_list.setModel(self.log_sort_model) main_layout.addWidget(log_list) open_log_folder_button = QtWidgets.QPushButton('Open log directory') open_log_folder_button.clicked.connect(self._on_logging_button_clicked) main_layout.addWidget(open_log_folder_button)
def __init__(self, currentEntity, parent=None): '''Initialise with the *currentEntity* and *parent* widget.''' super(ContextSelector, self).__init__(parent=parent) self._entity = currentEntity self.entityBrowser = entityBrowser.EntityBrowser() self.entityBrowser.setMinimumWidth(600) self.entityPath = entityPath.EntityPath() self.entityBrowseButton = QtWidgets.QPushButton('Browse') applyTheme(self.entityBrowser, 'integration') layout = QtWidgets.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) layout.addWidget(self.entityPath) layout.addWidget(self.entityBrowseButton) self.entityBrowseButton.clicked.connect( self._onEntityBrowseButtonClicked) self.entityChanged.connect(self.entityPath.setEntity) self.entityBrowser.selectionChanged.connect( self._onEntityBrowserSelectionChanged)
def build(self): '''Build widgets and layout.''' self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.thumbnailWidget = QtWidgets.QLabel() self.thumbnailWidget.setFrameStyle(QtWidgets.QFrame.StyledPanel) self.thumbnailWidget.setAlignment(QtCore.Qt.AlignCenter) self.thumbnailWidget.setFixedWidth(240) self.layout().addWidget(self.thumbnailWidget) self.propertyTableWidget = QtWidgets.QTableWidget() self.propertyTableWidget.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.propertyTableWidget.setSelectionMode( QtWidgets.QAbstractItemView.NoSelection) self.propertyTableWidget.setRowCount(len(self.headers)) self.propertyTableWidget.setVerticalHeaderLabels(self.headers) self.propertyTableWidget.setColumnCount(1) horizontalHeader = self.propertyTableWidget.horizontalHeader() horizontalHeader.hide() horizontalHeader.setResizeMode(QtWidgets.QHeaderView.Stretch) verticalHeader = self.propertyTableWidget.verticalHeader() verticalHeader.setResizeMode(QtWidgets.QHeaderView.ResizeToContents) # Fix missing horizontal scrollbar when only single column self.propertyTableWidget.setHorizontalScrollMode( QtWidgets.QAbstractItemView.ScrollPerPixel) for index in range(len(self.headers)): self.propertyTableWidget.setItem(index, 0, QtWidgets.QTableWidgetItem('')) self.layout().addWidget(self.propertyTableWidget)
def build(self): '''Build widgets and layout.''' self.setLayout(QtWidgets.QVBoxLayout()) self.layout().setContentsMargins(0, 0, 0, 0) self.optionsLayout = QtWidgets.QHBoxLayout() self.assetTypeSelector = QtWidgets.QComboBox() self.optionsLayout.addWidget(self.assetTypeSelector) self.refreshButton = QtWidgets.QPushButton(self.tr('Refresh')) self.optionsLayout.addWidget(self.refreshButton) self.optionsLayout.addStretch(1) self.layout().addLayout(self.optionsLayout) self.assetTable = QtWidgets.QTableWidget() self.assetTable.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.assetTable.setSelectionMode( QtWidgets.QAbstractItemView.SingleSelection) self.assetTable.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) self.assetTable.setColumnCount(len(self.assetTableColumns)) self.assetTable.setRowCount(0) self.assetTable.verticalHeader().hide() self.assetTable.setHorizontalHeaderLabels(self.assetTableColumns) horizontalHeader = self.assetTable.horizontalHeader() horizontalHeader.setResizeMode(QtWidgets.QHeaderView.Fixed) self.assetTable.horizontalHeader().setDefaultSectionSize(100) self.assetTable.setColumnWidth(1, 63) self.assetTable.horizontalHeader().setResizeMode( 0, QtWidgets.QHeaderView.Stretch) self.layout().addWidget(self.assetTable)
def __init__(self, username, parent=None): '''Instantiate user name and logo widget using *username*.''' super(User, self).__init__(parent=parent) self.setObjectName('ftrack-userid-widget') self.main_layout = QtWidgets.QHBoxLayout() self.main_layout.setContentsMargins(0, 0, 0, 0) self.main_layout.setAlignment(QtCore.Qt.AlignRight) self.setLayout(self.main_layout) self.label = QtWidgets.QLabel(self) self.image = thumbnail.User(self) self.image.setFixedSize(35, 35) self.main_layout.addWidget(self.label) self.main_layout.addWidget(self.image) self.image.load(username) if username not in NAME_CACHE: NAME_CACHE[username] = ftrack.User(username).getName().title() self.label.setText(NAME_CACHE[username])
def __init__(self, parent=None, connector=None): '''Instantiate info dialog class with *connector*.''' super(FtrackInfoDialog, self).__init__(parent=parent) self.connector = connector self.setMinimumWidth(400) self.setSizePolicy( QtWidgets.QSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding ) ) self.centralwidget = QtWidgets.QWidget(self) self.verticalMainLayout = QtWidgets.QVBoxLayout(self) self.horizontalLayout = QtWidgets.QHBoxLayout() shotId = os.getenv('FTRACK_SHOTID') taskId = os.getenv('FTRACK_TASKID', shotId) self.headerWidget = header.Header(getpass.getuser(), self) self.verticalMainLayout.addWidget(self.headerWidget) self.infoWidget = WebViewWidget(self.centralwidget) self.horizontalLayout.addWidget(self.infoWidget) self.verticalMainLayout.addLayout(self.horizontalLayout) self.setObjectName('ftrackInfo') self.setWindowTitle('ftrackInfo') self.homeTaskId = taskId self.setObject(taskId) panelComInstance = PanelComInstance.instance() panelComInstance.addInfoListener(self.updateObj)
def __init__(self, parent=None, connector=None): '''Instantiate asset manager dialog with *connector*.''' super(FtrackAssetManagerDialog, self).__init__(parent=parent) applyTheme(self, 'integration') if not connector: raise ValueError( 'Please provide a connector object for {0}'.format( self.__class__.__name__)) self.connector = connector self.setMinimumWidth(400) self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.centralwidget = QtWidgets.QWidget(self) self.verticalMainLayout = QtWidgets.QVBoxLayout(self) self.verticalMainLayout.setSpacing(6) self.horizontalLayout = QtWidgets.QHBoxLayout() self.headerWidget = header.Header(getpass.getuser(), self) self.verticalMainLayout.addWidget(self.headerWidget) self.assetManagerWidget = AssetManagerWidget(parent=self.centralwidget, connector=self.connector) self.horizontalLayout.addWidget(self.assetManagerWidget) self.verticalMainLayout.addLayout(self.horizontalLayout) self.setObjectName('ftrackAssetManager') self.setWindowTitle('ftrackAssetManager') panelComInstance = PanelComInstance.instance() panelComInstance.addRefreshListener( self.assetManagerWidget.refreshAssetManager)
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)