def _init_options_group_box(self) -> None: """Creates the group of training options.""" self._options_group_box = QGroupBox("Options") options_layout = QGridLayout() left_options = QGridLayout() right_options = QGridLayout() self._lists['data'] = QListWidget() self._lists['data'].setSelectionMode( QtWidgets.QAbstractItemView.SingleSelection) self._lists['data'].currentTextChanged.connect(self._refresh_pandas) self._lists['type'] = QComboBox() for dt in IngestTypes: self._lists['type'].addItem(dt.value) self._refresh_lists() self._lists['type'].currentTextChanged.connect(self._type_changed) validator = QRegularExpressionValidator(r'^[\w\-. ]+$') cat_validator = QRegularExpressionValidator(r'^[0-9]\d*$') dataset_label = QLabel("Avaliable Datasets:") search_type_label = QLabel("Symbol/Search Type:") search_label = QLabel("Symbol/Search Term:") name_label = QLabel("Dataset Name:") cat_label = QLabel("Trends Category Code:") left_options.addWidget(dataset_label, 0, 0) left_options.addWidget(self._lists['data'], 1, 0) right_options.addWidget(search_type_label, 0, 0) right_options.addWidget(self._lists['type'], 1, 0) self._txt_var['ds_name'] = QLineEdit() self._txt_var['data_search'] = QLineEdit() self._txt_var['search_cat'] = QLineEdit() self._txt_var['ds_name'].setValidator(validator) self._txt_var['data_search'].setValidator(validator) self._txt_var['search_cat'].setValidator(cat_validator) self._txt_var['search_cat'].setPlaceholderText('0') right_options.addWidget(search_label, 2, 0) right_options.addWidget(self._txt_var['data_search'], 3, 0) right_options.addWidget(name_label, 4, 0) right_options.addWidget(self._txt_var['ds_name'], 5, 0) right_options.addWidget(cat_label, 6, 0) right_options.addWidget(self._txt_var['search_cat'], 7, 0) options_layout.addLayout(left_options, 0, 0) options_layout.addLayout(right_options, 0, 1) options_layout.setColumnStretch(0, 1) self._options_group_box.setLayout(options_layout)
def grid_layout_creation_1(self) -> None: self.group_box_1 = QGroupBox("Files") row = -1 d = cfg.PLATFORM_SETTINGS # pprint(d) layout = QGridLayout() row += 1 layout.addWidget(QLabel(bold("preferences.ini:")), row, 0) fname = cfg.PREFERENCES_INI layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("categories.yaml:")), row, 0) fname = cfg.categories_file() layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("settings.json:")), row, 0) fname = cfg.SETTINGS_FILE layout.addWidget(QLabel(fname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_file_with_editor, self, fname)) layout.addWidget(btn, row, 2) self.group_box_1.setLayout(layout)
def create_data_group(self): """Creates group for holding specific choice data selection""" button_group = QButtonGroup(self) button_group.setExclusive(True) colecao_radio_button = QRadioButton('Coleção') self.partidas_radio_button = QRadioButton('Partidas') colecao_radio_button.setChecked(True) button_group.addButton(colecao_radio_button) button_group.addButton(self.partidas_radio_button) (self.min_date_picker, min_date_label) = create_date_picker('À Partir de:', self) (self.max_date_picker, max_date_label) = create_date_picker('Até:', self) self.min_date_picker.dateChanged.connect( self.max_date_picker.setMinimumDate) colecao_radio_button.toggled.connect(self.min_date_picker.setDisabled) colecao_radio_button.toggled.connect(self.max_date_picker.setDisabled) self.map_users_button = QPushButton( 'Ver mapa de usuarios BGG -> Ludopedia', self) self.map_users_button.setEnabled(False) self.map_users_button.clicked.connect(self.user_map) colecao_radio_button.toggled.connect(self.map_users_button.setDisabled) group_box = QGroupBox('Dados') grid_layout = QGridLayout(group_box) grid_layout.addWidget(colecao_radio_button, 1, 1) grid_layout.addWidget(self.partidas_radio_button, 1, 2) grid_layout.addWidget(min_date_label, 2, 1) grid_layout.addWidget(self.min_date_picker, 2, 2) grid_layout.addWidget(max_date_label, 3, 1) grid_layout.addWidget(self.max_date_picker, 3, 2) grid_layout.addWidget(self.map_users_button, 4, 1, 1, 2) group_box.setLayout(grid_layout) return group_box
def grid_layout_creation_1(self) -> None: self.group_box_1 = QGroupBox("Image info") layout = QGridLayout() layout.addWidget(QLabel(bold("Local file?")), 0, 0) layout.addWidget(QLabel("Yes" if self.img.local_file else "No"), 0, 1) layout.addWidget(QLabel(bold("Path:")), 1, 0) text = self.img.get_absolute_path_or_url() layout.addWidget(QLabel(text), 1, 1) icon = QtGui.QIcon(str(Path(cfg.ASSETS_DIR, "clipboard.png"))) btn = QPushButton() btn.setIcon(icon) btn.setIconSize(QtCore.QSize(ICON_SIZE, ICON_SIZE)) btn.setToolTip("copy to clipboard") btn.clicked.connect(partial(self.copy_to_clipboard, text)) layout.addWidget(btn, 1, 2) layout.addWidget(QLabel(bold("Resolution:")), 2, 0) text = "{w} x {h} pixels".format(w=self.img.original_img.width(), h=self.img.original_img.height()) layout.addWidget(QLabel(text), 2, 1) layout.addWidget(QLabel(bold("Size:")), 3, 0) file_size_hr = self.img.get_file_size(human_readable=True) text = "{0} ({1} bytes)".format( file_size_hr, helper.pretty_num(self.img.get_file_size())) layout.addWidget(QLabel(text), 3, 1) layout.addWidget(QLabel(bold("Flags:")), 4, 0) text = self.img.get_flags() layout.addWidget(QLabel(text), 4, 1) self.group_box_1.setLayout(layout)
def __init__(self, parent: QWidget, parent_layout: QVBoxLayout, line_layout: QHBoxLayout, resource_database: ResourceDatabase, requirement: RequirementArrayBase): self._editors = [] self.resource_database = resource_database self._array_type = type(requirement) # the parent is added to a layout which is added to parent_layout, so we index = parent_layout.indexOf(line_layout) + 1 self.group_box = QGroupBox(parent) self.group_box.setStyleSheet("QGroupBox { margin-top: 2px; }") parent_layout.insertWidget(index, self.group_box) self.item_layout = QVBoxLayout(self.group_box) self.item_layout.setContentsMargins(8, 2, 2, 6) self.item_layout.setAlignment(Qt.AlignTop) self.new_item_button = QPushButton(self.group_box) self.new_item_button.setMaximumWidth(75) self.new_item_button.setText("New Row") self.new_item_button.clicked.connect(self.new_item) self.comment_text_box = QLineEdit(parent) self.comment_text_box.setText(requirement.comment or "") self.comment_text_box.setPlaceholderText("Comment") line_layout.addWidget(self.comment_text_box) for item in requirement.items: self._create_item(item) self.item_layout.addWidget(self.new_item_button)
class MainWindowUI: def setup_ui(self, win: QMainWindow) -> None: # ui widgets self.toolbar = QToolBar("main", parent=win) self.port_combobox1 = PortCombobox("") self.port_combobox2 = PortCombobox("") self.baudrate_combobox = QComboBox() self.monitor1 = QPlainTextEdit("") self.monitor2 = QPlainTextEdit("") self.btn_clear_monitor1 = QPushButton("Clear") self.btn_clear_monitor2 = QPushButton("Clear") self.group_monitor1 = QGroupBox("Monitor 1") self.group_monitor2 = QGroupBox("Monitor 2") # setup widgets self.monitor1.setReadOnly(True) self.monitor1.setLineWrapMode(QPlainTextEdit.NoWrap) self.monitor1.setUndoRedoEnabled(False) self.monitor2.setReadOnly(True) self.monitor2.setLineWrapMode(QPlainTextEdit.NoWrap) self.monitor2.setUndoRedoEnabled(False) self.baudrate_combobox.addItems([ "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "74880", "115200", "230400", "250000", "500000", "1000000", "2000000", ]) self.baudrate_combobox.setCurrentText("9600") # setup layout win.addToolBar(self.toolbar) v_layout = QVBoxLayout() # type:ignore v_layout.addWidget(self.monitor1) v_layout.addWidget(self.btn_clear_monitor1) self.group_monitor1.setLayout(v_layout) v_layout = QVBoxLayout() # type:ignore v_layout.addWidget(self.monitor2) v_layout.addWidget(self.btn_clear_monitor2) self.group_monitor2.setLayout(v_layout) h_layout = QHBoxLayout() # type:ignore h_layout.addWidget(self.group_monitor1) h_layout.addWidget(self.group_monitor2) central_widget = QWidget() central_widget.setLayout(h_layout) win.setCentralWidget(central_widget)
class Profile(QWidget): def __init__(self): QWidget.__init__(self, None) self.ui = Ui_Form() self.setFixedSize(710, 465) self.ui.setupUi(self) self.ui.piclabel.setPixmap(QPixmap("app/UI/pngegg.png")) self.ui.piclabel.setScaledContents(True) self.widget = QWidget() formlayout = QFormLayout() self.blayout = QHBoxLayout() self.vlayout = QVBoxLayout() self.groupBox = QGroupBox() self.ui.editButton.clicked.connect(self.editProfile) def refresh(self): self.updateProfile(self.user) def updateProfile(self, cur_user): self.user = cur_user self.ui.usernameLabel.setText(cur_user.getUsername()) self.ui.nameLabel_2.setText(cur_user.getFirstName()) self.ui.lastnameLabel_2.setText(cur_user.getLastName()) self.ui.dateLabel_2.setText(cur_user.getBirthDate()) self.ui.genderLabel_2.setText(cur_user.getGender()) self.ui.heightLabel_2.setText(str(cur_user.getHeight())) age = int(date.today().strftime("%Y")) - int( cur_user.getBirthDate()[-4:]) if cur_user.getGender() == "Male": bmr = 10 * cur_user.getWeight() + 6.25 * cur_user.getHeight( ) - 5 * age + 5 else: bmr = 10 * cur_user.getWeight() + 6.25 * cur_user.getHeight( ) - 5 * age - 161 cal_need = bmr * 1.375 cal_need = int(cal_need) self.ui.calLabel_2.setText(str(cal_need) + " kcal") print(cal_need) self.recipes = [] recipes_info = RECIPE_MODEL.getRecipeFromCreator( self.user.getUsername()) for i in reversed(range(self.vlayout.count())): self.vlayout.itemAt(i).widget().setParent(None) for i in range(len(recipes_info)): self.recipes.append( RecipeInProfile(recipes_info[i], self.user, self)) self.vlayout.addWidget(self.recipes[i]) self.groupBox.setLayout(self.vlayout) self.ui.recipeScrollArea.setWidget(self.groupBox) self.ui.recipeScrollArea.setStyleSheet( "background-color:rgb(255, 187, 178)\n") self.ui.recipeScrollArea.setWidgetResizable(True) def editProfile(self): self.editPage = ProfileEdit(self.user, self) self.editPage.show()
def create_calendar(self, conf_path, spec): group = QGroupBox(spec["title"]) layout = QVBoxLayout() widget = DateField(self, conf_path) layout.addWidget(widget) group.setLayout(layout) self.layout.addWidget(group)
def create_multiselect(self, conf_path, spec): group = QGroupBox(spec["title"]) layout = QVBoxLayout() widget = MultiSelect(self, conf_path, spec["enum"]) layout.addWidget(widget) group.setLayout(layout) self.layout.addWidget(group)
def grid_layout_creation_2(self) -> None: self.group_box_2 = QGroupBox("Folders") row = -1 d = cfg.PLATFORM_SETTINGS layout = QGridLayout() row += 1 layout.addWidget(QLabel(bold("application folder:")), row, 0) dname = cfg.BASE_DIR layout.addWidget(QLabel(dname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("user data dir.:")), row, 0) dname = d['root_dir'] layout.addWidget(QLabel(dname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("saves dir.:")), row, 0) dname = d['saves_dir'] layout.addWidget(QLabel(dname), row, 1) self.btn_saves = QPushButton("Open") self.btn_saves.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(self.btn_saves, row, 2) row += 1 layout.addWidget(QLabel(bold("wallpapers dir.:")), row, 0) dname = d['wallpapers_dir'] layout.addWidget(QLabel(dname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("tmp dir.:")), row, 0) dname = d['tmp_dir'] layout.addWidget(QLabel(dname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(btn, row, 2) row += 1 layout.addWidget(QLabel(bold("cache dir.:")), row, 0) dname = d['cache_dir'] layout.addWidget(QLabel(dname), row, 1) btn = QPushButton("Open") btn.clicked.connect(partial(opener.open_folder, dname)) layout.addWidget(btn, row, 2) self.group_box_2.setLayout(layout)
def create_string_field(self, conf_path, spec): group = QGroupBox(spec["title"]) layout = QVBoxLayout() widget = (TextAreaField(self, conf_path) if spec.get("sub_type") == "text_area" else StringField(self, conf_path)) layout.addWidget(widget) group.setLayout(layout) self.layout.addWidget(group)
def __init__(self): super().__init__() self.layout = QHBoxLayout() i = 0 self.names = [] self.ebutons = [] self.dbutons = [] folder = './saved' #-------------Loading saved images from ./saved------------ if (len(os.listdir(folder)) == 0): #print oput nothing saved self.label = QLabel("Nothing Saved") self.layout.addWidget(self.label) else: for filename in os.listdir(folder): self.names.append(filename) self.ebutons.append(i) self.dbutons.append(i) lay = QVBoxLayout() gbox = QGroupBox('Result' + str(i + 1)) path = folder + "/" + filename with open(path, 'rb') as thefile: imag = pickle.load(thefile) path += ".jpg" im = Image.open( requests.get(imag['urls']['thumb'], stream=True).raw) im.save(path) self.ebutons[i] = QPushButton("Edit") self.ebutons[i].clicked.connect( lambda state=i, a=i: self.editme(state)) self.dbutons[i] = QPushButton("Delete") self.dbutons[i].clicked.connect( lambda state=i, a=i: self.deleteme(state)) pixmap = QPixmap(path) self.image = QLabel() self.image.setPixmap(pixmap) lay.addWidget(self.image) buts = QHBoxLayout() buts.addWidget(self.ebutons[i]) buts.addWidget(self.dbutons[i]) lay.addLayout(buts) gbox.setLayout(lay) self.layout.addWidget(gbox) try: if os.path.isfile(path) or os.path.islink(path): os.unlink(path) elif os.path.isdir(path): shutil.rmtree(path) except Exception as e: print('Failed to delete %s. Reason: %s' % (file_path, e)) i += 1 print("done") self.setLayout(self.layout)
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, settings=None, **kwargs): super().__init__(parent, **kwargs) self.setObjectName("settings_widget") self.group_box = QGroupBox("Настройки") self.layout = QGridLayout() self.layout.setObjectName('settings_layout') self.layout.setColumnStretch(0, 6) self.layout.setColumnStretch(1, 1) self.group_box.setLayout(self.layout) self.widgets = [] self.change_settings(settings)
def __init__(self): QWidget.__init__(self, None) self.ui = Ui_Form() self.setFixedSize(710, 465) self.ui.setupUi(self) self.ui.piclabel.setPixmap(QPixmap("app/UI/pngegg.png")) self.ui.piclabel.setScaledContents(True) self.widget = QWidget() formlayout = QFormLayout() self.blayout = QHBoxLayout() self.vlayout = QVBoxLayout() self.groupBox = QGroupBox() self.ui.editButton.clicked.connect(self.editProfile)
def _setup_room_widget(self, room: Room): _grp = QGroupBox(title=room.name) _layout = QGridLayout() _row_num = 0 for _light in room.lights: _lc = LightControl(_light) self._light_ctrl.append(_lc) _lbl = QLabel(f" > {_light.name}") _layout.addWidget(_lbl, _row_num, 0) _layout.addWidget(_lc.toggle_btn, _row_num, 1) _layout.addWidget(_lc.show_color_picker_btn, _row_num, 2) _layout.addWidget(_lc.slider, _row_num, 3) _row_num += 1 _grp.setLayout(_layout) return _grp
def createRotableGroupBox(self): self.rotableGroupBox = QGroupBox("Rotable Widgets") self.rotableWidgets.append(QSpinBox()) self.rotableWidgets.append(QSlider()) self.rotableWidgets.append(QDial()) self.rotableWidgets.append(QProgressBar()) count = len(self.rotableWidgets) for i in range(count): self.rotableWidgets[i].valueChanged[int].\ connect(self.rotableWidgets[(i+1) % count].setValue) self.rotableLayout = QGridLayout() self.rotableGroupBox.setLayout(self.rotableLayout) self.rotateWidgets()
def _init_options_group_box(self) -> None: """Creates the group of training options.""" self._options_group_box = QGroupBox("Options") options_layout = QGridLayout() left_options = QGridLayout() right_options = QGridLayout() self._lists['data'] = QListWidget() self._lists['data'].setSelectionMode( QtWidgets.QAbstractItemView.ExtendedSelection) self._lists['target'] = QComboBox() self._lists['f_target'] = QComboBox() self._lists['target'].currentTextChanged.connect( self._refresh_f_target_list) self._refresh_lists() dataset_label = QLabel("Datasets:") targets_label = QLabel("Targets:") f_target_label = QLabel("Target Feature:") left_options.addWidget(dataset_label, 0, 0) left_options.addWidget(self._lists['data'], 1, 0) right_options.addWidget(targets_label, 0, 0) right_options.addWidget(self._lists['target'], 1, 0) right_options.addWidget(f_target_label, 2, 0) right_options.addWidget(self._lists['f_target'], 3, 0) right_options.addLayout(self._init_num_options_group_box(), 4, 0) name_validator = QRegularExpressionValidator(r'^[\w\-. ]+$') name_label = QLabel("Model Name:") self._txt_var['model_name'] = QLineEdit() self._txt_var['model_name'].setValidator(name_validator) right_options.addWidget(name_label, 5, 0) right_options.addWidget(self._txt_var['model_name'], 6, 0) options_layout.addLayout(left_options, 0, 0) options_layout.addLayout(right_options, 0, 1) options_layout.setColumnStretch(0, 1) self._options_group_box.setLayout(options_layout)
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 createOptionsGroupBox(self): self.optionsGroupBox = QGroupBox("Options") buttonsOrientationLabel = QLabel("Orientation of buttons:") buttonsOrientationComboBox = QComboBox() buttonsOrientationComboBox.addItem("Horizontal", Qt.Horizontal) buttonsOrientationComboBox.addItem("Vertical", Qt.Vertical) buttonsOrientationComboBox.currentIndexChanged[int].connect( self.buttonsOrientationChanged) self.buttonsOrientationComboBox = buttonsOrientationComboBox optionsLayout = QGridLayout() optionsLayout.addWidget(buttonsOrientationLabel, 0, 0) optionsLayout.addWidget(self.buttonsOrientationComboBox, 0, 1) optionsLayout.setColumnStretch(2, 1) self.optionsGroupBox.setLayout(optionsLayout)
def create_login_group(self): """Create labels and line edits for providing BGG and ludopedia login information""" (self.bgg_user_line_edit, bgg_user_label) = self.create_qlineedit('Usuario BoardGameGeek:') (self.ludo_mail_line_edit, ludo_mail_label) = self.create_qlineedit('E-mail Ludopedia:') (self.ludo_pass_line_edit, ludo_pass_label) = self.create_qlineedit('Senha Ludopedia:') self.ludo_pass_line_edit.setEchoMode(QLineEdit.PasswordEchoOnEdit) group_box = QGroupBox('Login') grid_layout = QGridLayout(group_box) grid_layout.addWidget(bgg_user_label, 1, 1) grid_layout.addWidget(self.bgg_user_line_edit, 1, 2) grid_layout.addWidget(ludo_mail_label, 2, 1) grid_layout.addWidget(self.ludo_mail_line_edit, 2, 2) grid_layout.addWidget(ludo_pass_label, 3, 1) grid_layout.addWidget(self.ludo_pass_line_edit, 3, 2) group_box.setLayout(grid_layout) return group_box
class TabMain(QWidget): 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 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 set_ui(self): self.hlayout = QHBoxLayout() self.hlayout.addWidget(self.commitment_textbox) self.hlayout.addWidget(self.commit_done_btn) self.commit_group = QGroupBox('Commitment') self.commit_group.setLayout(self.hlayout) self.vlayout = QVBoxLayout() self.vlayout.addWidget(self.commit_group) self.vlayout.addWidget(self.timer_selection) self.vlayout.addWidget(self.timer) self.bottom_hlayout = QHBoxLayout() self.bottom_hlayout.addWidget(self.start_btn) self.bottom_hlayout.addWidget(self.abort_btn) self.bottom_hlayout.addWidget(self.pause_btn) self.bottom_hlayout.addWidget(self.resume_btn) self.vlayout.addLayout(self.bottom_hlayout) self.setLayout(self.vlayout)
class MainWindowUI: def setup_ui(self, win: QMainWindow, settings: Settings) -> None: self.statusbar = CustomStatusBar(win) self.toolbar = AToolBar(win) self.tab = QTabWidget() self.tab_main = TabMain() self.tab_lcr = TabLCR() self.tab_stage_step = TabStageStep() self.tab_stage_cycle = TabStageCycle() self.console = QPlainTextEdit() self.group_measurements_data = QGroupBox("Measurements Data") self.tab.addTab(self.tab_main, "Test") self.tab.addTab(self.tab_lcr, "LCR Meter") self.tab.addTab(self.tab_stage_step, "Stage Controller") self.tab.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.console.setReadOnly(True) self.console.setLineWrapMode(QPlainTextEdit.NoWrap) # self.console.setUndoRedoEnabled(False) # setup settings self.console.setMaximumBlockCount( settings.console.maximum_number_of_line) self.tab_main.spinbox_interval.setValue(settings.main.measure_interval) self.tab_stage_step.int_slider.update_current_value( settings.stage_controller.maximum_speed) self.tab_stage_cycle.int_slider.update_current_value( settings.stage_controller.maximum_speed) # setup layout v_layout = AVBoxLayout() v_layout.addWidget(self.console) self.group_measurements_data.setLayout(v_layout) h_layout = AHBoxLayout() h_layout.addWidget(self.tab) h_layout.addWidget(self.group_measurements_data) central_widget = QWidget() central_widget.setLayout(h_layout) win.setCentralWidget(central_widget)
def _add_widget_for_requirement_array(self, requirement: Requirement): self.grid_layout.setAlignment(Qt.AlignTop) parents: List[Tuple[QGroupBox, QVBoxLayout]] = [(self.parent, self.grid_layout)] for depth, text in randovania.game_description.pretty_print.pretty_print_requirement( requirement): if "of the following" in text: parent = parents[depth] group_box = QGroupBox(parent[0]) group_box.setContentsMargins(8, 0, 2, 6) group_box.setTitle(text) self._elements.append(group_box) vertical_layout = QVBoxLayout(group_box) vertical_layout.setAlignment(Qt.AlignTop) parent[1].addWidget(group_box) if len(parents) <= depth + 1: parents.append(None) parents[depth + 1] = (group_box, vertical_layout) else: label = QLabel(parents[depth][0]) # This is a comment! if text.startswith("# "): text = re.sub(r"(https?://[^\s]+)", r'<a href="\1">\1</a>', text[2:]) label.setStyleSheet("font-weight: bold; color: green") label.setOpenExternalLinks(True) label.setText(text) label.setWordWrap(True) self._elements.append(label) parents[depth][1].addWidget(label)
class TabLCR(QWidget): 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 _create_options_group_box(self) -> QGroupBox: """Returns the group of prediction options.""" options_group_box = QGroupBox("Options") options_layout = QGridLayout() left_options = QGridLayout() right_options = QGridLayout() date_label = QLabel("Target Date:") self._target_date = QCalendarWidget() left_options.addWidget(date_label, 0, 0) left_options.addWidget(self._target_date, 1, 0, 1, 3) left_options.setColumnStretch(0, 1) self._model = QComboBox() self._model_info = QPlainTextEdit() self._model_info.setReadOnly(True) self._model.currentTextChanged.connect(self._refresh_model_info) self._refresh_lists() models_label = QLabel("Models:") info_label = QLabel("Model Information:") right_options.addWidget(models_label, 0, 0) right_options.addWidget(self._model, 1, 0) right_options.addWidget(info_label, 2, 0) right_options.addWidget(self._model_info, 3, 0) options_layout.addLayout(left_options, 0, 0) options_layout.addLayout(right_options, 0, 1) options_group_box.setLayout(options_layout) return options_group_box
def grid_layout_creation_2(self) -> None: self.group_box_2 = QGroupBox("Summary") length = len(self.parent.imgList.get_list_of_images()) layout = QGridLayout() layout.addWidget(QLabel(bold("Marked to be saved:")), 0, 0) num = self.commit.to_save() text = f"{num} (out of {length})" layout.addWidget(QLabel(text), 0, 1) layout.addWidget(QLabel(bold("Marked to be deleted:")), 1, 0) num = self.commit.to_delete() remain = len(self.parent.imgList.get_list_of_images()) - num text = f"{num} (out of {length}) [remain {remain}]" layout.addWidget(QLabel(text), 1, 1) layout.addWidget(QLabel(bold("Marked to save as wallpaper:")), 2, 0) num = self.commit.to_wallpaper() text = f"{num} (out of {length})" layout.addWidget(QLabel(text), 2, 1) self.group_box_2.setLayout(layout)
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)