def _create_features_ui(self): layout = self._create_features_headers() self.density_sbx = QtWidgets.QDoubleSpinBox() self.density_sbx.setFixedWidth(50) self.scale_min_sbx = QtWidgets.QDoubleSpinBox() self.scale_min_sbx.setFixedWidth(50) self.scale_max_sbx = QtWidgets.QDoubleSpinBox() self.scale_max_sbx.setFixedWidth(50) self.rotation_sbx = QtWidgets.QDoubleSpinBox() self.rotation_sbx.setFixedWidth(50) self.align_to_normals_checkbox = QtWidgets.QCheckBox() # self.rotation_slider = QtWidgets.QSlider(QtCore.Qt.Horizontal) self.spacing = QtWidgets.QLabel("") layout.addWidget(self.density_sbx, 0, 1) layout.addWidget(self.scale_min_sbx, 2, 1) layout.addWidget(self.scale_max_sbx, 2, 2) layout.addWidget(self.rotation_sbx, 3, 1) layout.addWidget(self.align_to_normals_checkbox, 5, 1) layout.addWidget(self.spacing, 0, 2) layout.addWidget(self.spacing, 0, 3) layout.addWidget(self.spacing, 0, 4) layout.addWidget(self.spacing, 0, 5) return layout
def populate_scanline(self): import nuke if len(nuke.allNodes('ScanlineRender')) == 0: self.append_to_log('INFO: No ScanlineRender nodes found', 'orange') for node in nuke.allNodes('ScanlineRender'): row = self.ui.scanline_table.rowCount() self.ui.scanline_table.insertRow(self.ui.scanline_table.rowCount()) scanline_name = QtWidgets.QTableWidgetItem() scanline_name.setTextAlignment(QtCore.Qt.AlignCenter) scanline_name.setText(node.name()) scanline_name.setFlags(QtCore.Qt.ItemIsEditable) scanline_name.setForeground( QtGui.QBrush(QtGui.QColor(QtCore.Qt.white))) self.ui.scanline_table.setItem(row, 0, scanline_name) aa_filter = QtWidgets.QComboBox() aa_filter.addItems([ 'Impulse', 'Cubic', 'Keys', 'Simon', 'Rifman', 'Mitchell', 'Parzen', 'Notch', 'Lanczos4', 'Lanczos6', 'Sinc4', 'Nearest', 'Bilinear', 'Trilinear', 'Anisotropic' ]) aa_filter.setCurrentIndex(node['filter'].getValue()) self.ui.scanline_table.setCellWidget(row, 1, aa_filter) aa_options = QtWidgets.QComboBox() aa_options.addItems(['None', 'Low', 'Medium', 'High']) aa_options.setCurrentIndex(node['antialiasing'].getValue()) self.ui.scanline_table.setCellWidget(row, 2, aa_options) aa_samples = QtWidgets.QSpinBox() aa_samples.setMinimum(0) aa_samples.setMaximum(50) aa_samples.setValue(node['samples'].getValue()) self.ui.scanline_table.setCellWidget(row, 3, aa_samples) aa_shutter = QtWidgets.QDoubleSpinBox() aa_shutter.setMinimum(-10) aa_shutter.setMaximum(10) aa_shutter.setSingleStep(0.25) aa_shutter.setValue(node['shutter'].getValue()) self.ui.scanline_table.setCellWidget(row, 4, aa_shutter) self.append_to_log( 'Found ScanlineRender node {}, added to list'.format( node.name()), 'lime')
def __init__(self, label=None, maxRange=1000, singleStep=0.025, parent=None): super(Vector3Control, self).__init__(parent) # Create a Horizontal Box Layout parent_layout = QtWidgets.QHBoxLayout() # Create and setup individual float spin box widgets self._x = QtWidgets.QDoubleSpinBox() self._y = QtWidgets.QDoubleSpinBox() self._z = QtWidgets.QDoubleSpinBox() for k, v in {"X": self._x, "Y": self._y, "Z": self._z}.items(): v.setRange(-maxRange, maxRange) v.setSingleStep(singleStep) v.valueChanged.connect(self.__changeValue) parent_layout.addWidget(QtWidgets.QLabel(k)) parent_layout.addWidget(v) # Configure the Group Box parent widget self.setTitle("{0} :".format(label)) self.setLayout(parent_layout) self.setStyleSheet("QGroupBox {color: #a2ec13}") # Private attribute(s) self.__value = RLPy.RVector3(0, 0, 0)
def __init__(self, parent, label="", float_value=1001.0): """ Simple class to wrap a few widgets together """ super(LabelFloatRowLayout, self).__init__(parent) self.label = QtWidgets.QLabel(label) self.addWidget(self.label) self.float_box = QtWidgets.QDoubleSpinBox() self.float_box.setMinimum(0) self.float_box.setMaximum(1000000) self.float_box.setDecimals(2) self.float_box.setValue(1001.0) self.addWidget(self.float_box)
def random_rotation_ui(self): self.rand_rotation_title = QtWidgets.QLabel("Random Rotation") self.rand_rot_x_min = QtWidgets.QDoubleSpinBox() self.rand_rot_x_min.setValue(1) self.rand_rot_x_min.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_x_min.setFixedWidth(50) self.rand_rot_x_max = QtWidgets.QDoubleSpinBox() self.rand_rot_x_max.setValue(1) self.rand_rot_x_max.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_x_max.setFixedWidth(50) self.rand_rot_y_min = QtWidgets.QDoubleSpinBox() self.rand_rot_y_min.setValue(1) self.rand_rot_y_min.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_y_min.setFixedWidth(50) self.rand_rot_y_max = QtWidgets.QDoubleSpinBox() self.rand_rot_y_max.setValue(1) self.rand_rot_y_max.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_y_max.setFixedWidth(50) self.rand_rot_z_min = QtWidgets.QDoubleSpinBox() self.rand_rot_z_min.setValue(1) self.rand_rot_z_min.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_z_min.setFixedWidth(50) self.rand_rot_z_max = QtWidgets.QDoubleSpinBox() self.rand_rot_z_max.setValue(1) self.rand_rot_z_max.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_rot_z_max.setFixedWidth(50) self.rand_rot_button = QtWidgets.QPushButton("Apply") layout = QtWidgets.QHBoxLayout() layout.addWidget(self.rand_rot_button) layout.addWidget(self.rand_rotation_title) layout.addWidget(self.rand_rot_x_min) layout.addWidget(QtWidgets.QLabel("x_min")) layout.addWidget(self.rand_rot_x_max) layout.addWidget(QtWidgets.QLabel("x_max")) layout.addWidget(self.rand_rot_y_min) layout.addWidget(QtWidgets.QLabel("y_min")) layout.addWidget(self.rand_rot_y_max) layout.addWidget(QtWidgets.QLabel("y_max")) layout.addWidget(self.rand_rot_z_min) layout.addWidget(QtWidgets.QLabel("z_min")) layout.addWidget(self.rand_rot_z_max) layout.addWidget(QtWidgets.QLabel("z_max")) return layout
def __init__(self, hardware_names, combobox=False, combobox_label=""): QtWidgets.QWidget.__init__(self) self.setLayout(QtWidgets.QGridLayout()) self.layout().setMargin(0) self.comboboxes = [] self.current_position_displays = [] self.new_position_controls = [] self.set_buttons = [] for i in range(len(hardware_names)): # names collumn = 0 label = QtWidgets.QLabel(hardware_names[i]) StyleSheet = "QLabel{color: custom_color; font: bold 14px;}".replace( "custom_color", colors["heading_0"]) label.setStyleSheet(StyleSheet) self.layout().addWidget(label, i, collumn) # comboboxes if combobox: collumn += 1 combobox_obj = QtWidgets.QComboBox() self.layout().addWidget(combobox_obj, i, collumn) self.comboboxes.append(combobox_obj) # current collumn += 1 current_position = QtWidgets.QDoubleSpinBox() current_position.setButtonSymbols( QtWidgets.QAbstractSpinBox.NoButtons) current_position.setDisabled(True) self.layout().addWidget(current_position, i, collumn) self.current_position_displays.append(current_position) # new collumn += 1 new_position = QtWidgets.QDoubleSpinBox() new_position.setButtonSymbols(QtWidgets.QAbstractSpinBox.NoButtons) self.layout().addWidget(new_position, i, collumn) self.new_position_controls.append(new_position) self.set_allowed_values(i, 0, 10000, 2, 10)
def __init__(self): super(QuickReadTab, self).__init__() self.quick_vbox = QtWidgets.QVBoxLayout(self) self.quick_vbox.setContentsMargins(0, 0, 0, 0) self.quick_hbox = QtWidgets.QHBoxLayout() self.auto_r_hbox = QtWidgets.QHBoxLayout() self.quick_vbox.setSpacing(1) self.oad_l = QtWidgets.QLabel() self.oad_l.setText('OAD') self.oad_box = QtWidgets.QLineEdit() # self.oad_box.setMaximumWidth(70) self.read_oad_b = QtWidgets.QPushButton() self.read_oad_b.setMaximumWidth(50) self.read_oad_b.setText('读取') self.oad_auto_r_cb = QtWidgets.QCheckBox() self.oad_auto_r_cb.setText('读取周期') self.oad_auto_r_spin = QtWidgets.QDoubleSpinBox() self.oad_auto_r_spin.setMaximum(30 * 60) self.oad_auto_r_spin.setValue(1) self.oad_auto_unit_l = QtWidgets.QLabel() self.oad_auto_unit_l.setText('秒') self.auto_r_hbox.addWidget(self.oad_auto_r_cb) self.auto_r_hbox.addWidget(self.oad_auto_r_spin) self.auto_r_hbox.addWidget(self.oad_auto_unit_l) self.cnt_box_w = QtWidgets.QWidget() self.cnt_box = QtWidgets.QHBoxLayout(self.cnt_box_w) self.send_cnt_l = QtWidgets.QLabel() self.send_cnt_l.setText('发0') self.receive_cnt_l = QtWidgets.QLabel() self.receive_cnt_l.setText('收0') self.cnt_clr_b = QtWidgets.QPushButton() self.cnt_clr_b.setMaximumWidth(50) self.cnt_clr_b.setText('清') self.cnt_box.addWidget(self.send_cnt_l) self.cnt_box.addStretch(1) self.cnt_box.addWidget(self.receive_cnt_l) self.cnt_box.addStretch(1) self.cnt_box.addWidget(self.cnt_clr_b) self.oad_explain_l = QtWidgets.QLabel() self.oad_explain_l.setContentsMargins(0, 5, 0, 5) # self.oad_explain_l.setAlignment(QtCore.Qt.AlignCenter) self.quick_hbox.addWidget(self.oad_l) self.quick_hbox.addWidget(self.oad_box) self.quick_hbox.addWidget(self.read_oad_b) self.quick_vbox.addLayout(self.quick_hbox) self.quick_vbox.addWidget(self.oad_explain_l) self.quick_vbox.addLayout(self.auto_r_hbox) self.quick_vbox.addWidget(self.cnt_box_w) self.quick_vbox.addStretch(1)
def __init__(self, parent=None): super(MeterDialog, self).__init__(parent) layout = QtWidgets.QVBoxLayout(self) # nice widget for editing the date # self.datetime = QtWidgets.QDateTimeEdit(self) self.datetime = QtWidgets.QDateEdit(self) self.datetime.setCalendarPopup(True) self.datetime.setDateTime(QDateTime.currentDateTime()) layout.addWidget(self.datetime) # Meter type - selector meterTypeLabel = QtWidgets.QLabel("Zähler") layout.addWidget(meterTypeLabel) self.meterTypeWidget = QtWidgets.QWidget(self) self.miniLayout = QtWidgets.QHBoxLayout(self.meterTypeWidget) self.meterTypeGrp = QtWidgets.QButtonGroup() self.electricity = QtWidgets.QCheckBox('Strom') self.electricity.setCheckState(Qt.CheckState.Checked) self.meterTypeGrp.addButton(self.electricity, 0) self.miniLayout.addWidget(self.electricity) self.gas = QtWidgets.QCheckBox('Gas') self.meterTypeGrp.addButton(self.gas, 1) self.miniLayout.addWidget(self.gas) self.water = QtWidgets.QCheckBox('Wasser') self.meterTypeGrp.addButton(self.water, 2) self.miniLayout.addWidget(self.water) layout.addWidget(self.meterTypeWidget) # level lvlLabel = QtWidgets.QLabel('Zählerstand') layout.addWidget(lvlLabel) self.lvlSpinBox = QtWidgets.QDoubleSpinBox() self.lvlSpinBox.setRange(0, 1000000) self.lvlSpinBox.setDecimals(3) # self.lvlSpinBox.setSuffix(' m^2') self.lvlSpinBox.setValue(0) layout.addWidget(self.lvlSpinBox) # OK and Cancel buttons self.buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, Qt.Horizontal, self) layout.addWidget(self.buttons) ## SIGNALS/SLOTS ## self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject)
def createEditor(self, parent: QWidget, _, index: QModelIndex) -> QWidget: if index.isValid(): if index.column() == 3: # discount editor = QtWidgets.QDoubleSpinBox(parent) editor.setDecimals(1) editor.setMinimum(0) editor.setSingleStep(5) editor.setMaximum(100) return editor if index.column() == 5: # count editor = QtWidgets.QSpinBox(parent) editor.setMinimum(1) editor.setMaximum(999999) return editor return QWidget(parent)
def random_scale_ui(self): self.rand_scale_title = QtWidgets.QLabel("Random Scale") self.rand_spinbox_min = QtWidgets.QDoubleSpinBox() self.rand_spinbox_min.setValue(1) self.rand_spinbox_min.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_spinbox_min.setFixedWidth(50) self.rand_spinbox_max = QtWidgets.QDoubleSpinBox() self.rand_spinbox_max.setValue(1) self.rand_spinbox_max.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.rand_spinbox_max.setFixedWidth(50) self.rand_scale_button = QtWidgets.QPushButton("Apply") layout = QtWidgets.QHBoxLayout() layout.addWidget(self.rand_scale_button) layout.addWidget(self.rand_scale_title) layout.addWidget(self.rand_spinbox_min, 1, 0) layout.addWidget(QtWidgets.QLabel("min value"), 1, 0) layout.addWidget(self.rand_spinbox_max, 1, 0) layout.addWidget(QtWidgets.QLabel("max value"), 9, 0) return layout
def __init__(self, isDouble=False, parent=None): """ This is the constructor @param parent: the parent of the widget """ QtWidgets.QWidget.__init__(self, parent) self.setupUi(self) self.__isDouble = isDouble if self.__isDouble: self.spin = QtWidgets.QDoubleSpinBox() else: self.spin = QtWidgets.QSpinBox() self.horizontalLayout_2.addWidget(self.spin) self.spin.valueChanged.connect(self.emit_value_changed)
def _create_random_percentage(self): self.random_percentage_label = QtWidgets.QLabel("Percentage of " "Vertices to scatter " "to:") self.random_percentage_label.setFixedWidth(183) self.random_percentage = QtWidgets.QDoubleSpinBox() self.random_percentage.setMaximum(100.00) self.random_percentage.setMinimum(0.00) self.random_percentage.setFixedWidth(80) self.random_percentage.setValue(100.00) self.percentage_label = QtWidgets.QLabel("%") layout = QtWidgets.QHBoxLayout() layout.addWidget(self.random_percentage_label) layout.addWidget(self.random_percentage) layout.addWidget(self.percentage_label) return layout
def __init__(self, groups_list, parent: QObject = None): super().__init__(parent) self.model = QtCore.QStringListModel(groups_list) self.setWindowTitle(self.tr("Set discount value for group")) icon = QIcon() icon.addFile(u":/discount") self.setWindowIcon(icon) top_level_layout = QtWidgets.QHBoxLayout(self) icon_label = QtWidgets.QLabel(self) pixmap = QPixmap(":/discount").scaled(128, 128, Qt.KeepAspectRatio) icon_label.setPixmap(pixmap) top_level_layout.addWidget(icon_label) vertical_layout = QtWidgets.QVBoxLayout(self) self.label = QtWidgets.QLabel(self) self.label.setText( self.tr("Please choose discount group and discount value")) vertical_layout.addWidget(self.label) self.list_view = QtWidgets.QListView() self.list_view.setModel(self.model) self.list_view.setSelectionMode( QtWidgets.QAbstractItemView.SingleSelection) self.list_view.clicked.connect(self._list_item_clicked) vertical_layout.addWidget(self.list_view) spin_layout = QtWidgets.QHBoxLayout(self) spin_layout.addStretch() spin_layout.addWidget(QtWidgets.QLabel(self.tr("Discount:"), self)) self.spinbox_discount = QtWidgets.QDoubleSpinBox(self) self.spinbox_discount.setDecimals(1) self.spinbox_discount.setMinimum(0) self.spinbox_discount.setSingleStep(5) self.spinbox_discount.setMaximum(100) spin_layout.addWidget(self.spinbox_discount) vertical_layout.addLayout(spin_layout) self.buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) vertical_layout.addWidget(self.buttons) top_level_layout.addLayout(vertical_layout)
def setupUi(self, BlockchainDock): BlockchainDock.setObjectName("BlockchainDock") BlockchainDock.resize(416, 167) BlockchainDock.setFloating(False) BlockchainDock.setFeatures(QtWidgets.QDockWidget.AllDockWidgetFeatures) self.dockWidgetContents = QtWidgets.QWidget() self.dockWidgetContents.setObjectName("dockWidgetContents") self.formLayout = QtWidgets.QFormLayout(self.dockWidgetContents) self.formLayout.setObjectName("formLayout") self.generate = QtWidgets.QPushButton(self.dockWidgetContents) self.generate.setObjectName("generate") self.formLayout.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.generate) self.blocks = QtWidgets.QSpinBox(self.dockWidgetContents) self.blocks.setMinimum(1) self.blocks.setMaximum(9999) self.blocks.setProperty("value", 1) self.blocks.setObjectName("blocks") self.formLayout.setWidget(0, QtWidgets.QFormLayout.FieldRole, self.blocks) self.transfer = QtWidgets.QPushButton(self.dockWidgetContents) self.transfer.setObjectName("transfer") self.formLayout.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.transfer) self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.amount = QtWidgets.QDoubleSpinBox(self.dockWidgetContents) self.amount.setSuffix("") self.amount.setMaximum(9999.99) self.amount.setProperty("value", 10.0) self.amount.setObjectName("amount") self.horizontalLayout.addWidget(self.amount) self.to_label = QtWidgets.QLabel(self.dockWidgetContents) self.to_label.setObjectName("to_label") self.horizontalLayout.addWidget(self.to_label) self.address = QtWidgets.QLineEdit(self.dockWidgetContents) self.address.setObjectName("address") self.horizontalLayout.addWidget(self.address) self.formLayout.setLayout(1, QtWidgets.QFormLayout.FieldRole, self.horizontalLayout) self.invalidate = QtWidgets.QPushButton(self.dockWidgetContents) self.invalidate.setObjectName("invalidate") self.formLayout.setWidget(2, QtWidgets.QFormLayout.LabelRole, self.invalidate) self.block_hash = QtWidgets.QLineEdit(self.dockWidgetContents) self.block_hash.setObjectName("block_hash") self.formLayout.setWidget(2, QtWidgets.QFormLayout.FieldRole, self.block_hash) BlockchainDock.setWidget(self.dockWidgetContents) self.retranslateUi(BlockchainDock) QtCore.QMetaObject.connectSlotsByName(BlockchainDock)
def _create_object_ui(self): default_obj1 = self.scattering.to_transfer_sel default_scatter_percent = self.scattering.scatter_percentage self.obj1_le = QtWidgets.QLineEdit(default_obj1) self.percent_dbspx = QtWidgets.QDoubleSpinBox(maximum=1.0, singleStep=0.05) self.percent_dbspx.setValue(default_scatter_percent) layout = QtWidgets.QGridLayout() layout.addWidget(QtWidgets.QLabel("Scatter"), 0, 0) layout.addWidget(self.obj1_le, 0, 1) layout.addWidget(QtWidgets.QLabel("on to"), 0, 2) layout.addWidget(self.percent_dbspx, 0, 3) layout.addWidget(QtWidgets.QLabel('Decimal % of Selection'), 0, 4) return layout
def setupUI(self): mainLayout = VertBox() self.layout = QtWidgets.QGridLayout() self.layout.setContentsMargins(1, 1, 1, 1) self.label = QtWidgets.QLabel(self.labelName) self.label.setMinimumWidth(MIN_LABEL_WIDTH) self.spin = QtWidgets.QDoubleSpinBox() self.spin.setMinimumWidth(100) self.layout.addWidget(self.label, 0, 0) self.layout.addWidget(self.spin, 0, 1) mainLayout.addLayout(self.layout) self.setLayout(mainLayout)
def __init__(self, label='Vector', span=(-100, 0, 100), checked=[True, True, True], parent=None): super().__init__() self.__enabled = checked self.__value = [span[2], span[2], span[2]] self.__vector = {"x": span[2], "y": span[2], "z": span[2]} self.setLayout(QtWidgets.QHBoxLayout()) self.layout().setSpacing(2) self.layout().setContentsMargins(0, 0, 0, 0) def enable_disable(spinbox, axis, cond): spinbox.setEnabled(cond) index = {"X": 0, "Y": 1, "Z": 2}[axis] self.__enabled[index] = cond > 0 def change_value(axis, value): self.__vector[axis.lower()] = value index = {"X": 0, "Y": 1, "Z": 2}[axis] self.__value[index] = value for axis, checked in {"X": checked[0], "Y": checked[1], "Z": checked[2]}.items(): layout = QtWidgets.QVBoxLayout() top_layout = QtWidgets.QHBoxLayout() checkbox = QtWidgets.QCheckBox() spinbox = QtWidgets.QDoubleSpinBox( minimum=span[0], maximum=span[2], value=span[1]) top_layout.addWidget(checkbox) top_layout.addWidget(QtWidgets.QLabel("%s %s" % (label, axis))) top_layout.addStretch() #### I don't understand layout.addLayout(top_layout) layout.addWidget(spinbox) checkbox.setEnabled(checked) spinbox.setEnabled(checked) checkbox.stateChanged.connect(partial(enable_disable, spinbox, axis)) spinbox.valueChanged.connect(partial(change_value, axis)) self.layout().addLayout(layout) if parent: parent.addWidget(self)
def __init__(self, parent=None): super(widget, self).__init__(parent) self.layout = QtWidgets.QVBoxLayout() self.setLayout(self.layout) self.list_widget = QtWidgets.QListWidget() self.layout.addWidget(self.list_widget) for p in sorted(property_list): item = QtWidgets.QListWidgetItem(p) self.list_widget.addItem(item) self.spin = QtWidgets.QDoubleSpinBox() self.layout.addWidget(self.spin) self.spin.setMaximum(10000000) self.button = QtWidgets.QPushButton("CHANGE") self.layout.addWidget(self.button) self.button.clicked.connect(self.change_property)
def _create_pushin(self): self.pushincheck = QtWidgets.QCheckBox() self.pushincheck_label = QtWidgets.QLabel("Push scattered objs into " "their destination?") self.pushin_length = QtWidgets.QDoubleSpinBox() self.pushin_length_label = QtWidgets.QLabel("units they'll be " "pushed in") self.pushincheck.setFixedWidth(15) self.pushincheck_label.setFixedWidth(500) self.pushin_length.setMinimum(-10.00) self.pushin_length.setMaximum(10.00) self.pushin_length.setFixedWidth(100) layout = QtWidgets.QHBoxLayout() layout.addWidget(self.pushincheck) layout.addWidget(self.pushincheck_label) layout.addWidget(self.pushin_length) layout.addWidget(self.pushin_length_label) return layout
def populate_ray(self): import nuke if len(nuke.allNodes('RayRender')) == 0: self.append_to_log('INFO: No RayRender nodes found', 'orange') for node in nuke.allNodes('RayRender'): row = self.ui.ray_table.rowCount() self.ui.ray_table.insertRow(self.ui.ray_table.rowCount()) ray_name = QtWidgets.QTableWidgetItem() ray_name.setTextAlignment(QtCore.Qt.AlignCenter) ray_name.setText(node.name()) ray_name.setFlags(QtCore.Qt.ItemIsEditable) ray_name.setForeground(QtGui.QBrush(QtGui.QColor(QtCore.Qt.white))) self.ui.ray_table.setItem(row, 0, ray_name) aa_filter = QtWidgets.QComboBox() aa_filter.addItems([ 'Impulse', 'Cubic', 'Keys', 'Simon', 'Rifman', 'Mitchell', 'Parzen', 'Notch', 'Lanczos4', 'Lanczos6', 'Sinc4' ]) aa_filter.setCurrentIndex(node['filter'].getValue()) self.ui.ray_table.setCellWidget(row, 1, aa_filter) aa_samples = QtWidgets.QSpinBox() aa_samples.setMinimum(0) aa_samples.setMaximum(50) aa_samples.setValue(node['samples'].getValue()) self.ui.ray_table.setCellWidget(row, 2, aa_samples) aa_shutter = QtWidgets.QDoubleSpinBox() aa_shutter.setMinimum(-10) aa_shutter.setMaximum(10) aa_shutter.setSingleStep(0.25) aa_shutter.setValue(node['shutter'].getValue()) self.ui.ray_table.setCellWidget(row, 3, aa_shutter) self.append_to_log( 'Found RayRender node {}, added to list'.format(node.name()), 'lime')
def __init__(self, signals, name='form'): super(DropBotSettings, self).__init__() self.formGroupBox = QtWidgets.QGroupBox("DropBot") self.layout = QtWidgets.QFormLayout() voltage_spin_box = QtWidgets.QDoubleSpinBox() voltage_spin_box.setRange(0, 150) voltage_spin_box.setValue(100) self.layout.addRow(QtWidgets.QLabel("Voltage:"), voltage_spin_box) self.layout.addRow(QtWidgets.QLabel("Chip UUID:"), QtWidgets.QLineEdit()) self.formGroupBox.setLayout(self.layout) self.setLayout(self.layout) def on_change(x): signals.signal('dropbot.voltage').send(name, value=x) voltage_spin_box.valueChanged.connect(on_change)
def __init__(self, parent: QObject = None): super().__init__(parent) self.setWindowTitle(self.tr("Set discounts")) icon = QIcon() icon.addFile(u":/discount") self.setWindowIcon(icon) top_level_layout = QtWidgets.QHBoxLayout(self) icon_label = QtWidgets.QLabel(self) pixmap = QPixmap(":/discount").scaled(128, 128, Qt.KeepAspectRatio) icon_label.setPixmap(pixmap) top_level_layout.addWidget(icon_label) vertical_layout = QtWidgets.QVBoxLayout(self) self.label = QtWidgets.QLabel(self) self.label.setText( self.tr("Please enter regular expression\n" "if you want to limit discount to matching items,\n" "or leave empty to add discount to all items.")) vertical_layout.addWidget(self.label) self.line_edit_expression = QtWidgets.QLineEdit(self) vertical_layout.addWidget(self.line_edit_expression) spin_layout = QtWidgets.QHBoxLayout(self) spin_layout.addStretch() spin_layout.addWidget(QtWidgets.QLabel(self.tr("Discount:"), self)) self.spinbox_discount = QtWidgets.QDoubleSpinBox(self) self.spinbox_discount.setDecimals(1) self.spinbox_discount.setMinimum(0) self.spinbox_discount.setSingleStep(5) self.spinbox_discount.setMaximum(100) spin_layout.addWidget(self.spinbox_discount) vertical_layout.addLayout(spin_layout) self.buttons = QtWidgets.QDialogButtonBox( QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel) self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) vertical_layout.addWidget(self.buttons) top_level_layout.addLayout(vertical_layout)
def create_ui(self): """WIDGETS""" self.title_lbl = QtWidgets.QLabel("Scatter Tool") self.title_lbl.setStyleSheet("font: bold 20px") self.scatter_button = QtWidgets.QPushButton("Scatter") self.scatter_to_normal_button = QtWidgets.QPushButton( "Scatter to Normals") self.density_controller = QtWidgets.QDoubleSpinBox() self.density_controller.setFixedWidth(50) self.density_controller.setRange(1, 100) self.density_controller.setValue(100) self.is_whole = QtWidgets.QCheckBox("Selecting Whole Object") self.scatter_lbl = QtWidgets.QLabel("Make your selections before " "Scattering") self.scatter_lbl.setStyleSheet("font:bold 15px") self.rand_dense_lbl = QtWidgets.QLabel("Density Modifier") self.rand_dense_lbl.setStyleSheet("font:bold 14px") self.scatter_button = QtWidgets.QPushButton("Scatter") self.rand_rotation = self.random_rotation_ui() self.rand_scale = self.random_scale_ui() """LAYOUTS""" main_lay = QtWidgets.QVBoxLayout(self) main_lay.addWidget(self.title_lbl) main_lay.addWidget(self.scatter_lbl) main_lay.addWidget(self.scatter_button) main_lay.addWidget(self.scatter_to_normal_button) main_lay.addWidget(self.rand_dense_lbl, 0, 1) main_lay.addWidget(self.density_controller) main_lay.addWidget(self.is_whole) main_lay.addStretch() main_lay.addLayout(self.random_rotation_ui()) main_lay.addLayout(self.random_scale_ui()) self.setLayout(main_lay)
def _create_ui(self): """ Create the widget's UI :return: None """ layout = QtWidgets.QVBoxLayout() self.setLayout(layout) self._shot_widget = ShotWidget() # create and set a background image for the shot widget bg = QtGui.QPixmap(300, 200) bg.fill(QtGui.QColor(128, 128, 128)) self._shot_widget.setPixmap(bg) layout.addWidget(self._shot_widget) # toggle the ratio constraint on and off self._chb_constrain_ratio = QtWidgets.QCheckBox( 'Constrain Capture image ratio') self._chb_constrain_ratio.stateChanged[int].connect(self.toggle_ratio) layout.addWidget(self._chb_constrain_ratio) # control the ratio constraint amount ratio_layout = QtWidgets.QHBoxLayout() ratio_layout.addWidget(QtWidgets.QLabel('Ratio:')) self._spn_ratio = QtWidgets.QDoubleSpinBox() self._spn_ratio.setValue(1) self._spn_ratio.setSingleStep(0.01) self._spn_ratio.setEnabled(False) self._spn_ratio.valueChanged[float].connect(self.set_ratio_value) ratio_layout.addWidget(self._spn_ratio) layout.addLayout(ratio_layout) # capture button self.btn_capture = QtWidgets.QPushButton('Create Capture') layout.addWidget(self.btn_capture) self.btn_capture.clicked.connect(self._shot_widget.capture_screen) # save the capture button self.btn_save = QtWidgets.QPushButton('Save Capture') layout.addWidget(self.btn_save) self.btn_save.clicked.connect(self.save_capture)
def density_val_ui(self): """Specify density value to scatter""" self.density_val_sbx = QtWidgets.QDoubleSpinBox() self.density_val_sbx.setDecimals(0) self.density_val_sbx.setSingleStep(1) self.density_val_sbx.setMaximum(100) self.density_val_sbx.setButtonSymbols( QtWidgets.QAbstractSpinBox.PlusMinus) self.density_val_sbx.setFixedWidth(75) self.density_val_sbx.setFixedHeight(40) self.density_val_sbx.setValue(100) self.density_lbl = QtWidgets.QLabel("Value (%):") self.density_lbl.setStyleSheet("font: Bold 15px") self.dens_val_space = QtWidgets.QLabel(" ") self.dens_val_space.setFixedWidth(10) self.dens_val_space.setFixedHeight(5) """Scatter normal label""" self.normal_lbl = QtWidgets.QLabel("Face Normal:") self.normal_lbl.setStyleSheet("font: Bold 15px") self.normal_bool_cbx = QtWidgets.QCheckBox() layout = QtWidgets.QGridLayout() layout.addWidget(self.dens_val_space, 0, 0) layout.addWidget(self.dens_val_space, 1, 0) layout.addWidget(self.density_lbl, 1, 1) layout.addWidget(self.dens_val_space, 1, 2) layout.addWidget(self.density_val_sbx, 1, 3) layout.addWidget(self.dens_val_space, 1, 4) layout.addWidget(self.dens_val_space, 1, 5) layout.addWidget(self.normal_lbl, 1, 6) layout.addWidget(self.dens_val_space, 1, 7) layout.addWidget(self.normal_bool_cbx, 1, 8) layout.addWidget(self.dens_val_space, 1, 9) layout.addWidget(self.dens_val_space, 2, 0) return layout
def __init__(self, name, value, n, minv, maxv): super().__init__(name) hlayout = QtWidgets.QHBoxLayout() self._spinboxes = [] elems_min = minv if minv is not None else [0] * n elems_max = maxv if maxv is not None else [1] * n assert 2 <= n <= 4 assert len(elems_min) == len(elems_max) == len(value) == n for elem_value, elem_min, elem_max in zip(value, elems_min, elems_max): spin = QtWidgets.QDoubleSpinBox() spin.setMinimum(elem_min) spin.setMaximum(elem_max) spin.setSingleStep(0.01) spin.setValue(elem_value) self._spinboxes.append(spin) spin.valueChanged.connect(self._spin_value_changed) hlayout.addWidget(spin) label = QtWidgets.QLabel(self.get_label_text()) self.layout.addWidget(label) self.layout.addLayout(hlayout)
def __init__(self): #init the main dialog qw.QDialog.__init__(self) #set window title self.setWindowTitle('Stair Generator') self.setFixedWidth(400) #init the fields #height range min, max self.hrm = qw.QDoubleSpinBox() self.hrM = qw.QDoubleSpinBox() self.hrm.setRange(0.0, 1000.0) self.hrM.setRange(0.0, 2000.0) #depth range min, max self.drm = qw.QDoubleSpinBox() self.drM = qw.QDoubleSpinBox() self.drm.setRange(0.0, 1000.0) self.drM.setRange(0.0, 2000.0) #width range min, max self.wrm = qw.QDoubleSpinBox() self.wrM = qw.QDoubleSpinBox() self.wrm.setRange(0.0, 1000.0) self.wrM.setRange(0.0, 2000.0) #init sliders, #connect to slideApply function to make dynamic editing possible #number of steps self.st = qw.QSlider(qc.Qt.Horizontal) self.st.setMinimum(10) self.st.setMaximum(100) self.st.valueChanged.connect(self.slideApply) self.st.setValue(50) #step gap - divide by 1000 self.stgp = qw.QSlider(qc.Qt.Horizontal) self.stgp.setMinimum(1) self.stgp.setMaximum(99) self.stgp.valueChanged.connect(self.slideApply) #apply button, link to apply function btnapp = qw.QPushButton('Apply') btnapp.clicked.connect(functools.partial(self.apply)) #Form layout - add all widgets with labels self.setLayout(qw.QFormLayout()) self.layout().addRow('Height Range: Min:', self.hrm) self.layout().addRow('Max:', self.hrM) self.layout().addRow(' Width Range: Min:', self.wrm) self.layout().addRow('Max:', self.wrM) self.layout().addRow(' Depth Range: Min:', self.drm) self.layout().addRow('Max:', self.drM) self.layout().addRow('Number of Steps:', self.st) self.layout().addRow('Step Gap:', self.stgp) self.layout().addRow('', btnapp)
def scale_dsbxes(self): self.scale_x_min_dsbx = QtWidgets.QDoubleSpinBox() self.scale_x_min_dsbx.setMinimum(0.1) self.scale_x_max_dsbx = QtWidgets.QDoubleSpinBox() self.scale_x_max_dsbx.setMinimum(0.1) self.scale_y_min_dsbx = QtWidgets.QDoubleSpinBox() self.scale_y_min_dsbx.setMinimum(0.1) self.scale_y_max_dsbx = QtWidgets.QDoubleSpinBox() self.scale_y_max_dsbx.setMinimum(0.1) self.scale_z_min_dsbx = QtWidgets.QDoubleSpinBox() self.scale_z_min_dsbx.setMinimum(0.1) self.scale_z_max_dsbx = QtWidgets.QDoubleSpinBox() self.scale_z_max_dsbx.setMinimum(0.1)
def __init__(self, name, value, **kwargs): super(VectorWidget, self).__init__(name) n = kwargs.get("n", 3) hlayout = QtWidgets.QHBoxLayout() self._spinboxes = [] elems_min = kwargs.get("minv", [0] * n) elems_max = kwargs.get("maxv", [1] * n) assert 2 <= n <= 4 assert len(elems_min) == len(elems_max) == len(value) == n for elem_value, elem_min, elem_max in zip(value, elems_min, elems_max): spin = QtWidgets.QDoubleSpinBox() spin.setMinimum(elem_min) spin.setMaximum(elem_max) spin.setSingleStep(0.01) spin.setValue(elem_value) self._spinboxes.append(spin) spin.valueChanged.connect(self._spin_value_changed) hlayout.addWidget(spin) label = QtWidgets.QLabel(self.get_label_text()) self.layout.addWidget(label) self.layout.addLayout(hlayout)
def createEditor(self, parent, option, index): """Overridden method to generate the editor combo box and return it.""" widget = QtWidgets.QWidget(parent) container = QtWidgets.QHBoxLayout(widget) container.setContentsMargins(0, 0, 0, 0) container.setSpacing(0) self.spinBox = QtWidgets.QDoubleSpinBox(widget) self.spinBox.setMinimum(self.minimum) self.spinBox.setMaximum(self.maximum) self.spinBox.setSuffix(self.suffix) self.spinBox.setDecimals(self.decimals) self.spinBox.setSingleStep(self.singleStep) container.addWidget(self.spinBox, 1) self.comboBox = QtWidgets.QComboBox(widget) for choice in self.choices: self.comboBox.addItem(choice) container.addWidget(self.comboBox) return widget