def _build(self): '''Create and layout widget.''' layout = QtWidgets.QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout) # Thumbnail. self._thumbnail = QtWidgets.QLabel() self._thumbnail.setFrameStyle(QtWidgets.QFrame.StyledPanel) self._thumbnail.setAlignment(QtCore.Qt.AlignCenter) self._thumbnail.setFixedHeight(160) layout.addWidget(self._thumbnail) # Properties. self._propertyTable = QtWidgets.QTableWidget() self._propertyTable.setHorizontalScrollMode( QtWidgets.QAbstractItemView.ScrollPerPixel) self._propertyTable.setColumnCount(1) headers = ('Name', 'Author', 'Version', 'Date', 'Comment', 'Status', 'Priority') self._propertyTable.setRowCount(len(headers)) self._propertyTable.setVerticalHeaderLabels(headers) horizontalHeader = self._propertyTable.horizontalHeader() horizontalHeader.hide() horizontalHeader.setResizeMode(QtWidgets.QHeaderView.Stretch) verticalHeader = self._propertyTable.verticalHeader() verticalHeader.setResizeMode(QtWidgets.QHeaderView.ResizeToContents) layout.addWidget(self._propertyTable)
def __init__(self, parent=None): super(CommentWidget, self).__init__(parent) css_comment_frame = """ QFrame { 4px; background: #222; color: #FFF; } QLabel { padding: 0px; background: none; } QTextEdit { border: 3px solid #252525; background: #444; } QScrollBar { border: 0; background-color: #333; margin: 1px;} QScrollBar::handle {background: #222; border: 1px solid #111;} QScrollBar::sub-line, QScrollBar::add-line {height: 0px; width: 0px;} """ self.setMinimumWidth(600) # self.setMaximumHeight(100) self.setStyleSheet(css_comment_frame) layout = QtWidgets.QFormLayout(self) layout.setSpacing(10) layout.setContentsMargins(0, 0, 0, 0) label = QtWidgets.QLabel("Comment", self) self._edit_field = QtWidgets.QTextEdit(self) self._edit_field.setObjectName('ftrack-edit-field') self._edit_field.textChanged.connect(self._validate_comment) layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, label) layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self._edit_field)
def __init__(self): super(ProgressDialog, self).__init__() applyTheme(self, 'integration') self.hbox = QtWidgets.QHBoxLayout() self.progressBar = QtWidgets.QProgressBar(self) self.hbox.addWidget(self.progressBar) self.setLayout(self.hbox) self.setMinimumSize(QtCore.QSize(720, 560))
def setupUI(self): main_layout = QtWidgets.QVBoxLayout(self) main_layout.setContentsMargins(0, 0, 0, 0) main_layout.setSpacing(0) empty_task = SingleTaskWidget(parent=self) self._stackLayout = QtWidgets.QStackedLayout() self._stackLayout.addWidget(empty_task) main_layout.addLayout(self._stackLayout) self._stackLayout.setCurrentWidget(empty_task)
def _build(self): '''Build and layout widget.''' self.setMinimumHeight(400) self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self.setLayout(layout) self._webView = QtWebCompat.QWebView() layout.addWidget(self._webView)
def __init__(self): super(AssetPreferencesDialog, self).__init__() self.setWindowTitle("Asset Management Preferences") layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self.settingsWidget = SessionSettingsWidget() layout.addWidget(self.settingsWidget) self.applyButton = QtWidgets.QPushButton("Apply") layout.addWidget(self.applyButton) self.applyButton.clicked.connect(self.apply)
def setupUI(self): super(ScriptOpenerDialog, self).setupUI() # CONTENT TASK self.splitter = QtWidgets.QSplitter(self) self.splitter.setContentsMargins(10, 10, 10, 10) self.splitter.setChildrenCollapsible(False) left_widget = QtWidgets.QWidget(self.splitter) left_layout = QtWidgets.QVBoxLayout(left_widget) left_layout.setContentsMargins(0, 0, 5, 0) self._task_widget = TaskWidget(self) self._task_widget.set_read_only(True) self._task_widget.set_selection_mode(True) self._task_widget.asset_version_selected.connect( self.set_scene_version) self._task_widget.no_asset_version.connect(self.set_no_asset_version) left_layout.addWidget(self._task_widget) self.splitter.addWidget(left_widget) # CONTENT ASSET right_widget = QtWidgets.QWidget(self.splitter) right_layout = QtWidgets.QVBoxLayout(right_widget) right_layout.setContentsMargins(5, 0, 0, 0) self._scene_version_widget = scene_widgets.SceneVersionWidget(self) self._scene_version_widget.notify.connect(self.header.setMessage) right_layout.addWidget(self._scene_version_widget) self.splitter.addWidget(right_widget) self.main_container_layout.addWidget(self.splitter) self._save_btn.setText("Open script") self._save_btn.setMinimumWidth(150) self._save_btn.clicked.disconnect() self._save_btn.clicked.connect(self.load_scene) self.splitter.setSizePolicy( QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding, ) self.modify_layouts( self.splitter, spacing=8, margin=(8, 2, 8, 2), ) self.set_css(self.main_container)
def _getScriptOpenOptions(): l = FnAssetAPI.l msgBox = QtWidgets.QMessageBox() msgBox.setText(l("{published} Scripts can't be opened directly.")) msgBox.setInformativeText( "This is to avoid changing the asset itself by " + "saving. Would you like to Save a Copy or import the nodes?") saveAs = msgBox.addButton("Save As...", msgBox.AcceptRole) imp = msgBox.addButton("Import", msgBox.NoRole) # Had some issues with StandardButton .vs. AbstractButton msgBox.addButton("Cancel", msgBox.RejectRole) msgBox.exec_() button = msgBox.clickedButton() if button == saveAs: return 'saveas' elif button == imp: return 'import' else: return ''
def makeUI(self): self.tableWidget = QtWidgets.QTableWidget() self.tableWidget.setColumnCount(7) self.tableWidget.setHorizontalHeaderLabels( ['', 'Filename', 'Component', 'NodeName', '', '', '']) self.tableWidget.verticalHeader().setVisible(False) self.tableWidget.setColumnWidth(0, 25) self.tableWidget.setColumnWidth(2, 100) self.tableWidget.setColumnWidth(3, 100) self.tableWidget.setColumnWidth(4, 25) self.tableWidget.setColumnHidden(0, True) self.tableWidget.setColumnHidden(5, True) self.tableWidget.setColumnHidden(6, True) self.tableWidget.horizontalHeader().setResizeMode( QtWidgets.QHeaderView.Fixed) self.tableWidget.horizontalHeader().setResizeMode( 1, QtWidgets.QHeaderView.Stretch) self.tableWidget.setTextElideMode(QtCore.Qt.ElideLeft) self.tableWidget.setMinimumHeight(200) self.tableWidget.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self.tableWidget.updateValue = self.updateValue return self.tableWidget
def __init__(self, bridge, context, parent=None): self._bridge = bridge super(WorkflowRelationship, self).__init__(context, parent) self._layout = QtWidgets.QHBoxLayout() self.setLayout(self._layout) self.workflowWidget = _WorkflowRelationshipWidget(self) self._layout.addWidget(self.workflowWidget)
def makeUI(self): self.mainWidget = QtWidgets.QWidget() applyTheme(self.mainWidget, 'integration') self.mainWidget.setContentsMargins(0, 0, 0, 0) self.hlayout = QtWidgets.QHBoxLayout() self.hlayout.setContentsMargins(0, 0, 0, 0) self.mainWidget.setLayout(self.hlayout) self._lineEdit = QtWidgets.QLineEdit() self._lineEdit.setText( HelpFunctions.getPath(self.current_task, slash=True)) self.hlayout.addWidget(self._lineEdit) self._browse = QtWidgets.QPushButton("Browse") self.hlayout.addWidget(self._browse) QtCore.QObject.connect(self._browse, QtCore.SIGNAL('clicked()'), self.openBrowser) return self.mainWidget
def _updateComponentsNavigator(self, importableComponents=[]): '''Update versions navigator to display *importableComponents*.''' self._componentsNavigator.setRowCount(0) self._componentsNavigator.setRowCount(len(importableComponents)) for index, component in enumerate(importableComponents): text = self._bridge.getEntityName(component.getEntityRef()) item = QtWidgets.QTableWidgetItem(text) item.setData(QtCore.Qt.UserRole, component.getEntityRef()) self._componentsNavigator.setItem(index, 0, item) self._componentsNavigator.setCurrentCell(0, 0) self._updateNavigator(importableComponents[0].getEntityRef())
def _build(self): '''Build and layout widget.''' layout = QtWidgets.QHBoxLayout() self.setLayout(layout) icon = QtWidgets.QPixmap(':icon-ftrack-box') smallIcon = icon.scaled(QtCore.QSize(24, 24), QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation) iconLabel = QtWidgets.QLabel() iconLabel.setPixmap(smallIcon) layout.addWidget(iconLabel) self._label = QtWidgets.QLabel(self._noSelectionMessage) self._label.setEnabled(False) layout.addWidget(self._label) layout.addStretch() self._browseButton = QtWidgets.QPushButton('Browse...') layout.addWidget(self._browseButton)
def confirmClose(): l = FnAssetAPI.l msgBox = QtWidgets.QMessageBox() msgBox.setText(l("Save changes before closing script?")) msgBox.setStandardButtons(QtWidgets.QMessageBox.Save | QtWidgets.QMessageBox.Discard | QtWidgets.QMessageBox.Cancel) button = msgBox.exec_() if button == QtWidgets.QMessageBox.Save: return 'save' elif button == QtWidgets.QMessageBox.Discard: return 'dontsave' else: return 'cancel'
def setupUi(self, WorkflowRelationship): '''Set up ui for *WorkflowRelationship* widget.''' WorkflowRelationship.setObjectName('WorkflowRelationship') WorkflowRelationship.resize(275, 106) self.verticalLayout = QtWidgets.QVBoxLayout(WorkflowRelationship) self.verticalLayout.setObjectName('verticalLayout') self.gridLayout = QtWidgets.QGridLayout() self.gridLayout.setObjectName('gridLayout') spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout.addItem(spacerItem, 2, 0, 1, 1) self.label = QtWidgets.QLabel(WorkflowRelationship) self.label.setObjectName('label') self.gridLayout.addWidget(self.label, 1, 0, 1, 1) self.taskCombo = QtWidgets.QComboBox(WorkflowRelationship) self.taskCombo.setObjectName('taskCombo') self.gridLayout.addWidget(self.taskCombo, 1, 1, 1, 1) self.versionCombo = QtWidgets.QComboBox(WorkflowRelationship) self.versionCombo.setObjectName('versionCombo') self.gridLayout.addWidget(self.versionCombo, 0, 1, 1, 1) self.label_2 = QtWidgets.QLabel(WorkflowRelationship) self.label_2.setObjectName('label_2') self.gridLayout.addWidget(self.label_2, 0, 0, 1, 1) self.preferNukeScript = QtWidgets.QCheckBox('Prefer nuke script', WorkflowRelationship) self.gridLayout.addWidget(self.preferNukeScript, 2, 0, 1, 2) spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.gridLayout.addItem(spacerItem1, 0, 3, 1, 1) self.verticalLayout.addLayout(self.gridLayout) self.retranslateUi(WorkflowRelationship) QtCore.QMetaObject.connectSlotsByName(WorkflowRelationship)
def _populateBookmarks(self): '''Populate bookmarks view.''' # TODO: Extract bookmarks to separate widget. # For now just display non-editable list of projects from ftrack. projects = ftrack.getProjects() self._bookmarksView.setRowCount(len(projects)) # Sort projects by display name. projects = sorted(projects, key=lambda project: project.getName()) for index, project in enumerate(projects): item = QtWidgets.QTableWidgetItem(project.getName()) item.setData(QtCore.Qt.UserRole, project.getEntityRef()) icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(':icon-home'), QtGui.QIcon.Normal, QtGui.QIcon.Off) item.setIcon(icon) self._bookmarksView.setItem(index, 0, item)
def _updateVersionsNavigator(self, asset): '''Update versions navigator to display versions for *asset*.''' self._versionsNavigator.setRowCount(0) if self._componentNamesFilter: versions = asset.getVersions( componentNames=self._componentNamesFilter) else: versions = asset.getVersions() self._versionsNavigator.setRowCount(len(versions)) self._detailView.updateDetails(asset.getEntityRef()) for index, version in enumerate(reversed(versions)): text = self._bridge.getEntityName(version.getEntityRef()) item = QtWidgets.QTableWidgetItem(text) item.setData(QtCore.Qt.UserRole, version.getEntityRef()) self._versionsNavigator.setItem(index, 0, item) self._versionsNavigator.setCurrentCell(0, 0) self._updateNavigator(versions[-1].getEntityRef())
def setupUI(self): css_settings_global = """ QFrame { border: none; color: #FFF; } QCheckBox { color: #DDD; padding: 0px; background: none; } /*QComboBox { color: #DDD; padding: 2px; background: #333; }*/ QComboBox::drop-down { border-radius: 0px; } QToolButton { color: #DDD; padding: 0px; background: #333; } """ self.setStyleSheet(css_settings_global) main_layout = QtWidgets.QVBoxLayout(self) main_layout.setContentsMargins(0, 0, 0, 0) main_layout.setSpacing(5) settings_frame = QtWidgets.QFrame(self) layout_settings = QtWidgets.QHBoxLayout(settings_frame) layout_settings.setContentsMargins(0, 0, 0, 0) layout_settings.setSpacing(6) asset_types = ["All Asset Types"] + ['comp'] self._asset_connectors_cbbox = QtWidgets.QComboBox(self) self._asset_connectors_cbbox.addItems(asset_types) self._asset_connectors_cbbox.currentIndexChanged.connect( self._update_tree) self._asset_connectors_cbbox.setMaximumHeight(23) self._asset_connectors_cbbox.setMinimumWidth(100) self._asset_connectors_cbbox.setSizeAdjustPolicy( QtWidgets.QComboBox.AdjustToContents) self._refresh_btn = QtWidgets.QPushButton(self) self._refresh_btn.setText("refresh") self._refresh_btn.clicked.connect(self.initiate_assets_tree) spacer = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) layout_settings.addWidget(self._asset_connectors_cbbox) layout_settings.addItem(spacer) layout_settings.addWidget(self._refresh_btn) main_layout.addWidget(settings_frame) self.assets_tree = AssetsTree(self) main_layout.addWidget(self.assets_tree)
def setupUI(self): super(GizmoPublisherDialog, self).setupUI() self.resize(980, 640) gizmo_widget = QtWidgets.QWidget() gizmo_layout = QtWidgets.QVBoxLayout(gizmo_widget) gizmo_layout.setContentsMargins(5, 0, 0, 0) css_asset_global = """ QFrame { padding: 3px; background: #222; color: #FFF; font-size: 13px; } QLabel { padding: 0px; background: none; } """ css_asset_name = """ QLineEdit { padding: 3px; border: 1px solid #444; background: #333; color: #FFF; font-weight: bold; } """ css_asset_version = "color: #de8888; font-weight: bold;" asset_main_frame = QtWidgets.QFrame(self) asset_main_frame.setMinimumWidth(600) # comment this line to remove the black background on asset. asset_main_frame.setStyleSheet(css_asset_global) asset_main_frame_layout = QtWidgets.QHBoxLayout(asset_main_frame) asset_main_frame_layout.setSpacing(10) asset_name_lbl = QtWidgets.QLabel("Asset", asset_main_frame) self._asset_name = QtWidgets.QLineEdit(asset_main_frame) self._asset_name.setText("Gizmo") self._asset_name.textChanged.connect(self._validate_asset_name) self._asset_name.setStyleSheet(css_asset_name) asset_version_lbl = QtWidgets.QLabel("Version", asset_main_frame) self._asset_version = QtWidgets.QLabel("...", asset_main_frame) self._asset_version.setStyleSheet(css_asset_version) asset_main_frame_layout.addWidget(asset_name_lbl) asset_main_frame_layout.addWidget(self._asset_name) asset_main_frame_layout.addWidget(asset_version_lbl) asset_main_frame_layout.addWidget(self._asset_version) gizmo_layout.addWidget(asset_main_frame) file_layout = QtWidgets.QVBoxLayout() file_layout.setContentsMargins(0, 0, 0, 0) file_layout.setSpacing(8) browser_layout = QtWidgets.QHBoxLayout() browser_layout.setContentsMargins(0, 0, 0, 0) browser_layout.setSpacing(8) browser_label = QtWidgets.QLabel("Gizmo file", gizmo_widget) browser_edit_css = """ QLineEdit { border: 1px solid #666; background: #555; color: #000; } """ self._browser_edit = QtWidgets.QLineEdit(gizmo_widget) self._browser_edit.setStyleSheet(browser_edit_css) self._browser_edit.textChanged.connect(self.set_gizmo_file) completer = QtWidgets.QCompleter(gizmo_widget) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion) dir = QtWidgets.QDirModel(completer) dir.setFilter( QtCore.QDir.Dirs | QtCore.QDir.NoDot | QtCore.QDir.NoDotDot) completer.setModel(dir) self._browser_edit.setCompleter(completer) self._browser_btn = QtWidgets.QToolButton(gizmo_widget) self._browser_btn.setText("...") self._browser_btn.clicked.connect(self._browse_gizmo) browser_layout.addWidget(browser_label) browser_layout.addWidget(self._browser_edit) browser_layout.addWidget(self._browser_btn) file_layout.addItem(browser_layout) self._gizmo_file_content = ScriptEditorWidget(gizmo_widget) file_layout.addWidget(self._gizmo_file_content) self._gizmo_file_content.file_dropped.connect( self._initiate_dropped_file) gizmo_layout.addItem(file_layout) self._comment_widget = CommentWidget(gizmo_widget) self._comment_widget.setMaximumHeight(120) self._comment_widget.changed.connect(self._validate_gizmo) gizmo_layout.addWidget(self._comment_widget) self._save_btn.clicked.disconnect() self._save_btn.clicked.connect(self._publish) self.main_container_layout.addWidget(gizmo_widget) self._save_btn.setText("Publish Gizmo") self._save_btn.setMinimumWidth(150) self._save_btn.setEnabled(False) self.set_task(self.current_task)
def _updateNavigator(self, targetReference): '''Update navigator to display entries under *targetReference*.''' entity = self._bridge.getEntityById(targetReference) # Display path to entity. self._locationField.setText( self._bridge.getEntityPath(targetReference, slash=True, includeAssettype=True)) # Update selection. self._currentBrowsingId = targetReference entityType = self._bridge.getEntityType(targetReference) self._selectionValid = self._isValid(entityType, entity) self.clickedIdSignal.emit(self._currentBrowsingId) # Update details view. self._detailView.updateDetails(self._currentBrowsingId) # Update other navigators. if hasattr(entity, 'getVersions'): if self._showAssetVersions == True: self._updateVersionsNavigator(entity) self._versionsNavigator.show() return elif hasattr(entity, 'getComponents'): components = entity.getComponents() importableComponents = [] self._componentsNavigator.hide() for component in components: if self._componentNamesFilter: if not component in self._componentNamesFilter: continue if self._metaFilters: metaData = component.getMeta() # img_main to be replaced by settable option for metaFilter in self._metaFilters: if metaFilter in metaData: importableComponents.append(component) else: importableComponents.append(component) if len(importableComponents) > 1: self._updateComponentsNavigator(importableComponents) self._componentsNavigator.show() elif len(importableComponents) == 1: self._updateNavigator(importableComponents[0].getEntityRef()) return elif entityType == 'Task': return elif isinstance(entity, ftrack.Component): return else: self._versionsNavigator.hide() self._componentsNavigator.hide() # Update main navigator view. self._navigator.setRowCount(0) self._versionsNavigator.setRowCount(0) self._navigator.setHorizontalHeaderLabels( [self._bridge.getEntityName(targetReference)]) children = [] tasks = [] assets = [] if isinstance(entity, ftrack.Project) or isinstance( entity, ftrack.Task): children = entity.getChildren() if hasattr(entity, 'getTasks') and self._showTasks == True: tasks = entity.getTasks() if hasattr(entity, 'getAssets'): if (not isinstance(entity, ftrack.Project) and entity.getObjectType() in ['Shot', 'Sequence'] and self._showAssets == True): if self._componentNamesFilter: assets = entity.getAssets( componentNames=self._componentNamesFilter) else: assets = entity.getAssets() entities = children + tasks + assets entities = sorted(entities, key=lambda entity: self._bridge.getEntityName( entity.getEntityRef()).lower()) self._navigator.setRowCount(len(entities)) for index, entity in enumerate(entities): makeBold = None makeItalic = None makeDisabled = None if (isinstance(entity, ftrack.Task) and entity.getObjectType() in ['Shot', 'Sequence']): text = self._bridge.getEntityName(entity.getEntityRef()) + '/' makeBold = True elif (isinstance(entity, ftrack.Task) and entity.getObjectType() in ['Task']): text = self._bridge.getEntityName(entity.getEntityRef()) makeItalic = True if isinstance(entity.getParent(), ftrack.Project): makeDisabled = True elif isinstance(entity, ftrack.Asset): text = (self._bridge.getEntityName(entity.getEntityRef()) + '.' + entity.getType().getShort()) else: text = self._bridge.getEntityName(entity.getEntityRef()) if entityType == 'Sequence' and self._shotsEnabled == False: makeDisabled = True item = QtWidgets.QTableWidgetItem(text) item.setData(QtCore.Qt.UserRole, entity.getEntityRef()) icon = self._getIcon(entity) if icon: item.setIcon(icon) if makeDisabled: item.setFlags(QtCore.Qt.NoItemFlags) self._navigator.setItem(index, 0, item) if makeBold: font = QtGui.QFont() font.setBold(True) self._navigator.item(index, 0).setFont(font) elif makeItalic: font = QtGui.QFont() font.setItalic(True) self._navigator.item(index, 0).setFont(font)
def setupUI(self): css_task_global = """ QLabel { padding: 0px; background: none; } /*QTabWidget::pane { border-top: 2px solid #151515; top: -2px;} QTabBar::tab { padding: 6px 10px; background: #151515; border-top: 2px solid #151515; border-right: 2px solid #151515; border-left: 2px solid #151515; border-radius: 0px; } QTabBar::tab:selected { background: #333; border-top-left-radius: 4px; border-top-right-radius: 4px; } QTabBar::tab:hover { background: #222; } QTabBar::tab:!selected { margin-top: 2px; }*/ """ css_task_name_lbl = "font-size: 13px;" css_task_name = "color: #c3cfa4; font-size: 13px; font-weight: bold;" self.setStyleSheet(css_task_global) task_frame_layout = QtWidgets.QVBoxLayout(self) task_frame_layout.setContentsMargins(0, 0, 0, 0) task_frame_layout.setSpacing(15) # Display Task infos task_info_layout = QtWidgets.QFormLayout() task_info_layout.setContentsMargins(10, 10, 10, 10) task_info_layout.setSpacing(10) task_name_lbl = QtWidgets.QLabel("Task", self) task_name_lbl.setStyleSheet(css_task_name_lbl) self._task_name = QtWidgets.QLabel(self._t_name, self) self._task_name.setStyleSheet(css_task_name) project_lbl = QtWidgets.QLabel("Project", self) self._project_name = QtWidgets.QLabel(self._t_project_name, self) shot_lbl = QtWidgets.QLabel("Shot", self) shot_layout = QtWidgets.QHBoxLayout() shot_layout.setSpacing(6) self._shot_name = QtWidgets.QLabel(self) self._separator_shot = QtWidgets.QLabel("/", self) self._separator_shot.setVisible(False) self._sequence_name = QtWidgets.QLabel(self) spacer_shot = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) shot_layout.addWidget(self._sequence_name) shot_layout.addWidget(self._separator_shot) shot_layout.addWidget(self._shot_name) shot_layout.addItem(spacer_shot) shot_status_lbl = QtWidgets.QLabel("Shot status", self) shot_status = ftrack.getShotStatuses() self._shot_status = StatusWidget(shot_status, self) task_status_lbl = QtWidgets.QLabel("Task status", self) task_status = ftrack.getTaskStatuses() self._task_status = StatusWidget(task_status, self) due_date_lbl = QtWidgets.QLabel("Due date", self) self._due_date = QtWidgets.QLabel(self) task_info_layout.setWidget(0, QtWidgets.QFormLayout.LabelRole, task_name_lbl) task_info_layout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self._task_name) task_info_layout.setWidget(1, QtWidgets.QFormLayout.LabelRole, project_lbl) task_info_layout.setWidget(1, QtWidgets.QFormLayout.FieldRole, self._project_name) task_info_layout.setWidget(2, QtWidgets.QFormLayout.LabelRole, shot_lbl) task_info_layout.setItem(2, QtWidgets.QFormLayout.FieldRole, shot_layout) task_info_layout.setWidget(3, QtWidgets.QFormLayout.LabelRole, shot_status_lbl) task_info_layout.setWidget(3, QtWidgets.QFormLayout.FieldRole, self._shot_status) task_info_layout.setWidget(4, QtWidgets.QFormLayout.LabelRole, task_status_lbl) task_info_layout.setWidget(4, QtWidgets.QFormLayout.FieldRole, self._task_status) task_info_layout.setWidget(5, QtWidgets.QFormLayout.LabelRole, due_date_lbl) task_info_layout.setWidget(5, QtWidgets.QFormLayout.FieldRole, self._due_date) task_frame_layout.addItem(task_info_layout) self._tab_widget = QtWidgets.QTabWidget(self) # Display Nuke Assets from this task self.tab_asset_tree = QtWidgets.QWidget() self.tab_asset_tree.busy_overlay = LoadingOverlay(self.tab_asset_tree) self.tab_asset_tree.busy_overlay.hide() tab_asset_tree_layout = QtWidgets.QVBoxLayout(self.tab_asset_tree) tab_asset_tree_layout.setContentsMargins(0, 8, 0, 0) self.assets_widget = SceneAssetsWidget(self) self.assets_widget.worker_started.connect( self.tab_asset_tree.busy_overlay.show) self.assets_widget.worker_started.connect( self.tab_asset_tree.busy_overlay.raise_) self.assets_widget.worker_stopped.connect( self.tab_asset_tree.busy_overlay.hide) tab_asset_tree_layout.addWidget(self.assets_widget) self._tab_widget.addTab(self.tab_asset_tree, "All Scene Assets") task_frame_layout.addWidget(self._tab_widget)
def setupUI(self): main_layout = QtWidgets.QVBoxLayout(self) main_layout.setContentsMargins(0, 0, 0, 0) main_layout.setSpacing(0) self._script_editor_tree = ScriptEditorTreeView(self) self._script_editor_tree.setSelectionMode( QtWidgets.QAbstractItemView.NoSelection) self._script_editor_tree.setIndentation(20) self._script_editor_tree.setAnimated(True) self._script_editor_tree.setHeaderHidden(True) self._script_editor_tree.setExpandsOnDoubleClick(True) self._script_editor_tree.file_dropped.connect(self._emit_dropped_file) main_layout.addWidget(self._script_editor_tree) self._option_frame = QtWidgets.QFrame(self) option_layout = QtWidgets.QHBoxLayout(self._option_frame) option_layout.setContentsMargins(0, 8, 0, 8) option_layout.setSpacing(8) # filter_lbl = QtGui.QLabel("Filter", self._option_frame) css_filter = """ QLineEdit { border: 1px solid #666; background: #555; color: #000; } """ self._filter_edit = QtWidgets.QLineEdit(self._option_frame) self._filter_edit.setMaximumHeight(20) # self._filter_edit.setStyleSheet(css_filter) self._filter_edit.textChanged.connect(self._set_filter) self._previous_occurence = QtWidgets.QPushButton( 'previous', self._option_frame) # self._previous_occurence.setArrowType(QtCore.Qt.LeftArrow) # self._previous_occurence.setMaximumWidth(20) # self._previous_occurence.setMaximumHeight(20) self._next_occurence = QtWidgets.QPushButton('next', self._option_frame) # self._next_occurence.setArrowType(QtCore.Qt.RightArrow) # self._next_occurence.setMaximumWidth(20) # self._next_occurence.setMaximumHeight(20) spacer = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self._collapse_all_btn = QtWidgets.QPushButton("Collapse All", self._option_frame) self._collapse_all_btn.setMaximumHeight(20) # self._collapse_all_btn.setStyleSheet(css_btn) self._collapse_all_btn.clicked.connect( self._script_editor_tree.collapseAll) self._expand_all_btn = QtWidgets.QPushButton("Expand All", self._option_frame) self._expand_all_btn.setMaximumHeight(20) # self._expand_all_btn.setStyleSheet(css_btn) self._expand_all_btn.clicked.connect( self._script_editor_tree.expandAll) option_layout.addWidget(self._filter_edit) option_layout.addWidget(self._previous_occurence) option_layout.addWidget(self._next_occurence) option_layout.addItem(spacer) option_layout.addWidget(self._collapse_all_btn) option_layout.addWidget(self._expand_all_btn) main_layout.addWidget(self._option_frame)
def __init__(self, parent=None): '''Initialise widget with *parent*.''' super(NukeCrew, self).__init__(parent=parent) ftrack_connect.ui.theme.applyTheme(self, 'integration') self.setMinimumWidth(400) self.setSizePolicy( QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)) self.vertical_layout = QtWidgets.QVBoxLayout(self) self.horizontal_layout = QtWidgets.QHBoxLayout() self.header = Header(username=getpass.getuser(), parent=self) self.vertical_layout.addWidget(self.header) self.notification_list = _notification_list.Notification(self) self._hub = ftrack_connect_nuke.crew_hub.crew_hub self._classifier = UserClassifier() self._classifier.update_context(self._read_context_from_environment()) current_user = ftrack.getUser(getpass.getuser()) groups = ['Assigned', 'Contributors', 'Supervisors'] self.chat = _crew.Crew(groups, current_user, hub=self._hub, classifier=self._classifier, parent=self) self.chat.chat.busyOverlay.setStyleSheet(NUKE_OVERLAY_STYLE) added_user_ids = [] for _user in session.query('select id, username, first_name, last_name' ' from User where is_active is True'): if _user['id'] != current_user.getId(): self.chat.addUser( u'{0} {1}'.format(_user['first_name'], _user['last_name']), _user['id']) added_user_ids.append(_user['id']) self.tab_panel = QtWidgets.QTabWidget(parent=self) self.tab_panel.addTab(self.chat, 'Chat') self.tab_panel.addTab(self.notification_list, 'Notifications') self.horizontal_layout.addWidget(self.tab_panel) # TODO: This styling should probably be done in a global stylesheet # for the entire Nuke plugin. self.notification_list.overlay.setStyleSheet(NUKE_OVERLAY_STYLE) self.vertical_layout.setContentsMargins(0, 0, 0, 0) self.vertical_layout.addLayout(self.horizontal_layout) self.setObjectName('Crew') self.setWindowTitle('Crew') # Import inline to avoid mysterious segfault in nuke 9.1dev build. from ftrack_connect.connector.panelcom import (PanelComInstance as _PanelComInstance) panel_communication_singleton = _PanelComInstance.instance() panel_communication_singleton.addRefreshListener(self.on_refresh_event) self.on_refresh_event() if not self._hub.compatibleServerVersion: logging.info('Incompatible server version.') self.blockingOverlay = ftrack_connect.ui.widget.overlay.BlockingOverlay( self, message='Incompatible server version.') self.blockingOverlay.setStyleSheet(NUKE_OVERLAY_STYLE) self.blockingOverlay.show() else: self._hub.populateUnreadConversations(current_user.getId(), added_user_ids)
def updateDetails(self, identifier): '''Update view for entity referenced by *identifier*.''' self.setEnabled(True) entity = self._bridge.getEntityById(identifier) name = self._bridge.getEntityName(entity.getEntityRef()) self._propertyTable.setItem(0, 0, QtWidgets.QTableWidgetItem(name)) assetVersion = None thumbnailUrl = None if isinstance(entity, ftrack.Asset): assetVersion = entity.getVersions()[-1] elif isinstance(entity, ftrack.AssetVersion): assetVersion = entity elif isinstance(entity, ftrack.Component): assetVersion = entity.getVersion() if assetVersion: thumbnailUrl = assetVersion.getThumbnail() authorUser = assetVersion.getUser() version = str(assetVersion.getVersion()) comment = assetVersion.getComment() date = str(assetVersion.getDate()) author = authorUser.getName().encode('utf-8') self._propertyTable.setRowHidden(1, False) self._propertyTable.setRowHidden(2, False) self._propertyTable.setRowHidden(3, False) self._propertyTable.setRowHidden(4, False) self._propertyTable.setRowHidden(5, True) self._propertyTable.setRowHidden(6, True) self._propertyTable.setItem(0, 1, QtWidgets.QTableWidgetItem(author)) self._propertyTable.setItem(0, 3, QtWidgets.QTableWidgetItem(date)) self._propertyTable.setItem(0, 2, QtWidgets.QTableWidgetItem(version)) self._propertyTable.setItem(0, 4, QtWidgets.QTableWidgetItem(comment)) else: if hasattr(entity, 'getThumbnail'): thumbnailUrl = entity.getThumbnail() statusName = '' if hasattr(entity, 'getStatus'): status = entity.getStatus() if status: statusName = status.getName() priorityName = '' if hasattr(entity, 'getPriority'): priority = entity.getPriority() if priority: priorityName = priority.getName() self._propertyTable.setRowHidden(1, True) self._propertyTable.setRowHidden(2, True) self._propertyTable.setRowHidden(3, True) self._propertyTable.setRowHidden(4, True) self._propertyTable.setRowHidden(5, False) self._propertyTable.setRowHidden(6, False) self._propertyTable.setItem(0, 5, QtWidgets.QTableWidgetItem(statusName)) self._propertyTable.setItem( 0, 6, QtWidgets.QTableWidgetItem(priorityName)) if not thumbnailUrl: thumbnailUrl = self._placholderThumbnail self._updateThumbnail(self._thumbnail, thumbnailUrl) self._propertyTable.resizeRowsToContents()
def setupUI(self, parent): self._refresh = QtWidgets.QToolButton(parent) self._refresh.setMaximumSize(QtCore.QSize(45, 15)) button_css_refresh = """ QToolButton{background:transparent; border:none; color: rgba(255,255,255,80);} QToolButton:hover{color: rgba(255,255,255,200);} QToolButton:pressed{color: rgba(255,255,255,255);} """ self._refresh.setStyleSheet(button_css_refresh) self._refresh.move(parent.width() - self._refresh.width() - 10, 5) self._refresh.setText("refresh") self._refresh.clicked.connect(self.refresh) button_css = """ QToolButton{ background:rgba(255,255,255,50); border:none; color: rgba(255,255,255,80); border-radius: 5px; } QToolButton:hover{ background:rgba(255,255,255,120); color: rgba(255,255,255,200); } QToolButton:pressed{ background:rgba(255,255,255,80); color: rgba(255,255,255,255); } """ # Colors buttons left_gap = 10 top_padding = 80 self._color_white = QtWidgets.QToolButton(parent) self._color_white.setMaximumSize(QtCore.QSize(20, 20)) self._color_white.move(left_gap, parent.height() - top_padding) self._color_white.clicked.connect(self._toggle_color) left_gap += self._color_white.width() + 10 self._color_black = QtWidgets.QToolButton(parent) self._color_black.setMaximumSize(QtCore.QSize(20, 20)) self._color_black.move(left_gap, parent.height() - top_padding) self._color_black.clicked.connect(self._toggle_color) left_gap += self._color_black.width() + 10 self._color_red = QtWidgets.QToolButton(parent) self._color_red.setMaximumSize(QtCore.QSize(20, 20)) self._color_red.move(left_gap, parent.height() - top_padding) self._color_red.clicked.connect(self._toggle_color) left_gap += self._color_red.width() + 10 self._color_green = QtWidgets.QToolButton(parent) self._color_green.setMaximumSize(QtCore.QSize(20, 20)) self._color_green.move(left_gap, parent.height() - top_padding) self._color_green.clicked.connect(self._toggle_color) left_gap += self._color_green.width() + 10 self._color_blue = QtWidgets.QToolButton(parent) self._color_blue.setMaximumSize(QtCore.QSize(20, 20)) self._color_blue.move(left_gap, parent.height() - top_padding) self._color_blue.clicked.connect(self._toggle_color) left_gap += self._color_blue.width() + 10 self._color_yellow = QtWidgets.QToolButton(parent) self._color_yellow.setMaximumSize(QtCore.QSize(20, 20)) self._color_yellow.move(left_gap, parent.height() - top_padding) self._color_yellow.clicked.connect(self._toggle_color) self._activate_color_button("white", False) self._activate_color_button("black", False) self._activate_color_button("red", True) # default self._activate_color_button("green", False) self._activate_color_button("blue", False) self._activate_color_button("yellow", False) # Edit buttons left_gap = 10 self._fit_screen = QtWidgets.QToolButton(parent) self._fit_screen.setMaximumSize(QtCore.QSize(20, 20)) self._fit_screen.setStyleSheet(button_css) self._fit_screen.move(left_gap, 5) self._fit_screen.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self._fit_screen.clicked.connect(self.fit_screen) self.activate_button(self._fit_screen, "fitscreen") left_gap += self._fit_screen.width() + 10 self._zoom_out = QtWidgets.QToolButton(parent) self._zoom_out.setMaximumSize(QtCore.QSize(20, 20)) self._zoom_out.setStyleSheet(button_css) self._zoom_out.move(left_gap, 5) self._zoom_out.setText("-") self._zoom_out.clicked.connect(self.zoom_out) left_gap += self._zoom_out.width() + 10 self._zoom_in = QtWidgets.QToolButton(parent) self._zoom_in.setMaximumSize(QtCore.QSize(20, 20)) self._zoom_in.setStyleSheet(button_css) self._zoom_in.move(left_gap, 5) self._zoom_in.setText("+") self._zoom_in.clicked.connect(self.zoom_in) left_gap += self._zoom_in.width() + 10 self._drag = QtWidgets.QToolButton(parent) self._drag.setMaximumSize(QtCore.QSize(20, 20)) self._drag.move(left_gap, 5) self._drag.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self._drag.clicked.connect(self._toggle_handscroll_mode) self.set_handscroll_mode(self._handscroll_mode) left_gap += self._drag.width() + 10 self._pencil = QtWidgets.QToolButton(parent) self._pencil.setMaximumSize(QtCore.QSize(20, 20)) self._pencil.move(left_gap, 5) self._pencil.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self._pencil.clicked.connect(self._toggle_drawing_mode) self.set_drawing_mode(self._drawing_mode) left_gap += self._pencil.width() + 10 self._eraser = QtWidgets.QToolButton(parent) self._eraser.setMaximumSize(QtCore.QSize(20, 20)) self._eraser.move(left_gap, 5) self._eraser.setToolButtonStyle(QtCore.Qt.ToolButtonIconOnly) self._eraser.clicked.connect(self._toggle_eraser) self.activate_button(self._eraser, "eraser", hover_emphasize=True)
def _build(self): '''Build and layout widget.''' layout = QtWidgets.QVBoxLayout() layout.setSpacing(2) layout.setContentsMargins(6, 6, 6, 6) self.setLayout(layout) formLayout = QtWidgets.QGridLayout() layout.addLayout(formLayout) self._nameLabel = QtWidgets.QLabel('Name') formLayout.addWidget(self._nameLabel, 2, 0, 1, 1) self._nameInput = QtWidgets.QLineEdit() formLayout.addWidget(self._nameInput, 2, 1, 1, 1) self._typeLabel = QtWidgets.QLabel('Type') self._typeLabel.setEnabled(True) formLayout.addWidget(self._typeLabel, 1, 0, 1, 1) self._typeSelector = QtWidgets.QComboBox() self._typeSelector.setEnabled(True) formLayout.addWidget(self._typeSelector, 1, 1, 1, 1) self._objectLabel = QtWidgets.QLabel('Object') formLayout.addWidget(self._objectLabel, 0, 0, 1, 1) self._objectSelector = QtWidgets.QComboBox() formLayout.addWidget(self._objectSelector, 0, 1, 1, 1) controlsLayout = QtWidgets.QHBoxLayout() layout.addLayout(controlsLayout) spacerItem = QtWidgets.QSpacerItem(10, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) controlsLayout.addItem(spacerItem) self._cancelButton = QtWidgets.QPushButton('Cancel') controlsLayout.addWidget(self._cancelButton) self._createButton = QtWidgets.QPushButton('Create') self._createButton.setAutoDefault(True) self._createButton.setDefault(True) controlsLayout.addWidget(self._createButton)
def _build(self): '''Build and layout widget.''' layout = QtWidgets.QVBoxLayout() self.setLayout(layout) # Header header = ftrack_connect.ui.widget.header.Header( getpass.getuser(), self) header.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Fixed) layout.addWidget(header) secondaryHeader = QtWidgets.QFrame() headerLayout = QtWidgets.QHBoxLayout() headerLayout.setContentsMargins(0, 0, 0, 0) secondaryHeader.setLayout(headerLayout) layout.addWidget(secondaryHeader) self._createButton = QtWidgets.QToolButton() self._createButton.setIcon( QtGui.QIcon.fromTheme('plus', QtGui.QIcon(':icon-plus'))) headerLayout.addWidget(self._createButton) self._navigateUpButton = QtWidgets.QToolButton() self._navigateUpButton.setIcon( QtGui.QIcon.fromTheme('go-up', QtGui.QIcon(':icon-arrow-up'))) headerLayout.addWidget(self._navigateUpButton) headerLayout.addStretch(1) # Bookmarks contentSplitter = QtWidgets.QSplitter() layout.addWidget(contentSplitter) self._bookmarksView = QtWidgets.QTableWidget() self._bookmarksView.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._bookmarksView.setGridStyle(QtCore.Qt.NoPen) self._bookmarksView.setColumnCount(1) self._bookmarksView.setColumnCount(1) self._bookmarksView.setRowCount(0) self._bookmarksView.horizontalHeader().setVisible(False) self._bookmarksView.horizontalHeader().setStretchLastSection(True) self._bookmarksView.verticalHeader().setVisible(False) self._bookmarksView.verticalHeader().setDefaultSectionSize(25) contentSplitter.addWidget(self._bookmarksView) # Navigation self._navigator = QtWidgets.QTableWidget() self._navigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._navigator.setGridStyle(QtCore.Qt.NoPen) self._navigator.setColumnCount(1) self._navigator.horizontalHeader().setStretchLastSection(True) self._navigator.verticalHeader().hide() self._navigator.setHorizontalHeaderLabels(['Name']) contentSplitter.addWidget(self._navigator) self._versionsNavigator = QtWidgets.QTableWidget() self._versionsNavigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._versionsNavigator.setGridStyle(QtCore.Qt.NoPen) self._versionsNavigator.setColumnCount(1) self._versionsNavigator.verticalHeader().hide() self._versionsNavigator.setSortingEnabled(False) self._versionsNavigator.setHorizontalHeaderLabels(['Version']) contentSplitter.addWidget(self._versionsNavigator) self._componentsNavigator = QtWidgets.QTableWidget() self._componentsNavigator.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) self._componentsNavigator.setColumnCount(1) self._componentsNavigator.horizontalHeader().setStretchLastSection( True) self._componentsNavigator.verticalHeader().hide() self._componentsNavigator.verticalHeader().setStretchLastSection(False) self._componentsNavigator.setHorizontalHeaderLabels(['Component']) contentSplitter.addWidget(self._componentsNavigator) # Details self._detailView = ftrack_connect_foundry.ui.detail_view.DetailView( self._bridge) contentSplitter.addWidget(self._detailView) # Location self._locationField = QtWidgets.QLineEdit() layout.addWidget(self._locationField) self._locationOptions = QtWidgets.QFrame() layout.addWidget(self._locationOptions) locationOptionsLayout = QtWidgets.QHBoxLayout() locationOptionsLayout.setContentsMargins(0, 0, 0, 0) self._locationOptions.setLayout(locationOptionsLayout) self._assetNameField = QtWidgets.QLineEdit() self._assetNameField.setEnabled(False) locationOptionsLayout.addWidget(self._assetNameField) self._overrideNameHintOption = QtWidgets.QCheckBox( 'Specify Asset Name') locationOptionsLayout.addWidget(self._overrideNameHintOption)
def ftrackPublishKnobChanged(forceRefresh=False, g=None): g = g or nuke.thisNode() if 'ftable' in g.knobs(): header = getHeaderKnob(g) nodeAssetType = '' if nuke.thisKnob().name() in ['inputChange', 'fscript' ] or forceRefresh == True: thisNodeName = g['name'].value() g = nuke.toNode(HelpFunctions.safeString(thisNodeName)) # Add new labels cmdString = '' assetType = None availableAssetTypes = [''] inputMissmatch = None tableWidget = g['ftable'].getObject().tableWidget tableWidget.setRowCount(0) components = [] for inputNode in range(g.inputs()): inNode = g.input(inputNode) if inNode: if inNode.Class() in ['Read', 'Write']: nodeAssetType = 'img' elif inNode.Class() in ['WriteGeo']: nodeAssetType = 'geo' else: nodeAssetType = '' if not assetType: assetType = nodeAssetType if assetType != nodeAssetType: inputMissmatch = True if nodeAssetType == 'img': fileComp = str(inNode['file'].value()) proxyComp = str(inNode['proxy'].value()) nameComp = str(inNode['name'].value()).strip() if inNode.Class() == 'Read': first = str(inNode['first'].value()) last = str(inNode['last'].value()) if first == '0.0' and last == '0.0': first = str( int(nuke.root().knob( "first_frame").value())) last = str( int(nuke.root().knob( "last_frame").value())) availableAssetTypes = ['img', 'render'] elif inNode.Class() == 'Write': # use the timeline to define the amount of frames first = str( int(nuke.root().knob("first_frame").value())) last = str( int(nuke.root().knob("last_frame").value())) # then in case check if the limit are set if inNode['use_limit'].value(): first = str(inNode['first'].value()) last = str(inNode['last'].value()) # always check how many frames are actually available frames = inNode['file'].value() try: # Try to collect the sequence prefix, padding # and extension. If this fails with a ValueError # we are probably handling a non-sequence file. # If so rely on the first_frame and last_frame # of the root node. prefix, padding, extension = frames.split('.') except ValueError: FnAssetAPI.logging.debug( 'Could not determine prefix, padding ' 'and extension from "".'.format(frames)) availableAssetTypes = ['render'] else: root = os.path.dirname(prefix) files = glob.glob('{0}/*.{1}'.format( root, extension)) collections = clique.assemble(files) for collection in collections[0]: if prefix in collection.head: indexes = list(collection.indexes) first = str(indexes[0]) last = str(indexes[-1]) break availableAssetTypes = ['img'] try: compNameComp = inNode['fcompname'].value() except: compNameComp = '' if compNameComp == '': compNameComp = nameComp components.append( (fileComp, compNameComp, first, last, nameComp)) if proxyComp != '': components.append( (proxyComp, compNameComp + '_proxy', first, last, nameComp)) elif nodeAssetType == 'geo': fileComp = str(inNode['file'].value()) nameComp = str(inNode['name'].value()).strip() first = str(inNode['first'].value()) last = str(inNode['last'].value()) if first == '0.0' and last == '0.0': first = str( int(nuke.root().knob("first_frame").value())) last = str( int(nuke.root().knob("last_frame").value())) try: compNameComp = inNode['fcompname'].value() except: compNameComp = '' if compNameComp == '': compNameComp = nameComp components.append( (fileComp, compNameComp, first, last, nameComp)) availableAssetTypes = ['geo', 'cam'] rowCount = len(components) tableWidget.setRowCount(rowCount) if len(components) == 0: g.knob('pknob').setEnabled(False) else: g.knob('pknob').setEnabled(True) l = [x[1] for x in components] wodup = list(set(l)) if len(l) != len(wodup): g.knob('pknob').setEnabled(False) header.setMessage('Components can not have the same name', 'warning') rowCntr = 0 for comp in components: cb = QtWidgets.QCheckBox('') cb.setChecked(True) tableWidget.setCellWidget(rowCntr, 0, cb) componentItem = QtWidgets.QTableWidgetItem() componentItem.setText(comp[0]) componentItem.setToolTip(comp[0]) tableWidget.setItem(rowCntr, 1, componentItem) componentItem = QtWidgets.QTableWidgetItem() componentItem.setText(comp[1]) componentItem.setToolTip(comp[1]) tableWidget.setItem(rowCntr, 2, componentItem) try: fileCurrentFrame = nukescripts.replaceHashes( comp[0]) % int(float(comp[2])) except: print 'File is not sequence' fileCurrentFrame = comp[0] if os.path.isfile(fileCurrentFrame): fileExist = 'T' else: fileExist = 'F' componentItem = QtWidgets.QTableWidgetItem() if fileExist == 'T': componentItem.setBackground(QtGui.QColor(20, 161, 74)) else: componentItem.setBackground(QtGui.QColor(227, 99, 22)) componentItem.setToolTip(fileExist) tableWidget.setItem(rowCntr, 4, componentItem) componentItem = QtWidgets.QTableWidgetItem() componentItem.setText(comp[2]) componentItem.setToolTip(comp[2]) tableWidget.setItem(rowCntr, 5, componentItem) componentItem = QtWidgets.QTableWidgetItem() componentItem.setText(comp[3]) componentItem.setToolTip(comp[3]) tableWidget.setItem(rowCntr, 6, componentItem) componentItem = QtWidgets.QTableWidgetItem() componentItem.setText(comp[4]) componentItem.setToolTip(comp[4]) tableWidget.setItem(rowCntr, 3, componentItem) rowCntr += 1 g['ftrackassettype'].setValues(availableAssetTypes) if inputMissmatch: tableWidget.setRowCount(0) g['ftrackassettype'].setValues(['Missmatch inputs']) if cmdString == '': cmdString = 'No inputs connected' assetEnums = ['New'] if nodeAssetType != '': # assets = connector.Connector.objectById(os.environ['FTRACK_SHOTID']).getAssets(assetTypes=[g['ftrackassettype'].value()]) pubto = g.knob('fpubto').getObject().targetTask assets = connector.Connector.objectById(pubto).getAssets( assetTypes=[g['ftrackassettype'].value()]) assets = sorted(assets, key=lambda entry: entry.getName().lower()) assetEnums = assetEnums + [ HelpFunctions.safeString(x.getName()) for x in assets ] FnAssetAPI.logging.info(assetEnums) g['fassetnameexisting'].setValues(assetEnums) g = nuke.toNode(HelpFunctions.safeString(thisNodeName)) g.begin() # Add more inputs if full realInputCount = 0 for inputNode in range(g.inputs()): if g.input(inputNode): realInputCount += 1 if realInputCount == g.maxInputs(): inputNode = nuke.createNode("Input", inpanel=False) g.end() elif nuke.thisKnob().name() == 'ftrackassettype': nodeAssetType = g['ftrackassettype'].value() #print nodeAssetType assetEnums = ['New'] if nodeAssetType != '' and nodeAssetType != 'Missmatch inputs': # assets = connector.Connector.objectById(os.environ['FTRACK_SHOTID']).getAssets(assetTypes=[nodeAssetType]) pubto = g.knob('fpubto').getObject().targetTask assets = connector.Connector.objectById(pubto).getAssets( assetTypes=[nodeAssetType]) assetEnums = assetEnums + [ HelpFunctions.safeString(x.getName()) for x in assets ] g['fassetnameexisting'].setValues(assetEnums)
def setupUI(self): self.setMinimumSize(self._widget_size) self.setMaximumSize(self._widget_size) layout = QtWidgets.QVBoxLayout(self) layout.setContentsMargins(0, 0, 0, 0) layout.setSpacing(0) self._snapshot_frame = QtWidgets.QFrame(self) self._snapshot_frame.setMinimumSize(self._widget_size) self._snapshot_frame.setMaximumSize(self._widget_size) self._stackLayout = QtWidgets.QStackedLayout() self._stackLayout.setContentsMargins(0, 0, 0, 0) layout_images = QtWidgets.QHBoxLayout(self._snapshot_frame) layout_images.setContentsMargins(0, 0, 0, 0) layout_images.addLayout(self._stackLayout) self._viewer_view = SnapshotsView("Viewer", self._snapshot_frame) self._stackLayout.addWidget(self._viewer_view) self._dag_view = SnapshotsView("DAG", self._snapshot_frame) self._stackLayout.addWidget(self._dag_view) self._no_snapshot = QtWidgets.QFrame(self._snapshot_frame) self._no_snapshot.setStyleSheet( "QFrame{/*background: #000;*/ border:0px;}") layout_no_snapshot = QtWidgets.QHBoxLayout(self._no_snapshot) label_no_snapshot = QtWidgets.QLabel( "No snapshot available...", self._no_snapshot) label_no_snapshot.setStyleSheet("color:#855") label_no_snapshot.setAlignment( QtCore.Qt.AlignCenter | QtCore.Qt.AlignVCenter) layout_no_snapshot.addWidget(label_no_snapshot) self._stackLayout.addWidget(self._no_snapshot) self._edit_buttons = SnapshotsEditButtons( False, False, self._snapshot_frame) self._edit_buttons.refresh_toggled.connect(self.initiate_snapshots) self._edit_buttons.zoom_level_toggled.connect(self.zoom_level) self._edit_buttons.handscroll_mode_toggled.connect( self.set_handscroll_mode) self._edit_buttons.drawing_mode_toggled.connect(self.set_drawing_mode) self._edit_buttons.eraser_toggled.connect(self.erase_drawing) self._edit_buttons.color_modified.connect(self.set_pen_color) self.target_button_container = QtWidgets.QWidget(self) self.target_button_container_layout = QtWidgets.QHBoxLayout() self.target_button_container.setLayout(self.target_button_container_layout) self._viewer_btn = QtWidgets.QPushButton("Use Active Viewer", self) self._viewer_btn.setObjectName("Viewer_btn") self._viewer_btn.clicked.connect(self.chooseSource) self._dag_btn = QtWidgets.QPushButton("Use Node Graph", self) self._dag_btn.setObjectName("DAG_btn") self._dag_btn.clicked.connect(self.chooseSource) self.target_button_container_layout.addWidget(self._viewer_btn) self.target_button_container_layout.addWidget(self._dag_btn) layout.addWidget(self._snapshot_frame) layout.addWidget(self.target_button_container)