Python PyQt5.QtWidgets.QRadioButton() Examples

The following are 30 code examples of PyQt5.QtWidgets.QRadioButton(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .
Example #1
Source File: Dialogs.py    From PyRAT with Mozilla Public License 2.0 6 votes vote down vote up
def __init__(self, parent=None):
        super(LayerWidget, self).__init__(parent)

        layout = QtWidgets.QVBoxLayout(self)
        self.treewidget = LayerTreeWidget(parent=self, viewer=parent)
        layout.addWidget(self.treewidget)
        foo = QtWidgets.QHBoxLayout()
        self.button_bw = QtWidgets.QRadioButton("B/W mode      ")
        self.button_co = QtWidgets.QRadioButton("RGB mode      ")
        self.button_bw.setChecked(True)
        foo.addWidget(self.button_bw)
        foo.addWidget(self.button_co)
        layout.addLayout(foo)
        self.button_bw.clicked.connect(self.bwmode)
        self.button_co.clicked.connect(self.rgbmode)
        self.viewer = parent 
Example #2
Source File: FilterBandwidthDialog.py    From urh with GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.ui = Ui_DialogFilterBandwidth()
        self.ui.setupUi(self)
        self.setWindowFlags(Qt.Window)

        bw_type = settings.read("bandpass_filter_bw_type", "Medium", str)
        custom_bw = settings.read("bandpass_filter_custom_bw", 0.1, float)

        for item in dir(self.ui):
            item = getattr(self.ui, item)
            if isinstance(item, QLabel):
                name = item.objectName().replace("label", "")
                key = next((key for key in Filter.BANDWIDTHS.keys() if name.startswith(key.replace(" ", ""))), None)
                if key is not None and name.endswith("Bandwidth"):
                    item.setText("{0:n}".format(Filter.BANDWIDTHS[key]))
                elif key is not None and name.endswith("KernelLength"):
                    item.setText(str(Filter.get_filter_length_from_bandwidth(Filter.BANDWIDTHS[key])))
            elif isinstance(item, QRadioButton):
                item.setChecked(bw_type.replace(" ", "_") == item.objectName().replace("radioButton", ""))

        self.ui.doubleSpinBoxCustomBandwidth.setValue(custom_bw)
        self.ui.spinBoxCustomKernelLength.setValue(Filter.get_filter_length_from_bandwidth(custom_bw))

        self.create_connects() 
Example #3
Source File: channelSelector.py    From openMotor with GNU General Public License v3.0 6 votes vote down vote up
def setupChecks(self, multiselect, disabled=[], default=None, exclude=[]):
        # This simres is only used to get the list of channels available
        simres = motorlib.simResult.SimulationResult(motorlib.motor.Motor())
        for channel in simres.channels:
            if channel not in exclude:
                if multiselect:
                    check = QCheckBox(simres.channels[channel].name)
                else:
                    check = QRadioButton(simres.channels[channel].name)
                self.layout().addWidget(check)
                self.checks[channel] = check
                if default is not None:
                    if multiselect:
                        if channel in default:
                            self.checks[channel].setCheckState(2)
                    else:
                        self.checks[channel].setChecked(channel == default)
                self.checks[channel].toggled.connect(self.checksChanged.emit)
                if channel in disabled:
                    check.setEnabled(False) 
Example #4
Source File: generator.py    From awesometts-anki-addon with GNU General Public License v3.0 6 votes vote down vote up
def _on_behavior_changed(self):
        """
        Display a warning about bare filenames if user selects the
        override option and disables wrapping the field with a [sound]
        tag.
        """

        if self.isVisible():
            append = self.findChild(QtWidgets.QRadioButton, 'append')
            behavior = self.findChild(Checkbox, 'behavior')

            if not (append.isChecked() or behavior.isChecked()):
                self._alerts(
                    'Please note that if you use bare filenames, the "Check '
                    'Media" feature in Anki will not detect those audio '
                    "files as in-use, even if you insert the field into your "
                    "templates.",
                    self,
                ) 
Example #5
Source File: add_clip_ui.py    From superboucle with GNU General Public License v3.0 6 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(398, 170)
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
        self.buttonBox.setGeometry(QtCore.QRect(30, 130, 341, 32))
        self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.emptyButton = QtWidgets.QRadioButton(Dialog)
        self.emptyButton.setGeometry(QtCore.QRect(40, 100, 99, 21))
        self.emptyButton.setObjectName("emptyButton")
        self.newButton = QtWidgets.QRadioButton(Dialog)
        self.newButton.setGeometry(QtCore.QRect(40, 20, 141, 21))
        self.newButton.setObjectName("newButton")
        self.useButton = QtWidgets.QRadioButton(Dialog)
        self.useButton.setGeometry(QtCore.QRect(40, 60, 70, 21))
        self.useButton.setObjectName("useButton")
        self.fileList = QtWidgets.QComboBox(Dialog)
        self.fileList.setGeometry(QtCore.QRect(130, 60, 171, 23))
        self.fileList.setObjectName("fileList")

        self.retranslateUi(Dialog)
        self.buttonBox.accepted.connect(Dialog.accept)
        self.buttonBox.rejected.connect(Dialog.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #6
Source File: centerline.py    From spinalcordtoolbox with MIT License 6 votes vote down vote up
def _init_controls(self, parent):
        group = QtWidgets.QGroupBox()
        group.setFlat(True)
        layout = QtWidgets.QHBoxLayout()

        custom_mode = QtWidgets.QRadioButton('Mode Custom')
        custom_mode.setToolTip('Manually select the axis slice on sagittal plane')
        custom_mode.toggled.connect(self.on_toggle_mode)
        custom_mode.mode = 'CUSTOM'
        custom_mode.sagittal_title = 'Select an axial slice.\n{}'.format(self.params.subtitle)
        custom_mode.axial_title = 'Select the center of the spinal cord'
        layout.addWidget(custom_mode)

        auto_mode = QtWidgets.QRadioButton('Mode Auto')
        auto_mode.setToolTip('Automatically move down the axis slice on the sagittal plane')
        auto_mode.toggled.connect(self.on_toggle_mode)
        auto_mode.mode = 'AUTO'
        auto_mode.sagittal_title = 'The axial slice is automatically selected\n{}'.format(self.params.subtitle)
        auto_mode.axial_title = 'Click in the center of the spinal cord'
        layout.addWidget(auto_mode)

        group.setLayout(layout)
        parent.addWidget(group)
        auto_mode.click() 
Example #7
Source File: design.py    From picasso with MIT License 5 votes vote down vote up
def __init__(self, parent=None):
        super(PlateDialog, self).__init__(parent)
        layout = QtWidgets.QVBoxLayout(self)
        self.info = QtWidgets.QLabel("Please make selection:  ")
        self.radio1 = QtWidgets.QRadioButton(
            (
                "Export only the sequences needed for this design."
                " (176 staples in 2 plates)"
            )
        )
        self.radio2 = QtWidgets.QRadioButton(
            (
                "Export full 2 full plates for all sequences used"
                " (176 staples * number of unique sequences)"
            )
        )

        self.setWindowTitle("Plate export")
        layout.addWidget(self.info)
        layout.addWidget(self.radio1)
        layout.addWidget(self.radio2)

        self.buttons = QtWidgets.QDialogButtonBox(
            QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel, QtCore.Qt.Horizontal, self
        )

        layout.addWidget(self.buttons)

        self.buttons.accepted.connect(self.accept)
        self.buttons.rejected.connect(self.reject) 
Example #8
Source File: generator.py    From awesometts-anki-addon with GNU General Public License v3.0 5 votes vote down vote up
def _get_field_values(self):
        """
        Returns the user's source and destination fields, append state,
        and handling mode.
        """

        return (
            self.findChild(QtWidgets.QComboBox, 'source').currentText(),
            self.findChild(QtWidgets.QComboBox, 'dest').currentText(),
            self.findChild(QtWidgets.QRadioButton, 'append').isChecked(),
            self.findChild(Checkbox, 'behavior').isChecked(),
        ) 
Example #9
Source File: DyStockSelectSaveAsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, strategyName):
        self.setWindowTitle('[{0}]另存为'.format(strategyName))
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #10
Source File: RadarInterface.py    From pycwr with MIT License 5 votes vote down vote up
def find_level_in_groupBox(self):
        """查找仰角"""
        level = self.find_checked_radiobutton(self.groupBox.findChildren(QtWidgets.QRadioButton))
        levels = ["第1层", "第2层", "第3层",
                  "第4层", "第5层", "第6层",
                  "第7层", "第8层", "第9层"]
        for i in range(9):
            if level == levels[i]:
                return i
        return 0 
Example #11
Source File: RadarInterface.py    From pycwr with MIT License 5 votes vote down vote up
def find_var_in_groupBox(self):
        """查找变量"""
        var = self.find_checked_radiobutton(self.groupBox_2.findChildren(QtWidgets.QRadioButton))
        vars = ["反射率因子", "径向速度", "谱宽", "差分反射率", "差分相位比", "相关系数"]
        for i in range(6):
            if var == vars[i]:
                return i
        return 0 
Example #12
Source File: DyStockSelectAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后'); backwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #13
Source File: tabbar.py    From FeelUOwn with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent=parent)

        self.songs_btn = QRadioButton('歌曲', self)
        self.albums_btn = QRadioButton('专辑', self)
        self.artists_btn = QRadioButton('歌手', self)
        self.playlists_btn = QRadioButton('歌单', self)
        self.desc_btn = QRadioButton('简介', self)
        self.contributed_btn = QRadioButton('参与作品', self)
        self._layout = QHBoxLayout(self)

        self.songs_btn.clicked.connect(self.show_songs_needed.emit)
        self.albums_btn.clicked.connect(self.show_albums_needed.emit)
        self.artists_btn.clicked.connect(self.show_artists_needed.emit)
        self.desc_btn.clicked.connect(self.show_desc_needed.emit)
        self.contributed_btn.clicked.connect(self.show_contributed_albums_needed.emit)
        self.playlists_btn.clicked.connect(self.show_playlists_needed.emit)

        self._tab_btn_mapping = {
            Tab.songs: self.songs_btn,
            Tab.albums: self.albums_btn,
            Tab.artists: self.artists_btn,
            Tab.playlists: self.playlists_btn,
            Tab.desc: self.desc_btn,
            Tab.contributed: self.contributed_btn,
        }

        self.check_default()
        self._setup_ui() 
Example #14
Source File: demoRadioButton1.py    From Qt5-Python-GUI-Programming-Cookbook with MIT License 5 votes vote down vote up
def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(470, 290)
        self.radioButtonBusinessClass = QtWidgets.QRadioButton(Dialog)
        self.radioButtonBusinessClass.setGeometry(QtCore.QRect(30, 130, 251, 17))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.radioButtonBusinessClass.setFont(font)
        self.radioButtonBusinessClass.setObjectName("radioButtonBusinessClass")
        self.radioButtonEconomyClass = QtWidgets.QRadioButton(Dialog)
        self.radioButtonEconomyClass.setGeometry(QtCore.QRect(30, 180, 221, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.radioButtonEconomyClass.setFont(font)
        self.radioButtonEconomyClass.setObjectName("radioButtonEconomyClass")
        self.radioButtonFirstClass = QtWidgets.QRadioButton(Dialog)
        self.radioButtonFirstClass.setGeometry(QtCore.QRect(30, 80, 201, 17))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.radioButtonFirstClass.setFont(font)
        self.radioButtonFirstClass.setObjectName("radioButtonFirstClass")
        self.label = QtWidgets.QLabel(Dialog)
        self.label.setGeometry(QtCore.QRect(80, 10, 261, 31))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.label.setFont(font)
        self.label.setObjectName("label")
        self.labelFare = QtWidgets.QLabel(Dialog)
        self.labelFare.setGeometry(QtCore.QRect(40, 245, 391, 21))
        font = QtGui.QFont()
        font.setPointSize(14)
        self.labelFare.setFont(font)
        self.labelFare.setText("")
        self.labelFare.setObjectName("labelFare")

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog) 
Example #15
Source File: grainSelector.py    From openMotor with GNU General Public License v3.0 5 votes vote down vote up
def setupChecks(self, simRes, multiselect):
        for gid, _ in enumerate(simRes.motor.grains):
            checkTitle = "Grain " + str(gid + 1)
            if multiselect:
                check = QCheckBox(checkTitle)
                check.setCheckState(2)
            else:
                check = QRadioButton(checkTitle)
            self.layout().addWidget(check)
            self.checks.append(check)
            self.checks[-1].toggled.connect(self.checksChanged.emit) 
Example #16
Source File: DyStockTableAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title, backward):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '2,3,4,5,10' )

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后');
        if backward:
            backwardRadioButton.setChecked(True)
        else:
            forwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #17
Source File: IDAtropy.py    From IDAtropy with GNU General Public License v3.0 5 votes vote down vote up
def create_chart_type_group(self):
    vbox = QtWidgets.QVBoxLayout()
    self.rg_chart_type = QtWidgets.QButtonGroup()
    self.rg_chart_type.setExclusive(True)

    for i, choice in enumerate(self.config.chart_types):
      radio = QtWidgets.QRadioButton(choice)
      self.rg_chart_type.addButton(radio, i)
      if i == self.config.chart_type: 
        radio.setChecked(True)
      vbox.addWidget(radio)

    vbox.addStretch(1)
    self.rg_chart_type.buttonClicked.connect(self.bg_graph_type_changed)
    return vbox 
Example #18
Source File: DyStockTableSelectDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, dlgName):
        self.setWindowTitle(dlgName)
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #19
Source File: DyStockVolatilityDistDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #20
Source File: FilterBandwidthDialog.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def checked_radiobutton(self):
        for rb in dir(self.ui):
            radio_button = getattr(self.ui, rb)
            if isinstance(radio_button, QRadioButton) and radio_button.isChecked():
                return radio_button
        return None 
Example #21
Source File: ui_messagetype_options.py    From urh with GNU General Public License v3.0 5 votes vote down vote up
def setupUi(self, DialogMessageType):
        DialogMessageType.setObjectName("DialogMessageType")
        DialogMessageType.resize(471, 359)
        self.gridLayout = QtWidgets.QGridLayout(DialogMessageType)
        self.gridLayout.setObjectName("gridLayout")
        self.cbRulesetMode = QtWidgets.QComboBox(DialogMessageType)
        self.cbRulesetMode.setObjectName("cbRulesetMode")
        self.cbRulesetMode.addItem("")
        self.cbRulesetMode.addItem("")
        self.cbRulesetMode.addItem("")
        self.gridLayout.addWidget(self.cbRulesetMode, 1, 0, 1, 2)
        self.tblViewRuleset = QtWidgets.QTableView(DialogMessageType)
        self.tblViewRuleset.setShowGrid(False)
        self.tblViewRuleset.setObjectName("tblViewRuleset")
        self.gridLayout.addWidget(self.tblViewRuleset, 2, 0, 3, 2)
        self.btnRemoveRule = QtWidgets.QToolButton(DialogMessageType)
        icon = QtGui.QIcon.fromTheme("list-remove")
        self.btnRemoveRule.setIcon(icon)
        self.btnRemoveRule.setObjectName("btnRemoveRule")
        self.gridLayout.addWidget(self.btnRemoveRule, 3, 2, 1, 1)
        self.rbAssignManually = QtWidgets.QRadioButton(DialogMessageType)
        self.rbAssignManually.setObjectName("rbAssignManually")
        self.gridLayout.addWidget(self.rbAssignManually, 0, 0, 1, 1)
        self.rbAssignAutomatically = QtWidgets.QRadioButton(DialogMessageType)
        self.rbAssignAutomatically.setObjectName("rbAssignAutomatically")
        self.gridLayout.addWidget(self.rbAssignAutomatically, 0, 1, 1, 1)
        spacerItem = QtWidgets.QSpacerItem(20, 145, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
        self.gridLayout.addItem(spacerItem, 4, 2, 1, 1)
        self.btnAddRule = QtWidgets.QToolButton(DialogMessageType)
        icon = QtGui.QIcon.fromTheme("list-add")
        self.btnAddRule.setIcon(icon)
        self.btnAddRule.setObjectName("btnAddRule")
        self.gridLayout.addWidget(self.btnAddRule, 2, 2, 1, 1)
        self.buttonBox = QtWidgets.QDialogButtonBox(DialogMessageType)
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")
        self.gridLayout.addWidget(self.buttonBox, 5, 0, 1, 2)

        self.retranslateUi(DialogMessageType) 
Example #22
Source File: stripper.py    From awesometts-anki-addon with GNU General Public License v3.0 5 votes vote down vote up
def show(self, *args, **kwargs):
        """
        Populate the checkbox list of available fields and initialize
        the introduction message, both based on what is selected.
        """

        self._notes = [
            self._browser.mw.col.getNote(note_id)
            for note_id in self._browser.selectedNotes()
        ]

        self.findChild(Note, 'intro').setText(
            "From the %d note%s selected in the Browser, scan the following "
            "fields:" %
            (len(self._notes), "s" if len(self._notes) != 1 else "")
        )

        layout = QtWidgets.QVBoxLayout()
        for field in sorted({field
                             for note in self._notes
                             for field in note.keys()}):
            checkbox = Checkbox(field)
            checkbox.atts_field_name = field
            layout.addWidget(checkbox)

        panel = QtWidgets.QWidget()
        panel.setLayout(layout)

        self.findChild(QtWidgets.QScrollArea, 'scroll').setWidget(panel)

        (
            self.findChild(
                QtWidgets.QRadioButton,
                self._addon.config['last_strip_mode'],
            )
            or self.findChild(QtWidgets.QRadioButton)  # use first if config bad
        ).setChecked(True)

        super(BrowserStripper, self).show(*args, **kwargs) 
Example #23
Source File: viewer.py    From IDAngr with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def setupUi(self, IDAngrTextViewer):
        IDAngrTextViewer.setObjectName("IDAngrTextViewer")
        IDAngrTextViewer.resize(812, 612)
        self.gridLayout = QtWidgets.QGridLayout(IDAngrTextViewer)
        self.gridLayout.setObjectName("gridLayout")
        self.horizontalLayout = QtWidgets.QHBoxLayout()
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.plainBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.plainBox.setChecked(True)
        self.plainBox.setObjectName("plainBox")
        self.horizontalLayout.addWidget(self.plainBox)
        self.hexBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.hexBox.setObjectName("hexBox")
        self.horizontalLayout.addWidget(self.hexBox)
        self.pyBox = QtWidgets.QRadioButton(IDAngrTextViewer)
        self.pyBox.setObjectName("pyBox")
        self.horizontalLayout.addWidget(self.pyBox)
        self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
        self.plainTextEdit = QtWidgets.QPlainTextEdit(IDAngrTextViewer)
        self.plainTextEdit.setReadOnly(True)
        self.plainTextEdit.setPlainText("")
        self.plainTextEdit.setObjectName("plainTextEdit")
        self.gridLayout.addWidget(self.plainTextEdit, 1, 0, 1, 1)

        self.retranslateUi(IDAngrTextViewer)
        QtCore.QMetaObject.connectSlotsByName(IDAngrTextViewer) 
Example #24
Source File: hw_common.py    From dash-masternode-tool with MIT License 5 votes vote down vote up
def setupUi(self, Form):
        Form.setObjectName("SelectHWDevice")
        self.lay_main = QtWidgets.QVBoxLayout(Form)
        self.lay_main.setContentsMargins(-1, 3, -1, 3)
        self.lay_main.setObjectName("lay_main")
        self.gb_devices = QtWidgets.QGroupBox(Form)
        self.gb_devices.setFlat(False)
        self.gb_devices.setCheckable(False)
        self.gb_devices.setObjectName("gb_devices")
        self.lay_main.addWidget(self.gb_devices)

        self.lay_devices = QtWidgets.QVBoxLayout(self.gb_devices)
        for idx, dev in enumerate(self.device_list):
            rb = QRadioButton(self.gb_devices)
            rb.setText(dev)
            rb.toggled.connect(partial(self.on_item_toggled, idx))
            self.device_radiobutton_list.append(rb)
            self.lay_devices.addWidget(rb)

        self.btn_main = QtWidgets.QDialogButtonBox(Form)
        self.btn_main.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel | QtWidgets.QDialogButtonBox.Ok)
        self.btn_main.setObjectName("btn_main")
        self.lay_main.addWidget(self.btn_main)
        self.retranslateUi(Form)
        QtCore.QMetaObject.connectSlotsByName(Form)
        self.setFixedSize(self.sizeHint()) 
Example #25
Source File: DyStockVolatilityDistDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('波动分布[{0}]'.format(name))
 
        # 控件
        forwardNTDaysLabel = QLabel('基准日期[{0}]向前N日(不包含基准日期)'.format(baseDate))
        self._forwardNTDaysLineEdit = QLineEdit('30')

        # 自身波动和绝对波动
        # 个股绝对波动 = 个股自身波动 + 大盘波动
        selfVolatilityRadioButton = QRadioButton('自身波动'); selfVolatilityRadioButton.setChecked(True)
        selfVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        absoluteVolatilityRadioButton = QRadioButton('绝对波动')
        absoluteVolatilityRadioButton.setToolTip('个股绝对波动 = 个股自身波动 + 大盘波动')

        # 添加到QButtonGroup
        self._volatilityButtonGroup = QButtonGroup()
        self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1); 
        self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(forwardNTDaysLabel, 0, 0)
        grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)

        grid.addWidget(selfVolatilityRadioButton, 1, 0)
        grid.addWidget(absoluteVolatilityRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #26
Source File: DyStockTableSelectDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, dlgName):
        self.setWindowTitle(dlgName)
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #27
Source File: DyStockTableAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title, backward):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '1,2,3,4,5,10')

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后')
        if backward:
            backwardRadioButton.setChecked(True)
        else:
            forwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1)
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #28
Source File: ui_dialog_assign_attribute.py    From QualCoder with MIT License 5 votes vote down vote up
def setupUi(self, Dialog_assignAttribute):
        Dialog_assignAttribute.setObjectName("Dialog_assignAttribute")
        Dialog_assignAttribute.resize(487, 148)
        self.radioButton_cases = QtWidgets.QRadioButton(Dialog_assignAttribute)
        self.radioButton_cases.setGeometry(QtCore.QRect(180, 19, 81, 20))
        self.radioButton_cases.setChecked(True)
        self.radioButton_cases.setObjectName("radioButton_cases")
        self.buttonGroup = QtWidgets.QButtonGroup(Dialog_assignAttribute)
        self.buttonGroup.setObjectName("buttonGroup")
        self.buttonGroup.addButton(self.radioButton_cases)
        self.radioButton_files = QtWidgets.QRadioButton(Dialog_assignAttribute)
        self.radioButton_files.setGeometry(QtCore.QRect(280, 19, 81, 20))
        self.radioButton_files.setObjectName("radioButton_files")
        self.buttonGroup.addButton(self.radioButton_files)
        self.label = QtWidgets.QLabel(Dialog_assignAttribute)
        self.label.setGeometry(QtCore.QRect(20, 20, 171, 17))
        self.label.setObjectName("label")
        self.buttonBox = QtWidgets.QDialogButtonBox(Dialog_assignAttribute)
        self.buttonBox.setGeometry(QtCore.QRect(130, 80, 221, 27))
        self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
        self.buttonBox.setObjectName("buttonBox")

        self.retranslateUi(Dialog_assignAttribute)
        self.buttonBox.accepted.connect(Dialog_assignAttribute.accept)
        self.buttonBox.rejected.connect(Dialog_assignAttribute.reject)
        QtCore.QMetaObject.connectSlotsByName(Dialog_assignAttribute) 
Example #29
Source File: DyStockSelectAddColumnsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, title):
        self.setWindowTitle('添加{0}列'.format(title))
 
        # 控件
        increaseColumnsLable = QLabel('基准日期几日{0}'.format(title))
        self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '1,2,3,4,5,10')

        # 前 & 后
        forwardRadioButton = QRadioButton('向前')
        backwardRadioButton = QRadioButton('向后'); backwardRadioButton.setChecked(True)

        # 添加到QButtonGroup
        self._wardButtonGroup = QButtonGroup()
        self._wardButtonGroup.addButton(forwardRadioButton, 1); 
        self._wardButtonGroup.addButton(backwardRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
        grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)

        grid.addWidget(forwardRadioButton, 2, 0)
        grid.addWidget(backwardRadioButton, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example #30
Source File: DyStockSelectSaveAsDlg.py    From DevilYuan with MIT License 5 votes vote down vote up
def _initUi(self, strategyName):
        self.setWindowTitle('[{0}]另存为'.format(strategyName))
 
        allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
        highlightRadioButton = QRadioButton('高亮')

        # 添加到QButtonGroup
        self._buttonGroup = QButtonGroup()
        self._buttonGroup.addButton(allRadioButton, 1); 
        self._buttonGroup.addButton(highlightRadioButton, 2)

        cancelPushButton = QPushButton('Cancel')
        okPushButton = QPushButton('OK')
        cancelPushButton.clicked.connect(self._cancel)
        okPushButton.clicked.connect(self._ok)

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(allRadioButton, 1, 0)
        grid.addWidget(highlightRadioButton, 1, 1)

        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
        self.setLayout(grid)
        self.setMinimumWidth(QApplication.desktop().size().width()//5)