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