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 _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)