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, componentName=None, resourceIdentifier=None, parent=None): '''Initialise widget with initial component *value* and *parent*.''' super(Component, self).__init__(parent=parent) self.setLayout(QtWidgets.QVBoxLayout()) self.componentNameEdit = ftrack_connect.ui.widget.line_edit.LineEdit() self.componentNameEdit.setPlaceholderText('Enter component name') self.componentNameEdit.textChanged.connect(self.nameChanged) self.layout().addWidget(self.componentNameEdit) # TODO: Add theme support. removeIcon = QtGui.QIcon( QtGui.QPixmap(':/ftrack/image/light/trash') ) self.removeAction = QtWidgets.QAction( QtGui.QIcon(removeIcon), 'Remove', self.componentNameEdit ) self.removeAction.setStatusTip('Remove component.') self.componentNameEdit.addAction( self.removeAction ) self.resourceInformation = ftrack_connect.ui.widget.label.Label() self.layout().addWidget(self.resourceInformation) # Set initial values. self.setId(str(uuid.uuid4())) self.setComponentName(componentName) self.setResourceIdentifier(resourceIdentifier)
def setThumbnail(self, filePath): '''Set thumbnail to *filePath* and display a preview.''' self._filePath = filePath pixmap = QtGui.QPixmap(self._filePath).scaled( self._imageWidth, self._imageHeight, QtCore.Qt.KeepAspectRatio) self.imageLabel.setPixmap(pixmap) self.removeButton.setVisible(True)
def customise_menu(event): ''' Set ftrack icon looking in menu from given *event*. ''' actions = event.menu.actions() for action in actions: if action.text() in ['Version', 'Export...']: action.setIcon( QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight'))
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 populate_ftrack(event): '''Populate the ftrack menu with items.''' import hiero.ui from QtExt import QtGui menu_bar = hiero.ui.menuBar() ftrack_menu = menu_bar.addMenu( QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight'), 'ftrack')
def __init__(self): ''' Initialise action. ''' super(FtrackReBuildServerTrackAction, self).__init__('Build track from ftrack') self.trackFinder = FtrackTrackFinderByNameWithDialog(self) self.setIcon(QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight')) self.logger = logging.getLogger(__name__ + '.' + self.__class__.__name__)
def __init__( self, parent, message='Processing', icon=':ftrack/image/default/ftrackLogoColor' ): '''Initialise with *parent*. *message* is the message to display on the overlay. ''' super(BlockingOverlay, self).__init__(parent) layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) self.content = QtWidgets.QFrame() self.content.setObjectName('content') layout.addWidget( self.content, alignment=QtCore.Qt.AlignCenter ) self.contentLayout = QtWidgets.QVBoxLayout() self.contentLayout.setContentsMargins(0, 0, 0, 0) self.content.setLayout(self.contentLayout) self.icon = QtWidgets.QLabel() pixmap = QtGui.QPixmap(icon) self.icon.setPixmap( pixmap.scaledToHeight(36, mode=QtCore.Qt.SmoothTransformation) ) self.icon.setAlignment(QtCore.Qt.AlignCenter) self.contentLayout.addWidget(self.icon) self.messageLabel = QtWidgets.QLabel() self.messageLabel.setWordWrap(True) self.messageLabel.setAlignment(QtCore.Qt.AlignCenter) self.contentLayout.addWidget(self.messageLabel) self.setStyleSheet(''' BlockingOverlay { background-color: rgba(250, 250, 250, 200); border: none; } BlockingOverlay QFrame#content { padding: 0px; border: 80px solid transparent; background-color: transparent; border-image: url(:ftrack/image/default/boxShadow) 140 stretch; } BlockingOverlay QLabel { background: transparent; } ''') self.setMessage(message)
def __init__(self): ''' Initialise menu widget. ''' QtWidgets.QMenu.__init__(self, 'Build track from ftrack', None) self.logger = logging.getLogger(__name__ + '.' + self.__class__.__name__) hiero.core.events.registerInterest('kShowContextMenu/kTimeline', self.eventHandler) self.setIcon(QtGui.QPixmap(':ftrack/image/default/ftrackLogoLight')) self._action_rebuild_from_server = FtrackReBuildServerTrackAction() self.addAction(self._action_rebuild_from_server)
def setThumbnail(self, filePath): '''Set thumbnail to *filePath* and display a preview.''' self._filePath = filePath pixmap = QtGui.QPixmap(self._filePath).scaled( self._imageWidth, self._imageHeight, QtCore.Qt.KeepAspectRatio) self.thumbnail_button.setIcon(pixmap) self.thumbnail_button.setIconSize(pixmap.rect().size()) self.thumbnail_button.setText('') self.removeButton.setVisible(True) self.updated.emit(self._filePath)
def _pixmapFromUrl(self, url): '''Retrieve *url* and return data as a pixmap.''' pixmap = self.thumbnailCache.get(url) if pixmap is None: data = HelpFunctions.getFileFromUrl(url) pixmap = QtGui.QPixmap() pixmap.loadFromData(data) self.thumbnailCache[url] = pixmap # Handle null pixmaps. E.g. JPG on Windows. if pixmap.isNull(): pixmap = self.thumbnailCache.get(self.placholderThumbnail, pixmap) return pixmap
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, 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 __init__(self, *args, **kwargs): '''Instantiate the time tracker.''' super(TimeTracker, self).__init__(*args, **kwargs) self.setObjectName('timeTracker') self._activeEntity = None layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self.activeLabel = QtWidgets.QLabel('Currently running') self.activeLabel.setProperty('title', True) layout.addWidget(self.activeLabel) self._timerEnabled = False self.timer = ftrack_connect.ui.widget.timer.Timer() layout.addWidget(self.timer) self.timerPlaceholder = TimerOverlay(self.timer) # TODO: Add theme support. reloadIcon = QtGui.QIcon(QtGui.QPixmap(':/ftrack/image/light/reload')) assignedTimeLogUpdateButton = QtWidgets.QPushButton(reloadIcon, '') assignedTimeLogUpdateButton.setFlat(True) assignedTimeLogUpdateButton.setToolTip('Refresh list') assignedTimeLogUpdateButton.clicked.connect(self._updateAssignedList) self.assignedTimeLogList = _TimeLogList( title='Assigned', headerWidgets=[assignedTimeLogUpdateButton]) layout.addWidget(self.assignedTimeLogList, stretch=1) # Connect events. self.timer.stopped.connect(self._onCommitTime) self.timer.timeEdited.connect(self._onCommitTime) self.assignedTimeLogList.itemSelected.connect(self._onSelectTimeLog) self.blockingOverlay = TimeTrackerBlockingOverlay( self, 'Time tracker is currently disabled during beta.') self.blockingOverlay.show() self._updateAssignedList()
def __init__( self, parent, icon=':ftrack/image/default/ftrackLogoColor' ): super(AboutDialog, self).__init__(parent) layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(20, 20, 20, 20) layout.setSizeConstraint(QtWidgets.QLayout.SetFixedSize) self.setLayout(layout) self.icon = QtWidgets.QLabel() pixmap = QtGui.QPixmap(icon) self.icon.setPixmap( pixmap.scaledToHeight(36, mode=QtCore.Qt.SmoothTransformation) ) self.icon.setAlignment(QtCore.Qt.AlignCenter) layout.addWidget(self.icon) self.messageLabel = QtWidgets.QLabel() self.messageLabel.setWordWrap(True) self.messageLabel.setAlignment(QtCore.Qt.AlignLeft) layout.addWidget(self.messageLabel) layout.addSpacing(25) self.debugButton = QtWidgets.QPushButton('More info') self.debugButton.clicked.connect(self._onDebugButtonClicked) layout.addWidget(self.debugButton) self.loggingButton = QtWidgets.QPushButton('Open log directory') self.loggingButton.clicked.connect(self._onLoggingButtonClicked) layout.addWidget(self.loggingButton) self.debugTextEdit = QtWidgets.QTextEdit() self.debugTextEdit.setReadOnly(True) self.debugTextEdit.setFontPointSize(10) self.debugTextEdit.hide() layout.addWidget(self.debugTextEdit)
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 __init__(self, *args, **kwargs): '''Initialise the main application window.''' theme = kwargs.pop('theme', 'light') super(Application, self).__init__(*args, **kwargs) self.logger = logging.getLogger( __name__ + '.' + self.__class__.__name__ ) self.defaultPluginDirectory = appdirs.user_data_dir( 'ftrack-connect-plugins', 'ftrack' ) self.pluginHookPaths = set() self.pluginHookPaths.update( self._gatherPluginHooks( self.defaultPluginDirectory ) ) if 'FTRACK_CONNECT_PLUGIN_PATH' in os.environ: for connectPluginPath in ( os.environ['FTRACK_CONNECT_PLUGIN_PATH'].split(os.pathsep) ): self.pluginHookPaths.update( self._gatherPluginHooks( connectPluginPath ) ) self.logger.info( u'Connect plugin hooks directories: {0}'.format( ', '.join(self.pluginHookPaths) ) ) # Register widget for error handling. self.uncaughtError = _uncaught_error.UncaughtError( parent=self ) if not QtWidgets.QSystemTrayIcon.isSystemTrayAvailable(): raise ftrack_connect.error.ConnectError( 'No system tray located.' ) self.logoIcon = QtGui.QIcon( QtGui.QPixmap(':/ftrack/image/default/ftrackLogoColor') ) self._login_server_thread = None self._theme = None self.setTheme(theme) self.plugins = {} self._initialiseTray() self.setObjectName('ftrack-connect-window') self.setWindowTitle('ftrack connect') self.resize(450, 700) self.move(50, 50) self.setWindowIcon(self.logoIcon) self._login_overlay = None self.loginWidget = _login.Login() self.loginSignal.connect(self.loginWithCredentials) self.login()
def removeThumbnail(self): '''Remove thumbnail.''' self.setDropZoneText() self._filePath = None self.thumbnail_button.setIcon(QtGui.QPixmap()) self.removeButton.setVisible(False)
def refreshAssetManager(self): '''Refresh assets in asset manager.''' assets = self.connector.getAssets() self.ui.AssertManagerTableWidget.setSortingEnabled(False) self.ui.AssertManagerTableWidget.setRowCount(0) self.ui.AssertManagerTableWidget.setRowCount(len(assets)) component_ids = [] for component_id, _ in assets: if component_id: component_ids.append(component_id) if component_ids: query_string = ( 'select name, version.asset.type.short, version.asset.name, ' 'version.asset.type.name, version.asset.versions.version, ' 'version.id, version.version, version.asset.versions, ' 'version.date, version.comment, version.asset.name, version, ' 'version_id, version.user.first_name, version.user.last_name ' 'from Component where id in ({0})'.format( ','.join(component_ids))) components = self.connector.session.query(query_string).all() asset_ids = set() for component in components: asset_ids.add(component['version']['asset']['id']) if asset_ids: # Because of bug in 3.3.X backend we need to divide the query. The # memory cache will allow using entities without caring about this. preload_string = ( 'select components.name from AssetVersion where ' 'asset_id in ({0})').format(', '.join(list(asset_ids))) self.connector.session.query(preload_string).all() component_map = dict( (component['id'], component) for component in components) else: component_map = {} for i in range(len(assets)): if assets[i][0]: component = component_map[assets[i][0]] asset_version = component['version'] componentNameStr = component['name'] assetVersionNr = asset_version['version'] asset = asset_version['asset'] asset_versions_with_same_component_name = [] for related_version in asset['versions']: for other_component in related_version['components']: if other_component['name'] == componentNameStr: asset_versions_with_same_component_name.append( related_version) asset_versions_with_same_component_name = sorted( asset_versions_with_same_component_name, key=lambda x: x['version']) latest_version_number = ( asset_versions_with_same_component_name[-1]['version']) versionIndicatorButton = QtWidgets.QPushButton('') if assetVersionNr == latest_version_number: versionIndicatorButton.setStyleSheet(''' QPushButton { background-color: #1CBC90; border: none; } ''') self.connector.setNodeColor(applicationObject=assets[i][1], latest=True) else: versionIndicatorButton.setStyleSheet(''' QPushButton { background-color: #E36316; border: none; } ''') self.connector.setNodeColor(applicationObject=assets[i][1], latest=False) self.ui.AssertManagerTableWidget.setCellWidget( i, 0, versionIndicatorButton) componentName = QtWidgets.QTableWidgetItem(componentNameStr) self.ui.AssertManagerTableWidget.setItem(i, 1, componentName) componentId = QtWidgets.QTableWidgetItem(component['id']) self.ui.AssertManagerTableWidget.setItem(i, 2, componentId) assetType = QtWidgets.QTableWidgetItem(asset['type']['short']) self.ui.AssertManagerTableWidget.setItem(i, 3, assetType) assetTypeLong = QtWidgets.QTableWidgetItem( asset['type']['name']) self.ui.AssertManagerTableWidget.setItem(i, 4, assetTypeLong) versionNumberComboBox = QtWidgets.QComboBox() for version in reversed( asset_versions_with_same_component_name): versionNumberComboBox.addItem(str(version['version'])) conName = self.connector.getConnectorName() if conName in self.notVersionable: if componentNameStr in self.notVersionable[conName]: versionNumberComboBox.setEnabled(False) result = versionNumberComboBox.findText(str(assetVersionNr)) versionNumberComboBox.setCurrentIndex(result) self.ui.AssertManagerTableWidget.setCellWidget( i, 5, versionNumberComboBox) versionNumberComboBox.currentIndexChanged.connect( self.changeVersion) latestVersionNumberWidget = QtWidgets.QTableWidgetItem( str(latest_version_number)) self.ui.AssertManagerTableWidget.setItem( i, 6, latestVersionNumberWidget) assetName = QtWidgets.QTableWidgetItem(asset['name']) assetName.setToolTip(asset['name']) self.ui.AssertManagerTableWidget.setItem(i, 7, assetName) assetNameInScene = QtWidgets.QTableWidgetItem(assets[i][1]) assetNameInScene.setToolTip(assets[i][1]) self.ui.AssertManagerTableWidget.setItem( i, 8, assetNameInScene) selectButton = QtWidgets.QPushButton('S') selectButton.setToolTip('Select asset in scene') self.ui.AssertManagerTableWidget.setCellWidget( i, 9, selectButton) selectButton.clicked.connect(self.signalMapperSelect.map) self.signalMapperSelect.setMapping(selectButton, assets[i][1]) replaceButton = QtWidgets.QPushButton('R') self.ui.AssertManagerTableWidget.setCellWidget( i, 10, replaceButton) removeButton = QtWidgets.QPushButton() removeButton.setToolTip('Remove asset from scene') icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(':ftrack/image/integration/trash'), QtGui.QIcon.Normal, QtGui.QIcon.Off) removeButton.setIcon(icon) self.ui.AssertManagerTableWidget.setCellWidget( i, 11, removeButton) removeButton.clicked.connect(self.signalMapperRemove.map) self.signalMapperRemove.setMapping(removeButton, assets[i][1]) assetId = QtWidgets.QTableWidgetItem(str(asset['id'])) self.ui.AssertManagerTableWidget.setItem(i, 12, assetId) assetVersionId = QtWidgets.QTableWidgetItem( str(asset_version['id'])) self.ui.AssertManagerTableWidget.setItem(i, 13, assetVersionId) currentVersionFallback = QtWidgets.QTableWidgetItem( str(assetVersionNr)) self.ui.AssertManagerTableWidget.setItem( i, 14, currentVersionFallback) commentButton = QtWidgets.QPushButton() commentButton.setText('') icon = QtGui.QIcon() icon.addPixmap( QtGui.QPixmap(':ftrack/image/integration/comment'), QtGui.QIcon.Normal, QtGui.QIcon.Off) commentButton.setIcon(icon) fullUserName = (asset_version['user']['first_name'] + ' ' + asset_version['user']['last_name']) pubDate = str(asset_version['date']) comment = asset_version['comment'] tooltipText = '\n'.join([fullUserName, pubDate, comment]) commentButton.setToolTip(tooltipText) self.ui.AssertManagerTableWidget.setCellWidget( i, 15, commentButton) commentButton.clicked.connect(self.signalMapperComment.map) self.signalMapperComment.setMapping(commentButton, str(asset_version['id'])) commentButton.setEnabled(has_webwidgets) self.ui.AssertManagerTableWidget.setHorizontalHeaderLabels( self.columnHeaders)
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 _updatePixmapData(self, data): '''Update thumbnail with *data*.''' pixmap = QtGui.QPixmap() pixmap.loadFromData(data) self._scaleAndSetPixmap(pixmap)