def __init__(self, parent=None): super().__init__(parent) # Variables model = MaterialModel() # Widgets self.combobox = QtWidgets.QComboBox() self.combobox.setModel(model) self.combobox.setEditable(False) self.combobox.setCurrentIndex(0) # Layouts layout = QtWidgets.QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.combobox) self.setLayout(layout) # Signals model.modelReset.connect(self._on_model_reset) self.combobox.currentIndexChanged.connect( self._on_current_index_changed)
def init_dither(self): layout = QtWidgets.QHBoxLayout() dither_label = QtWidgets.QLabel("Dither") dither_label.setToolTip( "Dither is an intentionally applied form of noise used to randomize quantization error, <br> " "preventing large-scale patterns such as color banding in images.") layout.addWidget(dither_label) self.widgets.dither = QtWidgets.QComboBox() self.widgets.dither.addItems([ "sierra2_4a", "floyd_steinberg", "sierra2", "bayer:bayer_scale=1", "bayer:bayer_scale=2", "bayer:bayer_scale=3", "none", ]) self.widgets.dither.setCurrentIndex(0) self.widgets.dither.currentIndexChanged.connect( lambda: self.main.build_commands()) layout.addWidget(self.widgets.dither) return layout
def add_widgets_to_subtree(self, tree_item): lq_tree_items = [] for lqname, lq in self.as_dict().items(): #: :type lq: LoggedQuantity if isinstance(lq, ArrayLQ): lineedit = QtWidgets.QLineEdit() button = QtWidgets.QPushButton('...') widget = QtWidgets.QWidget() layout = QtWidgets.QHBoxLayout() widget.setLayout(layout) layout.addWidget(lineedit) layout.addWidget(button) layout.setSpacing(0) layout.setContentsMargins(0,0,0,0) lq.connect_to_widget(lineedit) button.clicked.connect(lq.array_tableView.show) button.clicked.connect(lq.array_tableView.raise_) else: if lq.choices is not None: widget = QtWidgets.QComboBox() elif lq.dtype in [int, float]: if lq.si: widget = pg.SpinBox() else: widget = QtWidgets.QDoubleSpinBox() elif lq.dtype in [bool]: widget = QtWidgets.QCheckBox() elif lq.dtype in [str]: widget = QtWidgets.QLineEdit() lq.connect_to_widget(widget) lq_tree_item = QtWidgets.QTreeWidgetItem(tree_item, [lqname, ""]) lq_tree_items.append(lq_tree_item) tree_item.addChild(lq_tree_item) lq.tree_widget = widget tree_item.treeWidget().setItemWidget(lq_tree_item, 1, lq.tree_widget) #self.control_widgets[lqname] = widget return lq_tree_items
def __init__(self, title="Subset mode toolbar", parent=None): super(EditSubsetModeToolBar, self).__init__(title, parent) self.subset_combo = QtWidgets.QComboBox() self.subset_combo.setMinimumContentsLength(10) spacer = QtWidgets.QWidget() spacer.setMinimumSize(10, 10) spacer.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) self.addWidget(spacer) self.addWidget(QtWidgets.QLabel("Active Subset:")) self.addWidget(self.subset_combo) self._label_subset_mode = QtWidgets.QLabel("Mode:") self.addWidget(self._label_subset_mode) self.setIconSize(QtCore.QSize(16, 16)) self._group = QtWidgets.QActionGroup(self) self._modes = {} self._add_actions() self._edit_subset_mode = self.parent()._session.edit_subset_mode self._modes[self._edit_subset_mode.mode].trigger() self._backup_mode = None spacer = QtWidgets.QWidget() spacer.setMinimumSize(20, 10) spacer.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Preferred) self.parent()._hub.subscribe(self, EditSubsetMessage, handler=self._update_mode) self.parent()._hub.subscribe(self, SubsetMessage, handler=self._update_subset_combo) self._data_collection = self.parent().data_collection self._update_subset_combo() self.subset_combo.currentIndexChanged.connect(self._on_subset_combo_change) self._update_mode_visibility()
def add_channel(self): dev_loaded = list(self._mmc.getLoadedDevices()) if len(dev_loaded) > 1: idx = self.channel_tableWidget.rowCount() self.channel_tableWidget.insertRow(idx) # create a combo_box for channels in the table self.channel_comboBox = QtW.QComboBox(self) self.channel_exp_spinBox = QtW.QSpinBox(self) self.channel_exp_spinBox.setRange(0, 10000) self.channel_exp_spinBox.setValue(100) channel_group = self._mmc.getOrGuessChannelGroup() if channel_group: channel_list = list( self._mmc.getAvailableConfigs(channel_group)) self.channel_comboBox.addItems(channel_list) self.channel_tableWidget.setCellWidget(idx, 0, self.channel_comboBox) self.channel_tableWidget.setCellWidget(idx, 1, self.channel_exp_spinBox)
def __init__(self, layout: QtWidgets.QLayout, text: str, values: Sequence): """ A combo box widget with a label Args: layout: the layout to which to add the widget text: the label text values: the possible values of the combo box """ QtWidgets.QWidget.__init__(self) layout.addWidget(self) self.layout = QtWidgets.QHBoxLayout(self) self.label = QtWidgets.QLabel(text) self.layout.addWidget(self.label) self.layout.setContentsMargins(0, 0, 0, 0) self.values = values self.input1 = QtWidgets.QComboBox() self.input1.addItems(values) self.layout.addWidget(self.input1) self.input1.currentIndexChanged.connect(self.valueChangeEvent) self.layout.addWidget(self.input1)
def __init__(self, motors, **kwargs): super().__init__(**kwargs) self.motors = [] self.cb = combobox = QtWidgets.QComboBox() hlayout = QtWidgets.QHBoxLayout() motor_layout = QtWidgets.QHBoxLayout() for motor in motors: mrw = MoverRanger(motor.name, motor) mrw.label.setVisible(False) self.motors.append(mrw) motor_layout.addWidget(mrw) # the label is redundant with the drop down mrw.setVisible(False) combobox.addItem(motor.name) combobox.currentIndexChanged[int].connect(self.set_active_motor) hlayout.addWidget(combobox) hlayout.addLayout(motor_layout) self.setLayout(hlayout) self.set_active_motor(0)
def add_channel(self): dev_loaded = list(self._mmc.getLoadedDevices()) if len(dev_loaded) > 1: idx = self.channel_explorer_tableWidget.rowCount() self.channel_explorer_tableWidget.insertRow(idx) # create a combo_box for channels in the table self.channel_explorer_comboBox = QtW.QComboBox(self) self.channel_explorer_exp_spinBox = QtW.QSpinBox(self) self.channel_explorer_exp_spinBox.setRange(0, 10000) self.channel_explorer_exp_spinBox.setValue(100) if "Channel" not in self._mmc.getAvailableConfigGroups(): raise ValueError( "Could not find 'Channel' in the ConfigGroups") channel_list = list(self._mmc.getAvailableConfigs("Channel")) self.channel_explorer_comboBox.addItems(channel_list) self.channel_explorer_tableWidget.setCellWidget( idx, 0, self.channel_explorer_comboBox) self.channel_explorer_tableWidget.setCellWidget( idx, 1, self.channel_explorer_exp_spinBox)
def __init__(self, unitGroup: UnitGroup) -> None: super(UnitLineEdit, self).__init__() self.unit_idx : int = 0 self._value : Optional[float] = 0 self._layout = QtWidgets.QHBoxLayout() self._layout.setContentsMargins(0,0,0,0) self.__lineEdit = PLineEdit() # Skipping typing - slots don't seem to work self.__lineEdit.editingFinished.connect(self.text_changed) self.__unitDropDown = QtWidgets.QComboBox() self.__unitDropDown.currentIndexChanged.connect(self.indexChanged) self._placeholder_value : Optional[float] = None self.setLayout(self._layout) self._layout.addWidget(self.__lineEdit, 0) self._layout.addWidget(self.__unitDropDown, 1) self.setUnitGroup(unitGroup)
def __init__(self, image_set, view_canvas, basic_widget): super(Basic, self).__init__(basic_widget) self.image_set = image_set self.image_set.register(self) self.basic_widget = basic_widget self.controller = BasicController(image_set, self) self.view_canvas = view_canvas self.image_menu = QtWidgets.QComboBox() for image in self.image_set.images: self.image_menu.addItem(image.image_name) self.image_menu.setCurrentIndex(image_set.current_image_index) self.image_menu.currentIndexChanged.connect(self.change_image) self.histogram = BasicHistogramModel(self.view_canvas, bins=100) self.histogram_widget = BasicHistogramWidget(self.histogram, self) self.layout = QtWidgets.QVBoxLayout() self.layout.addWidget(self.image_menu) self.layout.addWidget(self.histogram_widget) self.setLayout(self.layout) self.histogram.set_data()
def __init__(self, subcontext, parent=None, auto_btn=False): super(QuickEditView, self).__init__(parent) button_layout = QtWidgets.QHBoxLayout() self.plot_selector = QtWidgets.QComboBox() self.plot_selector.setEditable(True) self.plot_selector.completer().setCompletionMode( QtWidgets.QCompleter.PopupCompletion) if qtpy.PYQT5: self.plot_selector.completer().setFilterMode( QtCore.Qt.MatchContains) self.plot_selector.addItem("All") self.plot_selector.setEditable(False) self.x_axis_changer = AxisChangerPresenter(AxisChangerView("X")) self.autoscale = None if auto_btn: self.autoscale = QtWidgets.QPushButton("Autoscale y") self.autoscale.setStyleSheet("background-color:lightgrey") else: self.autoscale = QtWidgets.QCheckBox("Autoscale y") self.autoscale.setChecked(True) self.autoscale.setToolTip( "While pan or zoom are enabled autoscale is disabled") self.y_axis_changer = AxisChangerPresenter(AxisChangerView("Y")) self.errors = QtWidgets.QCheckBox("Errors") self.errors.stateChanged.connect(self._emit_errors) button_layout.addWidget(self.plot_selector) button_layout.addWidget(self.x_axis_changer.view) button_layout.addWidget(self.autoscale) button_layout.addWidget(self.y_axis_changer.view) button_layout.addWidget(self.errors) self.setLayout(button_layout)
def _teams(self): self.api.set_token(self.config['token']) teams = self.api(self.identity + '/teams?per_page=100') teams = pd.io.json.json_normalize(teams, max_level=0) self._teams = teams.set_index('name').sort_index() label = QtWidgets.QLabel(f"""Using pattern "{self.pattern}". Team to modify:""") comboBox = QtWidgets.QComboBox() self.team = teams.name.iloc[0] self.team_id = teams.id.iloc[0] for name in self._teams.index: comboBox.addItem(name) comboBox.activated[str].connect(self._setTeam) view_team = QtWidgets.QPushButton("View Team on Web") view_team.clicked.connect(self._view_team) add_team = QtWidgets.QPushButton("Add Team to Repositories") add_team.clicked.connect(self._add_team) remove_team = QtWidgets.QPushButton("Remove Team from Repositories") remove_team.clicked.connect(self._remove_team) buttons = QtWidgets.QDialogButtonBox(QtWidgets.QDialogButtonBox.Cancel) self.search_popup = Popup(label, comboBox, view_team, add_team, remove_team, title="Choose Team", bbox=buttons) self.search_popup.show()
def __init__(self, subcontext, parent=None, default_msg="All"): super(QuickEditView, self).__init__(parent) self._default_selector_msg = default_msg button_layout = QtWidgets.QHBoxLayout() self.plot_selector = QtWidgets.QComboBox() self.plot_selector.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed) self.plot_selector.setSizeAdjustPolicy( QtWidgets.QComboBox.AdjustToContents) self.plot_selector.setMinimumContentsLength(12) self.plot_selector.setEditable(True) self.plot_selector.completer().setCompletionMode( QtWidgets.QCompleter.PopupCompletion) self.plot_selector.view().setMinimumWidth(100) self.plot_selector.completer().setFilterMode(QtCore.Qt.MatchContains) self.plot_selector.addItem(self._default_selector_msg) self.plot_selector.setEditable(False) self.x_axis_changer = AxisChangerWidget("X", self) self.autoscale = None self.autoscale = QtWidgets.QCheckBox("Autoscale y") self.autoscale.setToolTip( "While pan or zoom are enabled autoscale is disabled") self.y_axis_changer = AxisChangerWidget("Y", self) self.errors = QtWidgets.QCheckBox("Errors") self.errors.stateChanged.connect(self._emit_errors) button_layout.addWidget(self.plot_selector) button_layout.addWidget(self.x_axis_changer.view) button_layout.addWidget(self.autoscale) button_layout.addWidget(self.y_axis_changer.view) button_layout.addWidget(self.errors) self.setLayout(button_layout)
def test_component_id_combo_helper_replaced(): # Make sure that when components are replaced, the equivalent combo index # remains selected and an event is broadcast so that any attached callback # properties can be sure to pull the latest text/userData. callback = MagicMock() combo = QtWidgets.QComboBox() combo.currentIndexChanged.connect(callback) dc = DataCollection([]) helper = ComponentIDComboHelper(combo, dc) assert combo_as_string(combo) == "" data1 = Data(x=[1, 2, 3], y=[2, 3, 4], label='data1') callback.reset_mock() dc.append(data1) helper.append_data(data1) callback.assert_called_once_with(0) callback.reset_mock() assert combo_as_string(combo) == "x:y" new_id = ComponentID(label='new') data1.update_id(data1.id['x'], new_id) callback.assert_called_once_with(0) callback.reset_mock() assert combo_as_string(combo) == "new:y"
def __init__(self, parent=None, add_button=True): super(QtWidgets.QWidget, self).__init__(parent) self.cbTag = QtWidgets.QComboBox(self) self.cbTag.addItems(['']) self.cbTag.setInsertPolicy(QtWidgets.QComboBox.InsertAtBottom) self.cbTag.setEditable(True) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(1) self.cbTag.setSizePolicy(sizePolicy) self.cbTag.activated.connect(self.hPB_add) if add_button: self.pbAdd = QtWidgets.QPushButton(self) self.pbAdd.setIcon(qta.icon("fa.plus")) self.pbAdd.setMaximumWidth(30) self.pbAdd.released.connect(self.hPB_add) else: self.cbTag.setInsertPolicy(QtWidgets.QComboBox.NoInsert) self.layout_main = QtWidgets.QVBoxLayout() self.layout_main.setAlignment(Qt.AlignTop) self.layout_tag = QtWidgets.QHBoxLayout() self.layout_list = QtWidgets.QVBoxLayout() self.setLayout(self.layout_main) self.layout_main.addLayout(self.layout_tag) self.layout_main.addLayout(self.layout_list) self.layout_tag.addWidget(self.cbTag) if add_button: self.layout_tag.addWidget(self.pbAdd) self.layout_main.setContentsMargins(0, 0, 0, 0) self.list = []
def __init__(self): super().__init__() self.cam_roi_combo = QtW.QComboBox() self.crop_btn = QtW.QPushButton("Crop") self.px_size_spinbox = QtW.QDoubleSpinBox() center = Qt.AlignmentFlag.AlignVCenter | Qt.AlignmentFlag.AlignHCenter self.px_size_spinbox.setAlignment(center) cam_px_label = QtW.QLabel("Camera Pixel (µm):") cam_px_label.setSizePolicy(policy_max, policy_max) roi_label = QtW.QLabel("Camera ROI:") roi_label.setSizePolicy(policy_max, policy_max) layout = QtW.QHBoxLayout() layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(roi_label) layout.addWidget(self.cam_roi_combo) layout.addWidget(self.crop_btn) layout.addWidget(cam_px_label) layout.addWidget(self.px_size_spinbox) self.setLayout(layout) self.px_size_spinbox.valueChanged.connect(_core.update_pixel_size)
def test_manual_data_combo_helper(): combo = QtWidgets.QComboBox() dc = DataCollection([]) helper = ManualDataComboHelper(combo, dc) data1 = Data(x=[1, 2, 3], y=[2, 3, 4], label='data1') dc.append(data1) assert combo_as_string(combo) == "" helper.append_data(data1) assert combo_as_string(combo) == "data1" data1.label = 'mydata1' assert combo_as_string(combo) == "mydata1" dc.remove(data1) assert combo_as_string(combo) == ""
def AddQComboBox(layout, text, values=None, selectedValue=None): horizontal_layout = QtWidgets.QHBoxLayout() layout.addLayout(horizontal_layout) text = QtWidgets.QLabel(text) comboBox = QtWidgets.QComboBox() comboBox.label = text for value in values: comboBox.addItem(value) if selectedValue: comboBox.setCurrentIndex(values.index(selectedValue)) comboBox.values = values def setValues(new_values): for i in range(len(comboBox.values)): comboBox.removeItem(0) for value in new_values: comboBox.addItem(value) comboBox.values = new_values comboBox.setValues = setValues horizontal_layout.addWidget(text) horizontal_layout.addWidget(comboBox) comboBox.managingLayout = horizontal_layout return comboBox
def setup_double_pulse_row(self): self.double_pulse_data_edit = QtWidgets.QLineEdit(self) double_pulse_data_validator = QtGui.QRegExpValidator( QtCore.QRegExp(valid_float_regex), self.double_pulse_data_edit) self.double_pulse_data_edit.setValidator(double_pulse_data_validator) self.double_pulse_data_edit.setText("0.33") self.double_pulse_data_unit_label = QtWidgets.QLabel(self) self.double_pulse_data_unit_label.setText(u" \u03BCs") self.double_pulse_data_combobox = QtWidgets.QComboBox(self) self.double_pulse_data_combobox.addItem('Single Pulse') self.double_pulse_data_combobox.addItem('Double Pulse') self.double_pulse_data_layout = QtWidgets.QHBoxLayout() self.double_pulse_data_layout.addSpacing(10) self.double_pulse_data_layout.addWidget(self.double_pulse_data_unit_label) self.double_pulse_data_layout.addStretch(0) self.layout.addWidget(self.double_pulse_data_combobox, 4, 0) self.layout.addWidget(self.double_pulse_data_edit, 4, 1) self.layout.addItem(self.double_pulse_data_layout, 4, 2)
def init_start_time(self): group_box = QtWidgets.QGroupBox() group_box.setStyleSheet("QGroupBox{padding-top:18px; margin-top:-18px}") self.widgets.start_time, layout = self.build_hoz_int_field( "Start ", right_stretch=False, left_stretch=True, time_field=True ) self.widgets.end_time, layout = self.build_hoz_int_field( " End ", left_stretch=False, right_stretch=True, layout=layout, time_field=True ) self.widgets.start_time.textChanged.connect(lambda: self.page_update()) self.widgets.end_time.textChanged.connect(lambda: self.page_update()) self.widgets.fast_time = QtWidgets.QComboBox() self.widgets.fast_time.addItems(["fast", "exact"]) self.widgets.fast_time.setCurrentIndex(0) self.widgets.fast_time.setToolTip( "uses [fast] seek to a rough position ahead of timestamp, " "vs a specific [exact] frame lookup. (GIF encodings use [fast])" ) self.widgets.fast_time.currentIndexChanged.connect(lambda: self.page_update(build_thumbnail=False)) self.widgets.fast_time.setFixedWidth(55) layout.addWidget(QtWidgets.QLabel(" ")) layout.addWidget(self.widgets.fast_time, QtCore.Qt.AlignRight) group_box.setLayout(layout) return group_box
def initUI(self): """ Init the User Interface. """ self.hor_layout = QtWidgets.QHBoxLayout() self.combo = QtWidgets.QComboBox() self.combo.addItems(self.items) self.add_pb = QtWidgets.QPushButton() self.add_pb.setText("") icon3 = QtGui.QIcon() icon3.addPixmap(QtGui.QPixmap(":/icons/Icon_Library/Add2.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.add_pb.setIcon(icon3) self.hor_layout.addWidget(self.combo) self.hor_layout.addWidget(self.add_pb) self.hor_layout.setSpacing(0) self.hor_layout.setContentsMargins(0, 0, 0, 0) self.add_pb.setMaximumWidth(25) self.setLayout(self.hor_layout) self.currentText = self.combo.currentText self.setCurrentIndex = self.combo.setCurrentIndex self.clear = self.combo.clear self.addItem = self.combo.addItem self.findText = self.combo.findText
def __init__(self, parent=None): super(AutolinkPreferencesPane, self).__init__(parent=parent) from glue.config import settings, autolinker # noqa layout = QtWidgets.QGridLayout() self.combos = {} for i, (label, _) in enumerate(autolinker): combo = QtWidgets.QComboBox() for short, display in AUTOLINK_OPTIONS.items(): combo.addItem(display, userData=short) if label in settings.AUTOLINK: index = list(AUTOLINK_OPTIONS.keys()).index(settings.AUTOLINK[label]) else: index = 0 combo.setCurrentIndex(index) layout.addWidget(QtWidgets.QLabel(label), i, 0) layout.addWidget(combo, i, 1) self.combos[label] = combo layout.addWidget(QtWidgets.QWidget(), i + 1, 0) self.setLayout(layout)
def __init__(self, layout=None, name=None, value=None, values=None, value_names=None, reference_by_index=False, **kwargs): # initialize the super widget QInput.__init__(self, layout, name, **kwargs) self.reference_by_index = reference_by_index self.values = values self.value_names = value_names if value_names is not None else values self.combobox = QtWidgets.QComboBox() self.layout().addWidget(self.combobox) self.combobox.addItems(self.value_names) self.combobox.currentIndexChanged.connect( lambda: self._valueChangedEvent(self.value())) if value is not None: self.setValue(value)
def __init__(self, parent=None): super(View, self).__init__(parent) grid = QtWidgets.QVBoxLayout(self) self.table = QtWidgets.QTableWidget(self) self.table.setRowCount(4) self.table.setColumnCount(2) grid.addWidget(self.table) self.colours = QtWidgets.QComboBox() options = ["Blue", "Green", "Red"] self.colours.addItems(options) self.grid_lines = QtWidgets.QTableWidgetItem() self.grid_lines.setFlags(QtCore.Qt.ItemIsUserCheckable | QtCore.Qt.ItemIsEnabled) self.grid_lines.setCheckState(QtCore.Qt.Unchecked) self.addItemToTable("Show grid lines", self.grid_lines, 1) self.freq = QtWidgets.QTableWidgetItem("1.0") self.phi = QtWidgets.QTableWidgetItem("0.0") self.addWidgetToTable("Colour", self.colours, 0) self.addItemToTable("Frequency", self.freq, 2) self.addItemToTable("Phase", self.phi, 3) self.plot = QtWidgets.QPushButton('Add', self) self.plot.setStyleSheet("background-color:lightgrey") grid.addWidget(self.plot) self.setLayout(grid) self.plot.clicked.connect(self.buttonPressed)
def addAttribute(self): """Add a new attribute to the user's attributes table.""" # The Data Type cell is a combobox with static content dtypes_list = [ 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64', 'float32', 'float64', 'complex64', 'complex128', 'bool', 'bytes', 'string', 'python' ] name_item = QtGui.QStandardItem() value_item = QtGui.QStandardItem() dtype_item = QtGui.QStandardItem() dtypes_combo = QtWidgets.QComboBox() dtypes_combo.addItems(dtypes_list) dtypes_combo.setEditable(False) self.userattr_model.appendRow([name_item, value_item, dtype_item]) self.userTable.setIndexWidget(dtype_item.index(), dtypes_combo) # Start editing the proper cell. If not, clicking Add+Delete # would result in the deletion of an attribute different to that # just added. It is also more handy as it allows to start editing # without double clicking the cell. self.userTable.edit(name_item.index())
def __init__(self, tool): QtWidgets.QWidget.__init__(self) self.tool = tool self.display = tool.display l = QtWidgets.QHBoxLayout() self.setLayout(l) d = QtWidgets.QLabel('Set distance in') self.combo = QtWidgets.QComboBox() self.combo.addItems(['x', 'y', 'distance']) self.editor = QtWidgets.QLineEdit() self.editor.setValidator(QtGui.QDoubleValidator(0.0, 9999.0, 3)) l.addWidget(d) l.addWidget(self.combo) l.addWidget(self.editor) self.setGeometry(100, 100, 200, 40) self.setAutoFillBackground(True) p = self.palette() p.setColor(self.backgroundRole(), QtCore.Qt.lightGray) self.setPalette(p) self.hide()
def __init__(self, textEdit): QtWidgets.QToolBar.__init__(self, 'Font') self.text = textEdit self.fontFamily = QtWidgets.QFontComboBox(self) self.fontFamily.currentFontChanged.connect(self.FontFamily) fontSize = QtWidgets.QComboBox(self) fontSize.setEditable(True) fontSize.setMinimumContentsLength(3) fontSize.activated.connect(self.FontSize) flist = [6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 18, 20, 22, 24, 26, 28, 32, 36, 40, 44, 48, 54, 60, 66, 72, 80, 88, 96] for i in flist: fontSize.addItem(str(i)) space1 = QtWidgets.QLabel(" ", self) space2 = QtWidgets.QLabel(" ", self) self.addWidget(self.fontFamily) self.addWidget(space1) self.addWidget(fontSize) self.addWidget(space2)
def setupUI(self): self.unitPropLayout = QW.QHBoxLayout(self) self.pressureMode = QW.QComboBox() self.pressureMode.setObjectName("pressureMode") self.unitPropLayout.addWidget(self.pressureMode) self.pressureUnit = QW.QComboBox() self.pressureUnit.setObjectName("pressureUnit") self.unitPropLayout.addWidget(self.pressureUnit) self.loadingBasis = QW.QComboBox() self.loadingBasis.setObjectName("loadingBasis") self.unitPropLayout.addWidget(self.loadingBasis) self.loadingUnit = QW.QComboBox() self.loadingUnit.setObjectName("loadingUnit") self.unitPropLayout.addWidget(self.loadingUnit) self.materialBasis = QW.QComboBox() self.materialBasis.setObjectName("materialBasis") self.unitPropLayout.addWidget(self.materialBasis) self.materialUnit = QW.QComboBox() self.materialUnit.setObjectName("materialUnit") self.unitPropLayout.addWidget(self.materialUnit)
def __init__(self, parent): standard.Dialog.__init__(self, parent) self.setAttribute(Qt.WA_MacMetalStyle) self.setWindowTitle(N_('Search')) self.mode_combo = QtWidgets.QComboBox() self.browse_button = create_toolbutton(icon=icons.folder(), tooltip=N_('Browse...')) self.query = QtWidgets.QLineEdit() self.start_date = QtWidgets.QDateEdit() self.start_date.setCurrentSection(QtWidgets.QDateTimeEdit.YearSection) self.start_date.setCalendarPopup(True) self.start_date.setDisplayFormat(N_('yyyy-MM-dd')) self.end_date = QtWidgets.QDateEdit() self.end_date.setCurrentSection(QtWidgets.QDateTimeEdit.YearSection) self.end_date.setCalendarPopup(True) self.end_date.setDisplayFormat(N_('yyyy-MM-dd')) icon = icons.search() self.search_button = qtutils.create_button(text=N_('Search'), icon=icon, default=True) self.max_count = QtWidgets.QSpinBox() self.max_count.setMinimum(5) self.max_count.setMaximum(9995) self.max_count.setSingleStep(5) self.max_count.setValue(500) self.commit_list = QtWidgets.QListWidget() self.commit_list.setMinimumSize(QtCore.QSize(1, 1)) self.commit_list.setAlternatingRowColors(True) selection_mode = QtWidgets.QAbstractItemView.SingleSelection self.commit_list.setSelectionMode(selection_mode) self.commit_text = DiffTextEdit(self, whitespace=False) self.button_export = qtutils.create_button(text=N_('Export Patches'), icon=icons.diff()) self.button_cherrypick = qtutils.create_button(text=N_('Cherry Pick'), icon=icons.save()) self.button_close = qtutils.close_button() self.top_layout = qtutils.hbox(defs.no_margin, defs.button_spacing, self.query, self.start_date, self.end_date, self.browse_button, self.search_button, qtutils.STRETCH, self.mode_combo, self.max_count) self.splitter = qtutils.splitter(Qt.Vertical, self.commit_list, self.commit_text) self.bottom_layout = qtutils.hbox(defs.no_margin, defs.spacing, self.button_export, self.button_cherrypick, qtutils.STRETCH, self.button_close) self.main_layout = qtutils.vbox(defs.margin, defs.spacing, self.top_layout, self.splitter, self.bottom_layout) self.setLayout(self.main_layout) if self.parent(): self.resize(self.parent().width(), self.parent().height()) else: self.resize(720, 500)
def __init__(self, parent, app: FastFlixApp): self.main = parent.main self.app = app self.paused = False self.encode_paused = False top_layout = QtWidgets.QHBoxLayout() top_layout.addWidget(QtWidgets.QLabel(t("Queue"))) top_layout.addStretch(1) self.clear_queue = QtWidgets.QPushButton( self.app.style().standardIcon( QtWidgets.QStyle.SP_LineEditClearButton), t("Clear Completed")) self.clear_queue.clicked.connect(self.clear_complete) self.clear_queue.setFixedWidth(120) self.clear_queue.setToolTip(t("Remove completed tasks")) self.pause_queue = QtWidgets.QPushButton( self.app.style().standardIcon(QtWidgets.QStyle.SP_MediaPause), t("Pause Queue")) self.pause_queue.clicked.connect(self.pause_resume_queue) # pause_queue.setFixedHeight(40) self.pause_queue.setFixedWidth(120) self.pause_queue.setToolTip( t("Wait for the current command to finish," " and stop the next command from processing")) self.pause_encode = QtWidgets.QPushButton( self.app.style().standardIcon(QtWidgets.QStyle.SP_MediaPause), t("Pause Encode")) self.pause_encode.clicked.connect(self.pause_resume_encode) # pause_queue.setFixedHeight(40) self.pause_encode.setFixedWidth(120) self.pause_encode.setToolTip(t("Pause / Resume the current command")) self.after_done_combo = QtWidgets.QComboBox() self.after_done_combo.addItem("None") actions = set() if reusables.win_based: actions.update(done_actions["windows"].keys()) elif sys.platform == "darwin": actions.update(["shutdown", "restart"]) else: actions.update(done_actions["linux"].keys()) if self.app.fastflix.config.custom_after_run_scripts: actions.update(self.app.fastflix.config.custom_after_run_scripts) self.after_done_combo.addItems(sorted(actions)) self.after_done_combo.setToolTip( "Run a command after conversion completes") self.after_done_combo.currentIndexChanged.connect( lambda: self.set_after_done()) self.after_done_combo.setMaximumWidth(150) top_layout.addWidget(QtWidgets.QLabel(t("After Conversion"))) top_layout.addWidget(self.after_done_combo, QtCore.Qt.AlignRight) top_layout.addWidget(self.pause_encode, QtCore.Qt.AlignRight) top_layout.addWidget(self.pause_queue, QtCore.Qt.AlignRight) top_layout.addWidget(self.clear_queue, QtCore.Qt.AlignRight) # pause_encode = QtWidgets.QPushButton( # self.app.style().standardIcon(QtWidgets.QStyle.SP_MediaPause), "Pause Encode" # ) # # pause_encode.setFixedHeight(40) # pause_encode.setFixedWidth(120) # top_layout.addWidget(pause_encode, QtCore.Qt.AlignRight) super().__init__(app, parent, t("Queue"), "queue", top_row_layout=top_layout)