def __init__(self, parent, start, stop): super().__init__(parent) self.setWindowTitle("Crop data") vbox = QVBoxLayout(self) grid = QGridLayout() self.start_checkbox = QCheckBox("Start time:") self.start_checkbox.setChecked(True) self.start_checkbox.stateChanged.connect(self.toggle_start) grid.addWidget(self.start_checkbox, 0, 0) self._start = QDoubleSpinBox() self._start.setMaximum(999999) self._start.setValue(start) self._start.setDecimals(2) self._start.setSuffix(" s") grid.addWidget(self._start, 0, 1) self.stop_checkbox = QCheckBox("Stop time:") self.stop_checkbox.setChecked(True) self.stop_checkbox.stateChanged.connect(self.toggle_stop) grid.addWidget(self.stop_checkbox, 1, 0) self._stop = QDoubleSpinBox() self._stop.setMaximum(999999) self._stop.setValue(stop) self._stop.setDecimals(2) self._stop.setSuffix(" s") grid.addWidget(self._stop, 1, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
def __init__(self, parent, rows, selected=None, disabled=None): super().__init__(parent) self.setWindowTitle("Select XDF Stream") self.model = QStandardItemModel() self.model.setHorizontalHeaderLabels( ["ID", "Name", "Type", "Channels", "Format", "Sampling Rate"]) for index, stream in enumerate(rows): items = [] for item in stream: tmp = QStandardItem() tmp.setData(item, Qt.DisplayRole) items.append(tmp) for item in items: item.setEditable(False) if disabled is not None and index in disabled: item.setFlags(Qt.NoItemFlags) self.model.appendRow(items) self.view = QTableView() self.view.setModel(self.model) self.view.verticalHeader().setVisible(False) self.view.horizontalHeader().setStretchLastSection(True) self.view.setShowGrid(False) self.view.setSelectionMode(QAbstractItemView.SingleSelection) self.view.setSelectionBehavior(QAbstractItemView.SelectRows) if selected is not None: self.view.selectRow(selected) self.view.setSortingEnabled(True) self.view.sortByColumn(0, Qt.AscendingOrder) vbox = QVBoxLayout(self) vbox.addWidget(self.view) hbox = QHBoxLayout() self._effective_srate = QCheckBox("Use effective sampling rate") self._effective_srate.setChecked(True) hbox.addWidget(self._effective_srate) self._prefix_markers = QCheckBox("Prefix markers with stream ID") self._prefix_markers.setChecked(False) if not disabled: self._prefix_markers.setEnabled(False) hbox.addWidget(self._prefix_markers) vbox.addLayout(hbox) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(self.buttonbox) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) self.resize(775, 650) self.view.setColumnWidth(0, 90) self.view.setColumnWidth(1, 200) self.view.setColumnWidth(2, 140)
def __init__(self, parent, nchan, methods): super().__init__(parent) self.setWindowTitle("Run ICA") vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Method:"), 0, 0) self.method = QComboBox() self.method.addItems(methods) self.method.setCurrentIndex(0) self.method.currentIndexChanged.connect(self.toggle_options) grid.addWidget(self.method, 0, 1) self.extended_label = QLabel("Extended:") grid.addWidget(self.extended_label, 1, 0) self.extended = QCheckBox() self.extended.setChecked(True) grid.addWidget(self.extended, 1, 1) self.ortho_label = QLabel("Orthogonal:") grid.addWidget(self.ortho_label, 2, 0) self.ortho = QCheckBox() self.ortho.setChecked(False) grid.addWidget(self.ortho, 2, 1) if "Picard" not in methods: self.ortho_label.hide() self.ortho.hide() grid.addWidget(QLabel("Number of components:"), 3, 0) self.n_components = QSpinBox() self.n_components.setRange(0, nchan) self.n_components.setValue(nchan) self.n_components.setAlignment(Qt.AlignRight) grid.addWidget(self.n_components, 3, 1) grid.addWidget(QLabel("Exclude bad segments:"), 4, 0) self.exclude_bad_segments = QCheckBox() self.exclude_bad_segments.setChecked(True) grid.addWidget(self.exclude_bad_segments, 4, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize) self.toggle_options()
def __init__(self) -> None: super().__init__() # member self.combobox_parameter1 = IM3536ParameterCombobox() self.combobox_parameter2 = IM3536ParameterCombobox() self.combobox_parameter3 = IM3536ParameterCombobox() self.combobox_parameter4 = IM3536ParameterCombobox() self.spinbox_measurements_num = QSpinBox() self.checkbox_parmanent = QCheckBox("Parmanent Measurement") self.checkbox_acquire_monitor_data = QCheckBox( "Acquire Voltage/Current Monitor Values") self.group_parameter = QGroupBox("Parameter") self.group_only_lcr = QGroupBox("Only LCR Meter Mode") self.group_option = QGroupBox("Option") # setup self.combobox_parameter1.setCurrentText( "Rs (Equivalent series resistance)") self.combobox_parameter1.set_none_disabled(True) self.spinbox_measurements_num.setRange(1, 1000000000) self.checkbox_acquire_monitor_data.setChecked(True) self.checkbox_parmanent.setChecked(True) self.spinbox_measurements_num.setEnabled(False) self.group_only_lcr.setEnabled(False) # stup layout f_layout_parameter = QFormLayout() f_layout_parameter.addRow("1", self.combobox_parameter1) f_layout_parameter.addRow("2", self.combobox_parameter2) f_layout_parameter.addRow("3", self.combobox_parameter3) f_layout_parameter.addRow("4", self.combobox_parameter4) self.group_parameter.setLayout(f_layout_parameter) f_layout_only_lcr = QFormLayout() f_layout_only_lcr.addRow(self.checkbox_parmanent) f_layout_only_lcr.addRow("Number of Measurements", self.spinbox_measurements_num) self.group_only_lcr.setLayout(f_layout_only_lcr) f_layout_option = QFormLayout() f_layout_option.addRow(self.checkbox_acquire_monitor_data) self.group_option.setLayout(f_layout_option) v_layout = AVBoxLayout(self) v_layout.addWidget(self.group_parameter) v_layout.addWidget(self.group_only_lcr) v_layout.addWidget(self.group_option)
def __init__(self): super(FindToolBar, self).__init__() self._line_edit = QLineEdit() self._line_edit.setClearButtonEnabled(True) self._line_edit.setPlaceholderText("Find...") self._line_edit.setMaximumWidth(300) self._line_edit.returnPressed.connect(self._find_next) self.addWidget(self._line_edit) self._previous_button = QToolButton() style_icons = ':/qt-project.org/styles/commonstyle/images/' self._previous_button.setIcon(QIcon(style_icons + 'up-32.png')) self._previous_button.clicked.connect(self._find_previous) self.addWidget(self._previous_button) self._next_button = QToolButton() self._next_button.setIcon(QIcon(style_icons + 'down-32.png')) self._next_button.clicked.connect(self._find_next) self.addWidget(self._next_button) self._case_sensitive_checkbox = QCheckBox('Case Sensitive') self.addWidget(self._case_sensitive_checkbox) self._hideButton = QToolButton() self._hideButton.setShortcut(QKeySequence(Qt.Key_Escape)) self._hideButton.setIcon(QIcon(style_icons + 'closedock-16.png')) self._hideButton.clicked.connect(self.hide) self.addWidget(self._hideButton)
def change_settings(self, settings): # First clean up all previous items for i in range(self.layout.count()): self.layout.removeItem(self.layout.takeAt(0)) for w in self.widgets: w.deleteLater() self.widgets = [] if not settings: label = QLabel(self.parentWidget()) label.setObjectName("settings_empty_label") label.setText("Для данной операции настройки отсутствуют") label.setWordWrap(True) self.widgets.append(label) self.layout.addWidget(label, 0, 0) else: x = 0 for s in settings: if isinstance(s.type, range): label = QLabel(self.parentWidget()) label.setText(s.text) label.setWordWrap(True) self.widgets.append(label) self.layout.addWidget(label, x, 0) slider = QSlider(self.parentWidget()) slider.setOrientation(Qt.Horizontal) slider.setMinimum(s.type.start // s.type.step) slider.setMaximum(s.type.stop // s.type.step - 1) slider.setValue(s.value // s.type.step) self.layout.addWidget(slider, x + 1, 0) line_edit = QLineEdit(self.parentWidget()) line_edit.setText(str(s.value)) self.layout.addWidget(line_edit, x + 1, 1) slider.valueChanged.connect( partial(self.slider_change, line_edit, s)) line_edit.returnPressed.connect( partial(self.line_edit_change, slider, line_edit, s)) self.widgets.append(slider) self.widgets.append(line_edit) x += 2 elif s.type == bool: checkbox = QCheckBox(self.parentWidget()) checkbox.setText('\n'.join(wrap(s.text, 40))) checkbox.setChecked(s.value) checkbox.clicked.connect( partial(self.checkbox_changed, checkbox, s)) self.layout.addWidget(checkbox, x, 0) self.widgets.append(checkbox) x += 1 elif s.type in (int, float, str): pass
def __init__(self): super(MainWindow, self).__init__() self.setWindowTitle("My App") checkBox = QCheckBox("This is a checkbox") checkBox.setCheckable(Qt.Checked) checkBox.stateChanged.connect(self.show_state) self.setCentralWidget(checkBox)
def __init__(self, parent, channels, default_stim): super().__init__(parent) self.setWindowTitle("Find Events") vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Stim channel:"), 0, 0) self.stimchan = QComboBox() self.stimchan.addItems(channels) self.stimchan.setCurrentIndex(default_stim) grid.addWidget(self.stimchan, 0, 1) grid.addWidget(QLabel("Consecutive"), 1, 0) self.consecutive = QCheckBox() self.consecutive.setChecked(True) grid.addWidget(self.consecutive, 1, 1) grid.addWidget(QLabel("Initial event"), 2, 0) self.initial_event = QCheckBox() self.initial_event.setChecked(True) grid.addWidget(self.initial_event, 2, 1) grid.addWidget(QLabel("Cast to unsigned integer"), 3, 0) self.uint_cast = QCheckBox() self.uint_cast.setChecked(True) grid.addWidget(self.uint_cast, 3, 1) grid.addWidget(QLabel("Minimum duration:"), 4, 0) self.minduredit = QSpinBox() self.minduredit.setMaximum(MAX_INT) grid.addWidget(self.minduredit, 4, 1) grid.addWidget(QLabel("Shortest event:"), 5, 0) self.shortesteventedit = QSpinBox() self.shortesteventedit.setMaximum(MAX_INT) grid.addWidget(self.shortesteventedit, 5, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
def init_add_suffix_checkbox(self): """ Initialize the layout for add suffix checkbox """ self.add_suffix_checkbox = QCheckBox() self.add_suffix_checkbox.setObjectName("AddSuffixCheckBox") self.add_suffix_checkbox.setChecked(self.add_suffix) self.add_suffix_checkbox.clicked.connect( self.add_suffix_checkbox_clicked) self.transfer_roi_window_grid_layout.addWidget( self.add_suffix_checkbox, 3, 0)
def __init__(self, parent=None): super(Window, self).__init__(parent) self.iconGroupBox = QGroupBox() self.iconLabel = QLabel() self.iconComboBox = QComboBox() self.showIconCheckBox = QCheckBox() self.messageGroupBox = QGroupBox() self.typeLabel = QLabel() self.durationLabel = QLabel() self.durationWarningLabel = QLabel() self.titleLabel = QLabel() self.bodyLabel = QLabel() self.typeComboBox = QComboBox() self.durationSpinBox = QSpinBox() self.titleEdit = QLineEdit() self.bodyEdit = QTextEdit() self.showMessageButton = QPushButton() self.minimizeAction = QAction() self.maximizeAction = QAction() self.restoreAction = QAction() self.quitAction = QAction() self.trayIcon = QSystemTrayIcon() self.trayIconMenu = QMenu() self.createIconGroupBox() self.createMessageGroupBox() self.iconLabel.setMinimumWidth(self.durationLabel.sizeHint().width()) self.createActions() self.createTrayIcon() self.showMessageButton.clicked.connect(self.showMessage) self.showIconCheckBox.toggled.connect(self.trayIcon.setVisible) self.iconComboBox.currentIndexChanged.connect(self.setIcon) self.trayIcon.messageClicked.connect(self.messageClicked) self.trayIcon.activated.connect(self.iconActivated) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.iconGroupBox) self.mainLayout.addWidget(self.messageGroupBox) self.setLayout(self.mainLayout) self.iconComboBox.setCurrentIndex(1) self.trayIcon.show() self.setWindowTitle("Systray") self.resize(400, 300)
def __init__(self, parent, events): super().__init__(parent) self.setWindowTitle("Create Epochs") grid = QGridLayout(self) label = QLabel("Events:") label.setAlignment(Qt.AlignTop) grid.addWidget(label, 0, 0, 1, 1) self.events = QListWidget() self.events.insertItems(0, unique(events[:, 2]).astype(str)) self.events.setSelectionMode(QListWidget.ExtendedSelection) grid.addWidget(self.events, 0, 1, 1, 2) grid.addWidget(QLabel("Interval around events:"), 1, 0, 1, 1) self.tmin = QDoubleSpinBox() self.tmin.setMinimum(-10000) self.tmin.setValue(-0.2) self.tmin.setSingleStep(0.1) self.tmin.setAlignment(Qt.AlignRight) self.tmax = QDoubleSpinBox() self.tmax.setMinimum(-10000) self.tmax.setValue(0.5) self.tmax.setSingleStep(0.1) self.tmax.setAlignment(Qt.AlignRight) grid.addWidget(self.tmin, 1, 1, 1, 1) grid.addWidget(self.tmax, 1, 2, 1, 1) self.baseline = QCheckBox("Baseline Correction:") self.baseline.setChecked(True) self.baseline.stateChanged.connect(self.toggle_baseline) grid.addWidget(self.baseline, 2, 0, 1, 1) self.a = QDoubleSpinBox() self.a.setMinimum(-10000) self.a.setValue(-0.2) self.a.setSingleStep(0.1) self.a.setAlignment(Qt.AlignRight) self.b = QDoubleSpinBox() self.b.setMinimum(-10000) self.b.setValue(0) self.b.setSingleStep(0.1) self.b.setAlignment(Qt.AlignRight) grid.addWidget(self.a, 2, 1, 1, 1) grid.addWidget(self.b, 2, 2, 1, 1) self.buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.buttonbox.accepted.connect(self.accept) self.buttonbox.rejected.connect(self.reject) grid.addWidget(self.buttonbox, 3, 0, 1, -1) self.events.itemSelectionChanged.connect(self.toggle_ok) self.toggle_ok() grid.setSizeConstraint(QGridLayout.SetFixedSize)
def __init__(self) -> None: super().__init__() # member self.pathname_line = PathLine() self.checkbox_save_to_file = QCheckBox("Save to File") self.t_button_open_filedialog = create_tool_button( is_text_beside_icon=True) self.t_button_step_mode = create_tool_button(fixed_width=250) self.t_button_cycle_mode = create_tool_button(fixed_width=250) self.t_button_only_lcr_mode = create_tool_button(fixed_width=250) self.t_button_lcr_state = create_tool_button(fixed_width=250) self.spinbox_interval = QSpinBox() self.group_save = QGroupBox("Save") self.group_mode = QGroupBox("Mode") self.group_lcr_state = QGroupBox("LCR Meter") self.group_measure_interval = QGroupBox("Measurement Interval") # setup self.spinbox_interval.setRange(1, 100000) self.checkbox_save_to_file.setEnabled(False) # setup layout f_layout_save = QFormLayout() f_layout_save.addRow("File Path", self.pathname_line) f_layout_save.addWidget(self.t_button_open_filedialog) f_layout_save.addRow(self.checkbox_save_to_file) self.group_save.setLayout(f_layout_save) v_layout_mode = AVBoxLayout() v_layout_mode.addWidget(self.t_button_step_mode) v_layout_mode.addWidget(self.t_button_cycle_mode) v_layout_mode.addWidget(self.t_button_only_lcr_mode) v_layout_mode.setAlignment(Qt.AlignHCenter) self.group_mode.setLayout(v_layout_mode) v_layout_lcr_state = AVBoxLayout() v_layout_lcr_state.addWidget(self.t_button_lcr_state) v_layout_lcr_state.setAlignment(Qt.AlignHCenter) self.group_lcr_state.setLayout(v_layout_lcr_state) f_layout_repeat = QFormLayout() f_layout_repeat.addRow("Interval", add_unit(self.spinbox_interval, "msec")) self.group_measure_interval.setLayout(f_layout_repeat) v_layout = AVBoxLayout(self) v_layout.addWidget(self.group_save) v_layout.addWidget(self.group_mode) v_layout.addWidget(self.group_lcr_state) v_layout.addWidget(self.group_measure_interval)
def set_item_data(self, i, DisplayName, name, sid): check_box_layout = QHBoxLayout() check_box_layout.setAlignment(Qt.AlignmentFlag.AlignCenter) check_box = QCheckBox() check_box.setObjectName('check_box_' + str(i)) check_box_layout.addWidget(check_box) check_box_layout.setContentsMargins(0, 0, 0, 0) check_box_widget = QWidget() check_box_widget.setLayout(check_box_layout) self.tableWidget.item(i, 2).setText(DisplayName) self.tableWidget.item(i, 3).setText(name) self.tableWidget.item(i, 4).setText(sid) self.tableWidget.setCellWidget(i, 0, check_box_widget)
def setup(self, dialog): dialog.resize(320, 132) dialog.setModal(True) dialog.setWindowTitle("Please Login to Continue") self.form_layout = QFormLayout(dialog) self.form_layout.setObjectName("formLayout") self.login_label = QLabel("Server requesting authentication", dialog) self.login_label.setObjectName("login_label") self.form_layout.setWidget(0, QFormLayout.SpanningRole, self.login_label) self.username_label = QLabel(dialog) self.username_label.setObjectName("username_label") self.form_layout.setWidget(1, QFormLayout.LabelRole, self.username_label) self.username = QLineEdit(dialog) self.username.setObjectName("username") self.username.setStatusTip("Enter your username.") self.form_layout.setWidget(1, QFormLayout.FieldRole, self.username) self.password_label = QLabel(dialog) self.password_label.setObjectName("password_label") self.form_layout.setWidget(2, QFormLayout.LabelRole, self.password_label) self.password = QLineEdit(dialog) self.password.setObjectName("password") self.password.setStatusTip("Enter your password.") self.password.setEchoMode(QLineEdit.PasswordEchoOnEdit) self.form_layout.setWidget(2, QFormLayout.FieldRole, self.password) self.save_username = QCheckBox("&Save username", dialog) self.save_username.setObjectName("save_username") self.form_layout.setWidget(3, QFormLayout.FieldRole, self.save_username) self.button_box = QDialogButtonBox(dialog) self.button_box.setObjectName("button_box") self.button_box.setOrientation(Qt.Horizontal) self.button_box.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.form_layout.setWidget(4, QFormLayout.SpanningRole, self.button_box) self.button_box.accepted.connect(dialog.accept) self.button_box.rejected.connect(dialog.close) QMetaObject.connectSlotsByName(dialog)
def __init__(self, parent=None): super(Maker, self).__init__(parent) self.setWindowTitle("Project Maker") self.userFilepath = QLineEdit() self.userFilepath.setPlaceholderText("Your filepath here...") self.projName = QLineEdit() self.projName.setPlaceholderText("Your project name here...") self.makeButton = QPushButton("Create Project") self.fileSearchButton = QPushButton("...") self.fileSearchButton.setToolTip( "Search for a directory for your project") self.goProj = QRadioButton("Go Project") self.goProj.setToolTip("You will still need a go.mod file") self.pyProj = QRadioButton("Python Project") self.versionControlFiles = QCheckBox( "Create README.md and .gitignore?") self.versionControlFiles.setToolTip( "Creates the files used in online version control, such as Github") self.pyProj.setChecked(True) self.versionControlFiles.setChecked(True) projSelect = QGroupBox("Project Selection") projectOptions = QVBoxLayout() projectOptions.addWidget(self.pyProj) projectOptions.addWidget(self.goProj) projectOptions.addWidget(self.versionControlFiles) projectOptions.stretch(1) projSelect.setLayout(projectOptions) searchLayout = QHBoxLayout() searchLayout.addWidget(self.userFilepath) searchLayout.addWidget(self.fileSearchButton) searchLayout.stretch(1) layout = QVBoxLayout() layout.addLayout(searchLayout) layout.addWidget(self.projName) layout.addWidget(self.makeButton) layout.addWidget(self.fileSearchButton) layout.addWidget(projSelect) self.setLayout(layout) self.makeButton.clicked.connect(self.createFiles) self.fileSearchButton.clicked.connect(self.onClickFileSearch)
def __init__(self, parent, trigger_data): super().__init__(parent) self.trigger_data = trigger_data self.tag = self.trigger_data.get('Tag') self.uuid = str(uuid4()) self.path = self.parent().path / 'img' self.name = QLineEdit(self.trigger_data.get('Name', '')) self.search_text = QLineEdit(self.trigger_data.get('SearchText', '')) self.alert_text = QLineEdit(self.trigger_data.get('AlertText', '')) self.use_audio = QCheckBox() self.use_audio.setChecked( eval(self.trigger_data.get('UseAudio', 'False'))) self.button_box = QDialogButtonBox(QDialogButtonBox.Cancel | QDialogButtonBox.Save) self.button_box.accepted.connect(self.save) self.button_box.rejected.connect(self.reject) self.create_gui()
def __init__(self, parent): QWidget.__init__(self, parent) self._id = 0 self.layout = QHBoxLayout() self.layout.setContentsMargins(0, 0, 0, 0) self.null_flag = QCheckBox(parent) self.null_flag.setChecked(False) self.null_flag.setText(self.tr("Currency")) self.layout.addWidget(self.null_flag) self.currency = CurrencyComboBox(parent) self.currency.setEnabled(False) self.layout.addWidget(self.currency) self.setLayout(self.layout) self.setFocusProxy(self.null_flag) self.null_flag.clicked.connect(self.onClick) self.currency.changed.connect(self.onCurrencyChange)
def setup_plugins_tab(self) -> None: self.plugins = get_plugins() self.plugin_checkboxes = {} for plugin in self.plugins: checkbox = QCheckBox() checkbox.setChecked(plugin.enabled) self.plugin_checkboxes[plugin.get_settings_name()] = checkbox self.ui.gridLayoutPlugins.addWidget(checkbox) self.ui.gridLayoutPlugins.addWidget(QLabel(plugin.name)) self.ui.gridLayoutPlugins.addWidget(QLabel(plugin.description)) # Add spacer to fill the remaining space self.ui.gridLayoutPlugins.addItem( QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)) self.ui.pushButtonReloadPlugins.clicked.connect( self.slot_reload_plugins)
def init_ui(self): names = self.__dict__ self.main_layout = QVBoxLayout() for i in range(6): names[self.get_hlayout_name_at(i)] = QHBoxLayout() for j in range(8): names[self.get_checkbox_at(i, j)] = QCheckBox() names[self.get_hlayout_name_at(i)].addWidget( names[self.get_checkbox_at(i, j)]) self.main_layout.addLayout(names[self.get_hlayout_name_at(i)]) names[self.__DESCRIPTION + str(i)] = QLabel() self.main_layout.addWidget(names[self.__DESCRIPTION + str(i)]) self.btn_reset = QPushButton("RESET") self.btn_send = QPushButton("SEND") self.main_layout.addWidget(self.btn_reset) self.main_layout.addWidget(self.btn_send) self.setLayout(self.main_layout)
def createIconGroupBox(self): self.iconGroupBox = QGroupBox("Tray Icon") self.iconLabel = QLabel("Icon:") self.iconComboBox = QComboBox() self.iconComboBox.addItem(QIcon(":/images/bad.png"), "Bad") self.iconComboBox.addItem(QIcon(":/images/heart.png"), "Heart") self.iconComboBox.addItem(QIcon(":/images/trash.png"), "Trash") self.showIconCheckBox = QCheckBox("Show icon") self.showIconCheckBox.setChecked(True) iconLayout = QHBoxLayout() iconLayout.addWidget(self.iconLabel) iconLayout.addWidget(self.iconComboBox) iconLayout.addStretch() iconLayout.addWidget(self.showIconCheckBox) self.iconGroupBox.setLayout(iconLayout)
def _dismissableMessage(parent: Optional[QWidget], message: str, icon: QIcon, buttons: QMessageBox.StandardButton, dismissed_messages: MutableMapping[ str, QMessageBox.StandardButton]) -> QMessageBox.StandardButton: if message in dismissed_messages: return dismissed_messages[message] message_box = QMessageBox(icon, QApplication.applicationName(), message, buttons, parent) checkbox = QCheckBox(message_box) checkbox.setText('Don\'t warn again') message_box.setCheckBox(checkbox) button = message_box.exec() if checkbox.isChecked(): dismissed_messages[message] = button return button
def __init__(self, index, level=0, text=None): super().__init__() self.index = index self.level = level self.layout = QHBoxLayout() self.checkbox = QCheckBox() self.lineedit = QLineEdit() self.checkbox.setFocusPolicy(Qt.NoFocus) self.lineedit.setFocusPolicy(Qt.ClickFocus) self.lineedit.setText(text) self.lineedit.installEventFilter(self) self.layout.addWidget(self.checkbox) self.layout.addWidget(self.lineedit) self.setLayout(self.layout) self.checkbox.stateChanged.connect(self.checked_slot) self.lineedit.returnPressed.connect(self.return_slot)
def createEditor(self, parent, option, index): if index.column() != 2: return None original_value = index.model().data(index, Qt.UserRole) if not self.is_supported_type(original_value): return None editor = None if isinstance(original_value, bool): editor = QCheckBox(parent) if isinstance(original_value, int): editor = QSpinBox(parent) editor.setRange(-32767, 32767) else: editor = QLineEdit(parent) editor.setFrame(False) validator = self._type_checker.create_validator(original_value, editor) if validator: editor.setValidator(validator) return editor
def __init__(self): super().__init__() self.setupUi(self) common_qt_lib.set_default_window_icon(self) self.refresh_button = QPushButton("Refresh") self.button_box.addButton(self.refresh_button, QDialogButtonBox.ResetRole) self.button_box.button(QDialogButtonBox.Ok).setEnabled(False) self.button_box.button(QDialogButtonBox.Ok).setText("Import") self.button_box.accepted.connect(self.attempt_join) self.button_box.rejected.connect(self.reject) self.refresh_button.clicked.connect(self.refresh) self._status_checks = ( (self.status_open_check, "open"), (self.status_invitational_check, "invitational"), (self.status_pending_check, "pending"), (self.status_inprogress_check, "in_progress"), (self.status_finished_check, "finished"), (self.status_cancelled_check, "cancelled"), ) for check, _ in self._status_checks: check.stateChanged.connect(self.update_list) self.filter_name_edit.textEdited.connect(self.update_list) self._game_checks = set() for game in _SUPPORTED_GAME_URLS: game_checkbox = QCheckBox(game.long_name) game_checkbox.setChecked(True) self.game_check_layout.addWidget(game_checkbox) game_checkbox.stateChanged.connect(self.update_list) self._game_checks.add((game_checkbox, game)) self.table_widget.itemSelectionChanged.connect( self.on_selection_changed) self.table_widget.itemDoubleClicked.connect(self.on_double_click)
def __init__(self, parent: QWidget, image: QImage, name: str, image_path: Optional[str] = None, array_path: Optional[str] = None, default_check: bool = True): """ Initialize a CheckableImageEntry :param QWidget parent: The parent containing the ImageEntry. :param QImage image: The image that will be draw in the thumbnail. :param str name: The name that will be shown below the thumbnail. Also used for image basename. :param image_path: Path to the image file. :type image_path: str, optional :param array_path: Path to the Numpy array file. :type array_path: str, optional :param bool default_check: If True, the checkbox will be checked. """ super(CheckableImageEntry, self).__init__(parent, image, name, image_path, array_path) self.__check_box = QCheckBox(self) self.__check_box.setSizePolicy( QSizePolicy.Preferred, QSizePolicy.Minimum) self.__check_box.setChecked(default_check) self.__check_box.stateChanged.connect(self.state_changed) self.layout().insertWidget(1, self.__check_box, alignment=Qt.AlignHCenter)
def setupUi(self, SelectAccountDlg): if not SelectAccountDlg.objectName(): SelectAccountDlg.setObjectName(u"SelectAccountDlg") SelectAccountDlg.resize(400, 141) self.verticalLayout = QVBoxLayout(SelectAccountDlg) self.verticalLayout.setObjectName(u"verticalLayout") self.DescriptionLbl = QLabel(SelectAccountDlg) self.DescriptionLbl.setObjectName(u"DescriptionLbl") self.verticalLayout.addWidget(self.DescriptionLbl) self.AccountWidget = AccountSelector(SelectAccountDlg) self.AccountWidget.setObjectName(u"AccountWidget") self.verticalLayout.addWidget(self.AccountWidget) self.ReuseAccount = QCheckBox(SelectAccountDlg) self.ReuseAccount.setObjectName(u"ReuseAccount") self.verticalLayout.addWidget(self.ReuseAccount) self.buttonBox = QDialogButtonBox(SelectAccountDlg) self.buttonBox.setObjectName(u"buttonBox") self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Ok) self.verticalLayout.addWidget(self.buttonBox) self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding) self.verticalLayout.addItem(self.verticalSpacer) self.retranslateUi(SelectAccountDlg) self.buttonBox.accepted.connect(SelectAccountDlg.close) QMetaObject.connectSlotsByName(SelectAccountDlg)
def __init__(self, parent): super().__init__(parent) self.setWindowTitle("Interpolate bad channels") vbox = QVBoxLayout(self) grid = QGridLayout() grid.addWidget(QLabel("Reset bads:"), 0, 0) self.reset_bads_checkbox = QCheckBox() self.reset_bads_checkbox.setChecked(True) grid.addWidget(self.reset_bads_checkbox, 0, 1) grid.addWidget(QLabel("Mode:"), 1, 0) self.mode_select = QComboBox() self.modes = {"Accurate": "accurate", "Fast": "fast"} self.mode_select.addItems(self.modes.keys()) self.mode_select.setCurrentText("Accurate") grid.addWidget(self.mode_select, 1, 1) grid.addWidget(QLabel("Origin (x, y, z):"), 2, 0) hbox = QHBoxLayout() self.x = QDoubleSpinBox() self.x.setValue(0) self.x.setDecimals(3) hbox.addWidget(self.x) self.y = QDoubleSpinBox() self.y.setValue(0) self.y.setDecimals(3) hbox.addWidget(self.y) self.z = QDoubleSpinBox() self.z.setValue(0.04) self.z.setDecimals(3) hbox.addWidget(self.z) grid.addLayout(hbox, 2, 1) vbox.addLayout(grid) buttonbox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) vbox.addWidget(buttonbox) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) vbox.setSizeConstraint(QVBoxLayout.SetFixedSize)
def __init__(self, master): QDialog.__init__(self) self.setWindowTitle("Configuração") self.setFixedSize(200, 200) self.setWindowIcon(QIcon(r'images\icon6.ico')) self.setModal(True) button1 = QPushButton("Cancelar") button1.clicked.connect(self.closeDialog) button2 = QPushButton("Confirmar") button2.clicked.connect(lambda: self.saveAndClose(master)) num_elementos = len(master.timedeltas) self.checkboxes = [0]*num_elementos for i in range(num_elementos): self.checkboxes[i] = QCheckBox(master.timedeltastr[i]) # Organizando o layout grupo = QGroupBox("Incluir Precipitação Acumulada Em") grid = QGridLayout() for x in range(num_elementos): if x < num_elementos/2: grid.addWidget(self.checkboxes[x], x , 0) else: grid.addWidget(self.checkboxes[x], x - num_elementos/2, 1) # grupo.setLayout(grid) self.startCheckboxes(master) # sublayout = QHBoxLayout() sublayout.addWidget(button1) sublayout.addWidget(button2) # layout = QVBoxLayout() layout.addWidget(grupo) layout.addLayout(sublayout) self.setLayout(layout)
def __init__(self, parent=None): super(Form, self).__init__(parent) self.title = "Emoji Splitter" self.setWindowTitle(self.title) # preview_split widget self.preview_widget = QLabel() # media_preview = QPixmap('C:/Users/roela/PycharmProjects/Emojisplitter/bolkvis.png') # media_preview = QMovie('Naamloos.gif') # QPixmap('Naamloos.gif') self.media_preview('Naamloos.gif') # embed preview_split in a scrollable window self.preview_scroll_area = QScrollArea() self.preview_scroll_area.setWidget(self.preview_widget) self.preview_scroll_area.setBackgroundRole(QPalette.Dark) self.preview_scroll_area.setWidgetResizable(True) # Create button widgets self.open_file_button = QPushButton("Select &File") self.filename = QLineEdit("C:/Users/roela/PycharmProjects/Emojisplitter/Naamloos.gif") self.preview_button = QPushButton("&Preview Split") self.fit_to_window_checkbox = QCheckBox("Fit Preview Image to &Window") self.horizontal_emojis_spinbox = QSpinBox() self.horizontal_emojis_spinbox.setMinimum(1) self.horizontal_emojis_label = QLabel("Number of &horizontal emojis:") self.horizontal_emojis_label.setBuddy(self.horizontal_emojis_spinbox) self.vertical_emojis_spinbox = QSpinBox() self.vertical_emojis_spinbox.setMinimum(1) self.vertical_emojis_label = QLabel("Number of &vertical emojis:") self.vertical_emojis_label.setBuddy(self.vertical_emojis_spinbox) self.split_emojis_button = QPushButton("&Split Emoji") self.results_folder_button = QPushButton("Open folder with &results") # give the button_layout a fixed width button_container = QWidget() button_container.setFixedWidth(256) # Create layout and add widgets button_layout = QVBoxLayout(button_container) button_layout.addWidget(self.open_file_button) button_layout.addWidget(self.filename) # Put labels next to spinboxes horizontal_emojis_layout = QHBoxLayout() horizontal_emojis_layout.addWidget(self.horizontal_emojis_label) horizontal_emojis_layout.addWidget(self.horizontal_emojis_spinbox) vertical_emojis_layout = QHBoxLayout() vertical_emojis_layout.addWidget(self.vertical_emojis_label) vertical_emojis_layout.addWidget(self.vertical_emojis_spinbox) button_layout.addLayout(horizontal_emojis_layout) button_layout.addLayout(vertical_emojis_layout) button_layout.addWidget(self.preview_button) button_layout.addWidget(self.fit_to_window_checkbox) button_layout.addWidget(self.split_emojis_button) button_layout.addWidget(self.results_folder_button) preview_layout = QVBoxLayout() # preview_layout.addWidget(self.preview_widget) preview_layout.addWidget(self.preview_scroll_area) # combine button and preview_split layout nested_layout = QHBoxLayout() nested_layout.addWidget(button_container) nested_layout.addLayout(preview_layout) # Set dialog layout self.setLayout(nested_layout) # Add button functions self.open_file_button.clicked.connect(self.open_file) self.preview_button.clicked.connect(self.preview_split) self.fit_to_window_checkbox.clicked.connect(self.fit_to_window) self.split_emojis_button.clicked.connect(self.split) self.results_folder_button.clicked.connect(self.open_folder_with_results) # update preview_split on changing value of a spinbox self.horizontal_emojis_spinbox.valueChanged.connect(self.preview_split) self.vertical_emojis_spinbox.valueChanged.connect(self.preview_split)
def __init__(self, db_name_from_visualize): super().__init__() self.db_name_from_visual_btn = db_name_from_visualize self.type_of_display = QLabel( "Please choose how you'd like to display the data", self) self.type_of_display.move(20, 20) self.type_of_display.setStyleSheet("border: 1px solid black;") self.type_of_display.setFont(QFont("Calibre", 12)) self.which_data = QLabel( "Please select which data you'd like to display", self) self.which_data.move(430, 20) self.which_data.setStyleSheet("border: 1px solid black") self.which_data.setFont(QFont("Calibre", 12)) # LIST BOXES display_list = QListWidget(self) self.list_control = display_list display_list.resize(770, 440) display_list.move(10, 200) # CHECK BOXES self.color_coded_checkbox = QCheckBox("Color coded text in a list", self) self.color_coded_checkbox.move(100, 60) self.color_coded_checkbox.clicked.connect( self.swap_color_coded_checkbox) self.render_map_checkbox = QCheckBox("Render a Map", self) self.render_map_checkbox.move(100, 90) self.render_map_checkbox.toggle() self.render_map_checkbox.clicked.connect(self.swap_render_map_checkbox) self.analysis_type1_checkbox = QCheckBox( "Compare the number of college graduates in a state \n(for the most recent " "year) with number of jobs in that \nstate that likely expect a college " "education.", self) self.analysis_type1_checkbox.setGeometry(430, 20, 300, 100) self.analysis_type1_checkbox.clicked.connect( self.swap_num_grads_checkbox) self.analysis_type2_checkbox = QCheckBox( "Compare the 3 year graduate cohort declining balance \npercentage to " "the 25% salary in the state.", self) self.analysis_type2_checkbox.setGeometry(430, 70, 400, 100) self.analysis_type2_checkbox.toggle() self.analysis_type2_checkbox.clicked.connect( self.swap_3_yr_cohort_checkbox) # PUSH BUTTONS self.render_data_button = QPushButton("VISUALIZE", self) self.render_data_button.setGeometry(10, 150, 770, 40) self.render_data_button.clicked.connect(self.display_visualization) self.sort_ascending_button = QPushButton("Sort Ascending", self) self.sort_ascending_button.setGeometry(10, 650, 120, 30) self.sort_ascending_button.clicked.connect(self.sort_ascending) self.sort_descending_button = QPushButton("Sort Descending", self) self.sort_descending_button.setGeometry(130, 650, 120, 30) self.sort_descending_button.clicked.connect(self.sort_descending) self.close_visual_window_button = QPushButton("CLOSE", self) self.close_visual_window_button.setGeometry(660, 650, 120, 30) self.close_visual_window_button.clicked.connect(lambda: self.close()) self.setWindowTitle( "Data Visualization for Project 1 - Sprint 4 - Ryan O'Connor - COMP490 - T/R" ) self.setGeometry(100, 100, 800, 700) self.setFixedSize(800, 700) self.center()