def __init__(self, parent=None): QWidget.__init__(self, parent) layout = QFormLayout() self.setLayout(layout) self.desktopLabel = QLabel("Record Desktop") self.desktopButton = QRadioButton() layout.addRow(self.desktopLabel, self.desktopButton) # Record Area of Desktop areaGroup = QHBoxLayout() self.areaLabel = QLabel("Record Region") self.areaButton = QRadioButton() self.setAreaButton = QPushButton("Select Region") areaGroup.addWidget(self.areaButton) areaGroup.addWidget(self.setAreaButton) layout.addRow(self.areaLabel, areaGroup) self.regionLabel = QLabel("") self.regionLabel.setStyleSheet( "QLabel { background-color: #ADADAD; border: 1px solid gray }") layout.addRow(QLabel(""), self.regionLabel) # Select screen to record self.screenLabel = QLabel("Screen") self.screenSpinBox = QSpinBox() layout.addRow(self.screenLabel, self.screenSpinBox)
def __init__(self, layerType): super(CADOptionsToolbar_Modify, self).__init__() self.add_btn = QRadioButton( tr(u"Add"), self.optionsToolBar) self.add_btn.setToolTip( tr(u"Add extension")) self.add_btn.setObjectName("add_rbtn") self.modify_btn = QRadioButton( tr(u"Modify"), self.optionsToolBar) self.modify_btn.setToolTip( tr(u"Modify the entity")) self.modify_btn.setObjectName("modify_rbtn") self.extend_btn = QRadioButton( tr(u"Add opposite"), self.optionsToolBar) self.extend_btn.setToolTip( tr(u"Add an extended line")) self.extend_btn.setObjectName("extend_rbtn") self.optionsToolBar.addWidget(self.add_btn) self.optionsToolBar.addWidget(self.modify_btn) self.optionsToolBar.addWidget(self.extend_btn) self.add_btn.setChecked(True) if layerType == QGis.Polygon: self.modify_btn.setChecked(True) self.add_btn.setEnabled(False) self.extend_btn.setEnabled(False) else: self.add_btn.setEnabled(True) self.extend_btn.setEnabled(True)
def __getTermGroupbox(self): " Creates the term groupbox " termGroupbox = QGroupBox(self) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( termGroupbox.sizePolicy().hasHeightForWidth()) termGroupbox.setSizePolicy(sizePolicy) layoutTerm = QVBoxLayout(termGroupbox) self.__redirectRButton = QRadioButton(termGroupbox) self.__redirectRButton.setText("&Redirect to IDE") self.__redirectRButton.toggled.connect(self.__redirectedChanged) layoutTerm.addWidget(self.__redirectRButton) self.__autoRButton = QRadioButton(termGroupbox) self.__autoRButton.setText("Aut&o detection") layoutTerm.addWidget(self.__autoRButton) self.__konsoleRButton = QRadioButton(termGroupbox) self.__konsoleRButton.setText("Default &KDE konsole") layoutTerm.addWidget(self.__konsoleRButton) self.__gnomeRButton = QRadioButton(termGroupbox) self.__gnomeRButton.setText("gnome-&terminal") layoutTerm.addWidget(self.__gnomeRButton) self.__xtermRButton = QRadioButton(termGroupbox) self.__xtermRButton.setText("&xterm") layoutTerm.addWidget(self.__xtermRButton) return termGroupbox
def addToLayout(self, layout): filler = QLabel(self) label = QLabel(self) label.setText("Changes take affect only after restart.") layout.addWidget(label) formLayout = QFormLayout() formLayout.setAlignment(Qt.AlignTop) layout.addLayout(formLayout) self.nmeaButton = QRadioButton("nmea", self) formLayout.addRow(self.nmeaButton, filler) self.nmeaButton.setChecked(self.useNmea) label = QLabel(self) label.setText("GPS Device:") self.deviceText = QLineEdit(self) formLayout.addRow(label, self.deviceText) self.deviceText.setToolTip('NMEA GPS device path.') if self.device != None: self.deviceText.setText(self.device) self.gpsdButton = QRadioButton("gpsd", self) formLayout.addRow(self.gpsdButton, filler) self.gpsdButton.setChecked(self.useGpsd)
def add_reference_buttons(self): self.add_bar() self.showing_ref_box = QCheckBox("Display References") self.showing_ref_box.stateChanged.connect(self.reference_button_fading) self.showing_ref_box.setChecked(True) self.overlay_ref_box = QRadioButton("Overlay", self) self.overlay_ref_box.setChecked(True) self.overlay_refDiff_box = QRadioButton("Data - Ref", self) self.overlay_refRatio_box = QRadioButton("Data/Ref", self) self.grid_layout.addWidget(self.showing_ref_box, self.rowCount(), 0, 1, 2) self.grid_layout.addWidget(self.overlay_ref_box, self.rowCount(), 0, 1, 2) self.grid_layout.addWidget(self.overlay_refDiff_box, self.rowCount(), 0, 1, 2) self.grid_layout.addWidget(self.overlay_refRatio_box, self.rowCount(), 0, 1, 2) # Slots. self.showing_ref_box.clicked.connect(self.state_changed) self.overlay_ref_box.clicked.connect(self.state_changed) self.overlay_refDiff_box.clicked.connect(self.state_changed) self.overlay_refRatio_box.clicked.connect(self.state_changed) self.reference_button_fading()
def __init__(self, parent=None): QWizardPage.__init__(self, parent) self.parent = parent self.setTitle(self.tr("Add dumps")) label = QLabel( self. tr("What do you want to analyse? " "The first step is to choose some dumps for analysis. " "You could load a local file, a dump or choose to mount connected devices" )) label.setWordWrap(True) layout = QGridLayout() layout.addWidget(label, 0, 0) groupBox = QGroupBox(self.tr("Dumps")) self.localFilesRadioButton = QRadioButton(self.tr("Add a local file")) self.deviceRadioButton = QRadioButton(self.tr("Add a device")) self.localFilesRadioButton.setChecked(True) groupBoxLayout = QVBoxLayout() groupBoxLayout.addWidget(self.localFilesRadioButton) groupBoxLayout.addWidget(self.deviceRadioButton) groupBox.setLayout(groupBoxLayout) layout.addWidget(groupBox, 1, 0) self.setLayout(layout)
def __init__(self, parent=None): super(GithubCredentialsWizardPage, self).__init__(parent, title="Credentials", subTitle="Enter your username/password or token") # Radio Buttons self.userPassRadioButton = QRadioButton() self.userPassRadioButton.toggled.connect(self.changeMode) self.userPassRadioButton.toggled.connect(self.completeChanged.emit) self.tokenRadioButton = QRadioButton() self.tokenRadioButton.toggled.connect(self.changeMode) self.tokenRadioButton.toggled.connect(self.completeChanged.emit) # LineEdits # usernameEdit self.usernameEdit = QLineEdit(textChanged=self.completeChanged.emit) # Username may only contain alphanumeric characters or dash # and cannot begin with a dash self.usernameEdit.setValidator( QRegExpValidator(QRegExp('[A-Za-z\d]+[A-Za-z\d-]+'))) # passwordEdit self.passwordEdit = QLineEdit(textChanged=self.completeChanged.emit) self.passwordEdit.setValidator(QRegExpValidator(QRegExp('.+'))) self.passwordEdit.setEchoMode(QLineEdit.Password) # tokenEdit self.tokenEdit = QLineEdit(textChanged=self.completeChanged.emit) # token may only contain alphanumeric characters self.tokenEdit.setValidator(QRegExpValidator(QRegExp('[A-Za-z\d]+'))) self.tokenEdit.setEchoMode(QLineEdit.Password) # Form form = QFormLayout() form.addRow("<b>username/password</b>", self.userPassRadioButton) form.addRow("username: "******"password: "******"<b>token</b>", self.tokenRadioButton) form.addRow("token: ", self.tokenEdit) # Layout self.mainLayout = QVBoxLayout() self.mainLayout.addLayout(form) self.setLayout(self.mainLayout) # Fields self.registerField("username", self.usernameEdit) self.registerField("password", self.passwordEdit) self.registerField("token", self.tokenEdit) self.userPassRadioButton.toggle() self.require_2fa = False
def initUI(self): # local variable that records which radio button is clicked self.choice = 1 # welcome message welcomeMsg = QLabel(self) welcomeMsg.setText("Welcome to the PyQt Interface!") welcomeMsg.setAlignment(Qt.AlignCenter) menu = QLabel(self) menu.setText("Menu") # create buttons & connect them with function btnClicked btn1 = QRadioButton(self) btn1.setText("1. Create montages recursively from given directory and sub-directories") btn1.setChecked(True) btn1.toggled.connect(lambda:self.btnClicked(1)) btn2 = QRadioButton(self) btn2.setText("2. Create montages from provided CSV files (split by categories or bins)") btn2.toggled.connect(lambda:self.btnClicked(2)) btn3 = QRadioButton(self) btn3.setText("3. Create vertical montage from provided CSV file") btn3.toggled.connect(lambda:self.btnClicked(3)) btn4 = QRadioButton(self) btn4.setText("4. Create image histogram from provided CSV file") btn4.toggled.connect(lambda:self.btnClicked(4)) btn5 = QRadioButton(self) btn5.setText("5. Create scatter plot from provided CSV file") btn5.toggled.connect(lambda:self.btnClicked(5)) quit = QPushButton(self) quit.setText("Quit") enter = QPushButton(self) enter.setText("Enter") instr = QPushButton(self) instr.setText("Instruction") self.setStyleSheet('QLabel {font-family: cursive, sans-serif; font-weight: 500; font-size: 16px; color: #A0522D;} QRadioButton {font-family: cursive, sans-serif; font-weight: 300; font-size: 16px; color: #8B4513;} QPushButton {font-family: cursive, sans-serif; font-weight: 500; font-size: 16px; color: #CD853F; }') welcomeMsg.setStyleSheet('QLabel {font-weight: 900;font-size: 20px;}') # set layout mbox = QGridLayout(self) mbox.addWidget(welcomeMsg, 1, 1) mbox.addWidget(menu,2,1) mbox.addWidget(btn1,3,1) mbox.addWidget(btn2,4,1) mbox.addWidget(btn3,5,1) mbox.addWidget(btn4,6,1) mbox.addWidget(btn5,7,1) mbox.addWidget(quit,8,0) mbox.addWidget(enter,8,2) mbox.addWidget(instr,8,1) self.setLayout(mbox) # connect the click event with a function enter.clicked.connect(self.nextPage) quit.clicked.connect(self.close) instr.clicked.connect(self.instruction) # set background as transparent palette = QPalette() palette.setBrush(QPalette.Background,QBrush(QPixmap())) self.setPalette(palette)
def __init__(self): """ Constructor """ QDialog.__init__(self) self.setWindowTitle( QCoreApplication.translate("VDLTools", "Edition Confirmation")) self.resize(300, 100) self.__layout = QGridLayout() self.__confirmLabel = QLabel( QCoreApplication.translate( "VDLTools", "This LineString layer is not editable, what do you want to do ?" )) self.__layout.addWidget(self.__confirmLabel, 0, 0, 1, 2) self.__radios = [] self.__radios.append( QRadioButton( QCoreApplication.translate( "VDLTools", "Create point, and edit line with new vertex"))) self.__radios.append( QRadioButton( QCoreApplication.translate("VDLTools", "Create only the point"))) self.__radios.append( QRadioButton( QCoreApplication.translate("VDLTools", "Just edit line with new vertex"))) self.__radios[0].setChecked(True) self.__radio_button_group = QButtonGroup() for i in xrange(len(self.__radios)): self.__layout.addWidget(self.__radios[i], i + 1, 0, 1, 2) self.__radio_button_group.addButton(self.__radios[i], i) self.__okButton = QPushButton( QCoreApplication.translate("VDLTools", "OK")) self.__okButton.setMinimumHeight(20) self.__okButton.setMinimumWidth(100) self.__layout.addWidget(self.__okButton, 4, 0) self.__cancelButton = QPushButton( QCoreApplication.translate("VDLTools", "Cancel")) self.__cancelButton.setMinimumHeight(20) self.__cancelButton.setMinimumWidth(100) self.__layout.addWidget(self.__cancelButton, 4, 1) self.setLayout(self.__layout)
def __init__(self, isComplexPolygon): """ Constructor :param isComplexPolygon: for a polygon, if it has interior ring(s) """ QDialog.__init__(self) self.setWindowTitle(QCoreApplication.translate("VDLTools","Duplicate")) self.resize(300, 100) self.__distanceLabel = QLabel(QCoreApplication.translate("VDLTools","distance :")) self.__distanceLabel.setMinimumHeight(20) self.__distanceLabel.setMinimumWidth(50) self.__distanceEdit = QLineEdit("inputMask") self.__distanceEdit.setMinimumHeight(20) self.__distanceEdit.setMinimumWidth(120) self.__distanceEdit.setValidator(QDoubleValidator(-1000, 1000, 4, self)) self.__distanceDirection = QCheckBox(QCoreApplication.translate("VDLTools","invert direction")) self.__previewButton = QPushButton(QCoreApplication.translate("VDLTools","Preview")) self.__previewButton.setMinimumHeight(20) self.__previewButton.setMinimumWidth(100) self.__okButton = QPushButton(QCoreApplication.translate("VDLTools","OK")) self.__okButton.setMinimumHeight(20) self.__okButton.setMinimumWidth(100) self.__cancelButton = QPushButton(QCoreApplication.translate("VDLTools","Cancel")) self.__cancelButton.setMinimumHeight(20) self.__cancelButton.setMinimumWidth(100) self.__layout = QGridLayout() self.__layout.addWidget(self.__distanceLabel, 0, 0) self.__layout.addWidget(self.__distanceEdit, 0, 1) self.__layout.addWidget(self.__distanceDirection, 0, 2) if isComplexPolygon: self.__polygonLabel = QLabel( QCoreApplication.translate("VDLTools","In which direction the internal part has to be duplicated ?")) self.__polygonLabel.setMinimumHeight(20) self.__polygonLabel.setMinimumWidth(50) self.__layout.addWidget(self.__polygonLabel, 1, 0, 1, 3) self.__directions = [QRadioButton(QCoreApplication.translate("VDLTools","same")), QRadioButton(QCoreApplication.translate("VDLTools","opposite"))] self.__directions[0].setChecked(True) self.__direction_button_group = QButtonGroup() for i in xrange(len(self.__directions)): self.__layout.addWidget(self.__directions[i], 2, i+1) self.__direction_button_group.addButton(self.__directions[i], i) self.__layout.addWidget(self.__previewButton, 3, 0) self.__layout.addWidget(self.__okButton, 3, 1) self.__layout.addWidget(self.__cancelButton, 3, 2) self.setLayout(self.__layout)
def addFilterBox(self, layout): hbox = QHBoxLayout() layout.addLayout(hbox) # hbox.setAlignment(Qt.AlignLeft|Qt.AlignVCenter) self.filterButton=QCheckBox("Filter", self.canMonitor) self.filterButton.setToolTip('Enable filter') self.filterButton.resize(self.filterButton.sizeHint()) self.filterButton.clicked.connect(self._enableFilter) hbox.addWidget(self.filterButton) self.filterEdit=QLineEdit(self.canMonitor) self.filterEdit.setToolTip('Id Filter') self.filterEdit.setDisabled(self.filter==False) self.filterEdit.returnPressed.connect(self._applyFilter) hbox.addWidget(self.filterEdit) self.applyFilterButton = QPushButton('Apply', self.canMonitor) self.applyFilterButton.setToolTip('Use Id filter') self.applyFilterButton.resize(self.applyFilterButton.sizeHint()) self.applyFilterButton.clicked.connect(self._applyFilter) self.applyFilterButton.setDisabled(self.filter==False) hbox.addWidget(self.applyFilterButton) self.filterKnown=QRadioButton("Known", self.canMonitor) self.filterKnown.clicked.connect(self._applyFilter) self.filterKnown.setDisabled(self.filter==False) hbox.addWidget(self.filterKnown) self.filterUnknown=QRadioButton("Unknown", self.canMonitor) self.filterUnknown.clicked.connect(self._applyFilter) self.filterUnknown.setDisabled(self.filter==False) hbox.addWidget(self.filterUnknown) self.filterAll=QRadioButton("All", self.canMonitor) self.filterAll.clicked.connect(self._applyFilter) self.filterAll.setDisabled(self.filter==False) self.filterAll.setChecked(True) hbox.addWidget(self.filterAll) self.filterRingIdsButton=QCheckBox("Ring Ids", self.canMonitor) self.filterRingIdsButton.resize(self.filterRingIdsButton.sizeHint()) self.filterRingIdsButton.clicked.connect(self._enableFilterRingIds) self.filterRingIdsButton.setDisabled(self.filter==False) self.filterRingIdsButton.setChecked(self.filterRingIds) hbox.addWidget(self.filterRingIdsButton) if self.withChanged==True: self.filterChangedButton=QCheckBox("Changed", self.canMonitor) self.filterChangedButton.resize(self.filterChangedButton.sizeHint()) self.filterChangedButton.clicked.connect(self._enableFilterChanged) self.filterChangedButton.setDisabled(self.filter==False) self.filterChangedButton.setChecked(self.filterChanged) hbox.addWidget(self.filterChangedButton)
def __init__(self): super(ButtonWidget, self).__init__() # buttons for adding robots and ball self.yellow_btn = QRadioButton('Yellow Team') self.blue_btn = QRadioButton('Blue Team') self.ball_btn = QRadioButton('Ball') self.addButton(self.yellow_btn) self.addButton(self.blue_btn) self.addButton(self.ball_btn) self.setExclusive(True)
def __init__(self, page): super(Target, self).__init__(page) layout = QGridLayout() self.setLayout(layout) self.targetPDF = QRadioButton(toggled=page.changed) self.targetSVG = QRadioButton(toggled=page.changed) self.openDefaultView = QCheckBox(clicked=page.changed) layout.addWidget(self.targetPDF, 0, 0) layout.addWidget(self.targetSVG, 0, 1) layout.addWidget(self.openDefaultView, 1, 0, 1, 5) app.translateUI(self)
def __init__(self, source_stage_index, num_stages, *args, **kwargs): super(LabelDistributionOptionsDlg, self).__init__(*args, **kwargs) from PyQt4.QtCore import Qt from PyQt4.QtGui import QGroupBox, QCheckBox, QRadioButton, QDialogButtonBox self.setWindowTitle( "Distributing from Stage {}".format(source_stage_index + 1)) self.stage_checkboxes = [] for stage_index in range(1, num_stages + 1): self.stage_checkboxes.append( QCheckBox("Stage {}".format(stage_index))) # By default, send labels back into the current stage, at least. self.stage_checkboxes[source_stage_index].setChecked(True) stage_selection_layout = QVBoxLayout() for checkbox in self.stage_checkboxes: stage_selection_layout.addWidget(checkbox) stage_selection_groupbox = QGroupBox( "Send labels from Stage {} to:".format(source_stage_index + 1), self) stage_selection_groupbox.setLayout(stage_selection_layout) self.copy_button = QRadioButton("Copy", self) self.partition_button = QRadioButton("Partition", self) self.partition_button.setChecked(True) distribution_mode_layout = QVBoxLayout() distribution_mode_layout.addWidget(self.copy_button) distribution_mode_layout.addWidget(self.partition_button) distribution_mode_group = QGroupBox("Distribution Mode", self) distribution_mode_group.setLayout(distribution_mode_layout) buttonbox = QDialogButtonBox(Qt.Horizontal, parent=self) buttonbox.setStandardButtons(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) buttonbox.accepted.connect(self.accept) buttonbox.rejected.connect(self.reject) dlg_layout = QVBoxLayout() dlg_layout.addWidget(stage_selection_groupbox) dlg_layout.addWidget(distribution_mode_group) dlg_layout.addWidget(buttonbox) self.setLayout(dlg_layout)
def createWidgets(self, layout): self.bookOutputInfo = QLabel(wordWrap=True) self.bookOutputLabel = QLabel() self.bookOutput = widgets.lineedit.LineEdit() self.bookOutputFileName = QRadioButton() self.bookOutputSuffix = QRadioButton(checked=True) layout.addWidget(self.bookOutputInfo) grid = QGridLayout(spacing=0) grid.addWidget(self.bookOutputLabel, 0, 0) grid.addWidget(self.bookOutput, 0, 1, 1, 2) grid.addWidget(self.bookOutputFileName, 1, 1) grid.addWidget(self.bookOutputSuffix, 1, 2) layout.addLayout(grid)
def createExtractionTab(self): extractDeckLabel = QLabel('Extracts Deck') self.extractDeckComboBox = QComboBox() deckNames = sorted([d['name'] for d in mw.col.decks.all()]) self.extractDeckComboBox.addItem('[Current Deck]') self.extractDeckComboBox.addItems(deckNames) if self.settings['extractDeck']: setComboBoxItem(self.extractDeckComboBox, self.settings['extractDeck']) else: setComboBoxItem(self.extractDeckComboBox, '[Current Deck]') extractDeckLayout = QHBoxLayout() extractDeckLayout.addWidget(extractDeckLabel) extractDeckLayout.addWidget(self.extractDeckComboBox) self.editExtractButton = QRadioButton('Edit Extracted Note') enterTitleButton = QRadioButton('Enter Title Only') if self.settings['editExtract']: self.editExtractButton.setChecked(True) else: enterTitleButton.setChecked(True) radioButtonsLayout = QHBoxLayout() radioButtonsLayout.addWidget(self.editExtractButton) radioButtonsLayout.addWidget(enterTitleButton) radioButtonsLayout.addStretch() self.editSourceCheckBox = QCheckBox('Edit Source Note') self.plainTextCheckBox = QCheckBox('Extract as Plain Text') if self.settings['editSource']: self.editSourceCheckBox.setChecked(True) if self.settings['plainText']: self.plainTextCheckBox.setChecked(True) layout = QVBoxLayout() layout.addLayout(extractDeckLayout) layout.addLayout(radioButtonsLayout) layout.addWidget(self.editSourceCheckBox) layout.addWidget(self.plainTextCheckBox) layout.addStretch() tab = QWidget() tab.setLayout(layout) return tab
def create_radiobutton(self, text, option, default=NoDefault, tip=None, msg_warning=None, msg_info=None, msg_if_enabled=False, button_group=None): radiobutton = QRadioButton(text) if button_group is None: if self.default_button_group is None: self.default_button_group = QButtonGroup(self) button_group = self.default_button_group button_group.addButton(radiobutton) if tip is not None: radiobutton.setToolTip(tip) self.radiobuttons[radiobutton] = option if msg_warning is not None or msg_info is not None: def show_message(is_checked): if is_checked or not msg_if_enabled: if msg_warning is not None: QMessageBox.warning(self, self.get_name(), msg_warning, QMessageBox.Ok) if msg_info is not None: QMessageBox.information(self, self.get_name(), msg_info, QMessageBox.Ok) self.connect(radiobutton, SIGNAL("toggled(bool)"), show_message) return radiobutton
def _initialize(self): ## self.paramTPerm = self.field("paramTPerm") self.tabs.clear() self.total_answers = 0 self.radioGroups = {} filas = int(self.paramNPerm.toString()) for x in range(filas): mygroupbox = QScrollArea() mygroupbox.setWidget(QWidget()) mygroupbox.setWidgetResizable(True) myform = QHBoxLayout(mygroupbox.widget()) cols = self.paramNCols.toString().split(',') ansID = 0 radioGroupList = {} for col in cols: mygroupboxCol = QGroupBox() myformCol = QFormLayout() mygroupboxCol.setLayout(myformCol) for y in range(int(col)): ansID += 1 radioGroupList[ansID] = QButtonGroup() layoutRow = QHBoxLayout() for j in range(int(self.paramNAlts.toString())): myradio = QRadioButton(chr(97 + j).upper()) layoutRow.addWidget(myradio) radioGroupList[ansID].addButton(myradio) self.total_answers += 1 myformCol.addRow(str(ansID), layoutRow) myform.addWidget(mygroupboxCol) self.radioGroups[chr(97 + x).upper()] = radioGroupList self.tabs.addTab(mygroupbox, _('Model ') + chr(97 + x).upper())
def addLogOrLogTypeOption(self): self.logsInWellRadioButton = QRadioButton() if self._logSet is None: self.logsInWellRadioButton.setText(self.SHOW_LOGS_IN_WELL) else: self.logsInWellRadioButton.setText(self.SHOW_LOGS_IN_LOG_SET) self.allLogTypesRadioButton = QRadioButton() self.allLogTypesRadioButton.setText(self.SHOW_ALL_LOG_TYPES) topButtonLayout = QHBoxLayout() self._dataListToListWidget.topButtonHolderWidget.setLayout(topButtonLayout) topButtonLayout.addWidget(self.logsInWellRadioButton) topButtonLayout.addWidget(self.allLogTypesRadioButton) topButtonGroup = QButtonGroup() topButtonGroup.addButton(self.logsInWellRadioButton) topButtonGroup.addButton(self.allLogTypesRadioButton) self.logsInWellRadioButton.setChecked(True)
def radio_button(text="", checked=False, group=None, group_id=None): button = QRadioButton(text, checked=checked) if group is not None: group.addButton(button, ) if group_id is not None: group.setId(button, group_id) return button
def __init__(self, parent=None): super(PreferencesView, self).__init__(parent) self.setWindowTitle("Preferences") # self.setFixedSize(self.maximumSize()) # self.setMinimumSize(self.maximumSize()) # self.setMaximumSize(self.maximumSize()) # self.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)) self.chemicalSimulationDt = self.createFloatingPointEditor() self.chemicalDiffusionDt = self.createFloatingPointEditor() self.chemicalPlotUpdateInterval = self.createFloatingPointEditor() self.chemicalDefaultSimulationRuntime = self.createFloatingPointEditor( ) self.chemicalGuiUpdateInterval = self.createFloatingPointEditor() self.chemicalSolver = QButtonGroup() self.chemicalSolvers = { "Exponential Euler": QRadioButton("Exponential Euler"), "Gillespie": QRadioButton("Gillespie"), "Runge Kutta": QRadioButton("Runge Kutta") } self.chemicalSimulationApply = QPushButton("Apply") self.chemicalSimulationCancel = QPushButton("Cancel") self.electricalSimulationDt = self.createFloatingPointEditor() self.electricalPlotUpdateInterval = self.createFloatingPointEditor() self.electricalDefaultSimulationRuntime = self.createFloatingPointEditor( ) self.electricalGuiUpdateInterval = self.createFloatingPointEditor() self.electricalSolver = QButtonGroup() self.electricalSolvers = { "Gillespie": QRadioButton("Gillespie"), "Runge Kutta": QRadioButton("Runge Kutta") } self.electricalSimulationApply = QPushButton("Apply") self.electricalSimulationCancel = QPushButton("Cancel") self.electricalVisualizationApply = QPushButton("Apply") self.electricalVisualizationCancel = QPushButton("Cancel") self.electricalBaseColorButton = QPushButton() self.electricalBaseColorDialog = QColorDialog() self.electricalPeakColorButton = QPushButton() self.electricalPeakColorDialog = QColorDialog() self.electricalBackgroundColorButton = QPushButton() self.electricalBackgroundColorDialog = QColorDialog() self.electricalBaseMembraneVoltage = self.createFloatingPointEditor() self.electricalPeakMembraneVoltage = self.createFloatingPointEditor() self.create()
def initUI(self): # QToolTip.setFont(QFont('SansSerif', 10)) # self.setToolTip('This is a <b>QMainWindow</b> widget') # create buttons for selection of labels self.label_rbtns = [QRadioButton(unicode(label)) for label in self.labels.split()] # create widgets for showing images self.imshow = [ImShow(self.tb_name) for x in range(self.pagesize)] self.lcl_proc = QLabel("Proc: %d/%d" % (1, self.npages)) self.btn_save_pos = QPushButton("Pos && Next(Q)") self.btn_save_neg = QPushButton("Neg && Next(W)") self.btn_prev = QPushButton("Prev(E)") self.btn_next = QPushButton("Next(R)") # Layouts layout_labels = QGridLayout() layout_images = QGridLayout() layout_control = QHBoxLayout() layout_overall = QVBoxLayout() # setup labels selection buttons for i in range(len(self.label_rbtns)): chklcl = self.label_rbtns[i] layout_labels.addWidget(chklcl, i / self.nlabels, i % self.nlabels) # setup widgets for showing images for i in range(self.pagesize): layout_images.addWidget(self.imshow[i], i / self.cols, i % self.cols) # setup control buttons layout_control.addWidget(self.lcl_proc) layout_control.addWidget(self.btn_save_pos) layout_control.addWidget(self.btn_save_neg) layout_control.addWidget(self.btn_prev) layout_control.addWidget(self.btn_next) # setup layout layout_overall.addLayout(layout_labels) layout_overall.addLayout(layout_images) layout_overall.addLayout(layout_control) # setup mainwindow centralWidget = QWidget() centralWidget.setLayout(layout_overall) self.setCentralWidget(centralWidget) self.setWindowTitle("Label") # signals and slots self.btn_save_pos.clicked.connect(self.on_save_pos) self.btn_save_neg.clicked.connect(self.on_save_neg) self.btn_prev.clicked.connect(self.on_prev) self.btn_next.clicked.connect(self.on_next) for btn in self.label_rbtns: btn.clicked.connect(self.on_check)
def __init__(self): QWidget.__init__(self) vbox = QVBoxLayout(self) #Top Bar hbox = QHBoxLayout() self.radioDefault = QRadioButton("Default Skin") self.radioCustom = QRadioButton("Custom") self.comboSkins = QComboBox() self.skins = loader.load_gui_skins() for item in self.skins: self.comboSkins.addItem(item) hbox.addWidget(self.radioDefault) hbox.addWidget(self.radioCustom) hbox.addWidget(self.comboSkins) #Text Area self.txtStyle = QPlainTextEdit() self.txtStyle.setReadOnly(True) #Settings settings = QSettings() settings.beginGroup('preferences') settings.beginGroup('skins') if settings.value('default', True).toBool(): self.radioDefault.setChecked(True) self.comboSkins.setEnabled(False) else: self.radioCustom.setChecked(True) index = self.comboSkins.findText( settings.value('selectedSkin', '').toString()) self.comboSkins.setCurrentIndex(index) content = self.skins[str(self.comboSkins.currentText())] self.txtStyle.setPlainText(content) settings.endGroup() settings.endGroup() vbox.addLayout(hbox) vbox.addWidget(self.txtStyle) vbox.addWidget(QLabel('Requires restart the IDE')) #Signals self.connect(self.radioDefault, SIGNAL("clicked()"), self._default_clicked) self.connect(self.radioCustom, SIGNAL("clicked()"), self._custom_clicked)
def __init__(self, layerType): super(CADOptionsToolbar_ModifyOffset, self).__init__() self.segmentChoice = QRadioButton( tr(u"Segment")) self.segmentChoice.setChecked(Qt.Checked) self.featureChoice = QRadioButton( tr(u"Feature")) self.optionsToolBar.addWidget(self.segmentChoice) self.optionsToolBar.addWidget(self.featureChoice) if layerType == QGis.Polygon: self.segmentChoice.setChecked(Qt.Unchecked) self.featureChoice.setChecked(Qt.Checked) self.segmentChoice.setEnabled(False) self.featureChoice.setEnabled(False) elif layerType == QGis.Line: self.segmentChoice.setEnabled(True) self.featureChoice.setEnabled(True)
def __init__(self, result): QDialog.__init__(self) self.layout = QVBoxLayout(self) self.result = result observation_window = result.observation_window group = QButtonGroup(self) use_simu_duration = QRadioButton("Use entire simulation.") use_simu_duration.setChecked( observation_window[0] == 0 and observation_window[1] == result.model.duration) group.addButton(use_simu_duration) self.layout.addWidget(use_simu_duration) use_custom = QRadioButton("Use a custom observation window:") use_custom.setChecked(not use_simu_duration.isChecked()) group.addButton(use_custom) self.layout.addWidget(use_custom) self._slider = QxtSpanSliderWidget( 0, result.model.now() // result.model.cycles_per_ms, self) self._slider.setSpan( observation_window[0] // result.model.cycles_per_ms, observation_window[1] // result.model.cycles_per_ms) self._slider.setEnabled(use_custom.isChecked()) group.buttonClicked.connect( lambda x: self._slider.setEnabled(x == use_custom)) self.layout.addWidget(self._slider) buttons = QWidget(self) buttons_layout = QHBoxLayout() buttons.setLayout(buttons_layout) buttons_layout.addStretch() ok_button = QPushButton("Ok") cancel_button = QPushButton("Cancel") ok_button.clicked.connect(self.accept) cancel_button.clicked.connect(self.reject) buttons_layout.addWidget(ok_button) buttons_layout.addWidget(cancel_button) self.layout.addWidget(buttons)
def setup_output_tb(self): outputWidget = QWidget() outputLayout = QGridLayout() outputLayout.addWidget(QLabel("Format: "), 0, 0, 1, 1) self.save_as_grass_QRadioButton = QRadioButton("Grass") self.save_as_grass_QRadioButton.setChecked(True) outputLayout.addWidget(self.save_as_grass_QRadioButton, 0, 1, 1, 1) self.save_as_vtk_QRadioButton = QRadioButton("VTK") outputLayout.addWidget(self.save_as_vtk_QRadioButton, 0, 2, 1, 1) self.save_as_gas_QRadioButton = QRadioButton("Gas (json)") outputLayout.addWidget(self.save_as_gas_QRadioButton, 0, 3, 1, 1) self.save_as_xyz_QRadioButton = QRadioButton("xyz") outputLayout.addWidget(self.save_as_xyz_QRadioButton, 1, 1, 1, 2) self.save_as_esri_generate_QRadioButton = QRadioButton( "3D ESRI generate") outputLayout.addWidget(self.save_as_esri_generate_QRadioButton, 1, 3, 1, 2) simulation_output_browse_QPushButton = QPushButton("Save as ...") simulation_output_browse_QPushButton.clicked.connect( self.select_output_file) outputLayout.addWidget(simulation_output_browse_QPushButton, 2, 0, 1, 1) self.output_filename_QLineEdit = QLineEdit() outputLayout.addWidget(self.output_filename_QLineEdit, 2, 1, 1, 4) self.save_surface_pButton = QPushButton("Save surface") self.save_surface_pButton.clicked[bool].connect(self.save_surface) self.save_surface_pButton.setEnabled(True) outputLayout.addWidget(self.save_surface_pButton, 3, 0, 1, 5) outputWidget.setLayout(outputLayout) return outputWidget
def __init__(self, parent=None, option_list=None, default_select=0): super(InputRadioGroup, self).__init__(parent=parent) layout = QHBoxLayout(self) self.group = QButtonGroup() for idx, op in enumerate(option_list): self.op = QRadioButton(_(op)) if idx == default_select: self.op.setChecked(True) layout.addWidget(self.op) self.group.addButton(self.op) self.setLayout(layout)
def _create_radiobutton(self, key, value): atomic_widget = QWidget() layout = QBoxLayout(self.horizontal) for i, rbkey in enumerate(self.radiobuttons[key][0]): b1 = QRadioButton("Button1") if i == self.radiobuttons[key][1]: b1.setChecked(True) # b1.toggled.connect(lambda:self.btnstate(self.b1)) layout.addWidget(b1) atomic_widget.setLayout(layout) return atomic_widget
def __init__(self, parent=None): QDialog.__init__(self, parent) self.resize(290, 136) self.setWindowTitle("Insert Leg") sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(sizePolicy) verticalLayoutDlg = QVBoxLayout(self) verticalLayoutDlg.setObjectName(("verticalLayoutDlg")) self.groupBox = GroupBox(self) verticalLayoutDlg.addWidget(self.groupBox) self.optBefore = QRadioButton(self.groupBox) self.optBefore.setObjectName("optBefore") self.optBefore.setText("Insert Before") self.groupBox.Add = self.optBefore self.optAfter = QRadioButton(self.groupBox) self.optAfter.setObjectName("optAfter") self.optAfter.setText("Insert After") self.groupBox.Add = self.optAfter self.optAppend = QRadioButton(self.groupBox) self.optAppend.setObjectName("optAppend") self.optAppend.setText("Append") self.groupBox.Add = self.optAppend self.btnBoxOkCancel = QDialogButtonBox(self) self.btnBoxOkCancel.setObjectName(("btnBoxOkCancel")) self.btnBoxOkCancel.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) # btnOK = self.btnBoxOkCancel.button(QDialogButtonBox.Ok) # btnOK.setText("Create") self.connect(self.btnBoxOkCancel, SIGNAL("accepted()"), self.acceptDlg) self.connect(self.btnBoxOkCancel, SIGNAL("rejected()"), self.reject) verticalLayoutDlg.addWidget(self.btnBoxOkCancel)
def makeSortButton(name, sortFunction): bname = "%sSortButton" % name button = QRadioButton(self.sortBox) setattr(self, bname, button) def buttonClicked(): self.__sortOrder = name self.model.setSortOrder(sortFunction) self.connect(button, SIGNAL("clicked()"), buttonClicked) self.sortLayout.addWidget(button) button.setText("By %s" % name.capitalize())