Python PyQt5.QtWidgets.QCheckBox() Examples

The following are 30 code examples for showing how to use PyQt5.QtWidgets.QCheckBox(). These examples are extracted from open source projects. 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 check out the related API usage on the sidebar.

You may also want to check out all available functions/classes of the module PyQt5.QtWidgets , or try the search function .

Example 1
Project: ANGRYsearch   Author: DoTheEvo   File: angrysearch.py    License: GNU General Public License v2.0 7 votes vote down vote up
def __init__(self, setting_params=None):
        super().__init__()
        self.setting_params = setting_params
        self.search_input = Qw.QLineEdit()
        self.table = AngryTableView(self.setting_params['angrysearch_lite'],
                                    self.setting_params['row_height'])
        self.upd_button = Qw.QPushButton('update')
        self.fts_checkbox = Qw.QCheckBox()

        grid = Qw.QGridLayout()
        grid.setSpacing(10)

        grid.addWidget(self.search_input, 1, 1)
        grid.addWidget(self.fts_checkbox, 1, 3)
        grid.addWidget(self.upd_button, 1, 4)
        grid.addWidget(self.table, 2, 1, 4, 4)
        self.setLayout(grid)

        self.setTabOrder(self.search_input, self.table)
        self.setTabOrder(self.table, self.upd_button)


# THE MAIN APPLICATION WINDOW WITH THE STATUS BAR AND LOGIC
# LOADS AND SAVES QSETTINGS FROM ~/.config/angrysearch
# INITIALIZES AND SETS GUI, WAITING FOR USER INPUTS 
Example 2
Project: Lector   Author: BasioMeusPuga   File: annotations.py    License: GNU General Public License v3.0 6 votes vote down vote up
def modify_annotation(self):
        sender = self.sender()
        if isinstance(sender, QtWidgets.QCheckBox):
            if not sender.isChecked():
                self.update_preview()
                return

        new_color = None

        if sender == self.foregroundColorButton:
            new_color = self.get_color(self.foregroundColor)
            self.foregroundColor = new_color

        if sender == self.highlightColorButton:
            new_color = self.get_color(self.highlightColor)
            self.highlightColor = new_color

        if sender == self.underlineColorButton:
            new_color = self.get_color(self.underlineColor)
            self.underlineColor = new_color

        if new_color:
            self.set_button_background_color(sender, new_color)
        self.update_preview() 
Example 3
Project: FIRST-plugin-ida   Author: vrtadmin   File: first.py    License: GNU General Public License v2.0 6 votes vote down vote up
def init_middle_layout(self):
            if not self.should_show:
                return

            vbox = QtWidgets.QVBoxLayout()
            self.select_all = QtWidgets.QCheckBox('Select All ')
            self.filter_sub_funcs = QtWidgets.QCheckBox('Filter Out "sub_" functions ')
            vbox.addWidget(self.filter_sub_funcs)
            vbox.addWidget(self.select_all)

            format_str = '{} functions'.format(self.total_functions)
            self.function_number = QtWidgets.QLabel(format_str)
            self.function_number.setAlignment(Qt.AlignTop)
            self.middle_layout.addWidget(self.function_number)
            self.middle_layout.addStretch()
            self.middle_layout.addLayout(vbox) 
Example 4
Project: FIRST-plugin-ida   Author: vrtadmin   File: first.py    License: GNU General Public License v2.0 6 votes vote down vote up
def init_middle_layout(self):
            found = len(self.groups)
            total = len(FIRST.Metadata.get_non_jmp_wrapped_functions())
            s = 's' if 1 != total else ''
            label = 'Matched {0} out of {1} function{2}'

            self.select_highest_ranked = QtWidgets.QCheckBox('Select Highest Ranked ')
            self.filter_sub_funcs_only = QtWidgets.QCheckBox('Show only "sub_" functions')

            vbox = QtWidgets.QVBoxLayout()
            vbox.addWidget(self.filter_sub_funcs_only)
            vbox.addWidget(self.select_highest_ranked)

            self.found_format = label.format('{}', total, s)
            self.found_label = QtWidgets.QLabel(self.found_format.format(found))
            self.found_label.setAlignment(Qt.AlignTop)

            self.middle_layout.addWidget(self.found_label)
            self.middle_layout.addStretch()
            self.middle_layout.addLayout(vbox) 
Example 5
Project: DevilYuan   Author: moyuanz   File: DyStockDataHistDaysManualUpdateDlg.py    License: MIT License 6 votes vote down vote up
def _createIndicatorGroupBox(self):
        indicatorGroupBox = QGroupBox('指标')

        grid = QGridLayout()
        grid.setSpacing(10)

        rowNbr = 4
        self._indicatorCheckBoxList = []
        for i, indicator in enumerate(DyStockDataCommon.dayIndicators):
            checkBox = QCheckBox(indicator)
            checkBox.setChecked(True)

            grid.addWidget(checkBox, i//rowNbr, i%rowNbr)

            self._indicatorCheckBoxList.append(checkBox)

        indicatorGroupBox.setLayout(grid)

        return indicatorGroupBox 
Example 6
Project: kawaii-player   Author: kanishka-linux   File: settings_widget.py    License: GNU General Public License v3.0 6 votes vote down vote up
def configsettings(self):
        self.line501 = QtWidgets.QTextEdit()
        self.gl7.addWidget(self.line501, 0, 0, 1, 3)
        msg = '<html>Use this config file, otherwise global config file will be used</html>'
        self.checkbox = QtWidgets.QCheckBox("Use This Config File")
        self.checkbox.setMinimumHeight(30)
        self.checkbox.stateChanged.connect(self.use_config_file)
        self.checkbox.setToolTip(msg)
        self.gl7.addWidget(self.checkbox, 1, 0, 1, 1)
        if ui.use_custom_config_file:
            self.checkbox.setChecked(True)
        mpvlist = self.basic_params(player='mpv')
        mpvstr = '\n'.join(mpvlist)
        self.line501.setText(mpvstr) 
        
        self.btn_default_settings = QPushButtonExtra('Default Settings')
        self.gl7.addWidget(self.btn_default_settings, 1, 1, 1, 1)
        self.btn_default_settings.clicked_connect(self.get_default_config_settings)
        self.btn_default_settings.setMinimumHeight(30)
        
        self.btn_confirm = QPushButtonExtra('Save Changes')
        self.gl7.addWidget(self.btn_confirm, 1, 2, 1, 1)
        self.btn_confirm.clicked_connect(self.save_config_settings)
        self.btn_confirm.setMinimumHeight(30) 
Example 7
Project: imperialism-remake   Author: Trilarion   File: preferences.py    License: GNU General Public License v3.0 6 votes vote down vote up
def _layout_widget_preferences_graphics(self):
        """
        Create graphical options widget.
        """

        tab = QtWidgets.QWidget()
        tab_layout = QtWidgets.QVBoxLayout(tab)

        # full screen mode
        checkbox = QtWidgets.QCheckBox('Full screen mode')
        self._register_check_box(checkbox, constants.Option.MAINWINDOW_FULLSCREEN)
        tab_layout.addWidget(checkbox)

        # vertical stretch
        tab_layout.addStretch()

        # add tab
        self.tab_graphics = tab
        self.stacked_layout.addWidget(tab) 
Example 8
Project: linux-show-player   Author: FrancescoCeruti   File: command_cue.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.setLayout(QVBoxLayout())
        self.layout().setAlignment(Qt.AlignTop)

        self.group = QGroupBox(self)
        self.group.setLayout(QVBoxLayout(self.group))
        self.layout().addWidget(self.group)

        self.commandLineEdit = QLineEdit(self.group)
        self.group.layout().addWidget(self.commandLineEdit)

        self.noOutputCheckBox = QCheckBox(self)
        self.layout().addWidget(self.noOutputCheckBox)

        self.noErrorCheckBox = QCheckBox(self)
        self.layout().addWidget(self.noErrorCheckBox)

        self.killCheckBox = QCheckBox(self)
        self.layout().addWidget(self.killCheckBox)

        self.retranslateUi() 
Example 9
Project: pychemqt   Author: jjgomera   File: plot.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, name, parent=None):
        title = name+" "+QtWidgets.QApplication.translate("pychemqt", "Axis")
        super(AxisWidget, self).__init__(title, parent)
        lyt = QtWidgets.QGridLayout(self)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "Label")), 1, 1)
        self.label = InputFont()
        lyt.addWidget(self.label, 1, 2)
        self.scale = QtWidgets.QCheckBox(
            QtWidgets.QApplication.translate("pychemqt", "Logarithmic scale"))
        lyt.addWidget(self.scale, 2, 1, 1, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "from")), 3, 1)
        self.min = Entrada_con_unidades(float, min=float("-inf"))
        lyt.addWidget(self.min, 3, 2)
        lyt.addWidget(QtWidgets.QLabel(
            QtWidgets.QApplication.translate("pychemqt", "to")), 4, 1)
        self.max = Entrada_con_unidades(float, min=float("-inf"))
        lyt.addWidget(self.max, 4, 2) 
Example 10
Project: vorta   Author: borgbase   File: misc_tab.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, parent=None):
        super().__init__(parent)
        self.setupUi(parent)
        self.versionLabel.setText(__version__)
        self.logLink.setText(f'<a href="file://{LOG_DIR}"><span style="text-decoration:'
                             'underline; color:#0984e3;">Log</span></a>')

        for setting in SettingsModel.select().where(SettingsModel.type == 'checkbox'):
            x = filter(lambda s: s['key'] == setting.key, get_misc_settings())
            if not list(x):  # Skip settings that aren't specified in vorta.models.
                continue
            b = QCheckBox(translate('settings', setting.label))
            b.setCheckState(setting.value)
            b.setTristate(False)
            b.stateChanged.connect(lambda v, key=setting.key: self.save_setting(key, v))
            self.checkboxLayout.addWidget(b) 
Example 11
Project: Miyamoto   Author: aboood40091   File: dialogs.py    License: GNU General Public License v3.0 6 votes vote down vote up
def createType(self, z):
        self.Settings = QtWidgets.QGroupBox(globals.trans.string('ZonesDlg', 76))
        self.Zone_settings = []
        
        ZoneSettingsLeft = QtWidgets.QFormLayout()
        ZoneSettingsRight = QtWidgets.QFormLayout()
        settingsNames = globals.trans.stringList('ZonesDlg', 77)
        
        for i in range(0, 8):
            self.Zone_settings.append(QtWidgets.QCheckBox())
            self.Zone_settings[i].setChecked(z.type & (2 ** i))

            if i < 4:
                ZoneSettingsLeft.addRow(settingsNames[i], self.Zone_settings[i])
            else:
                ZoneSettingsRight.addRow(settingsNames[i], self.Zone_settings[i])
            
        ZoneSettingsLayout = QtWidgets.QHBoxLayout()
        ZoneSettingsLayout.addLayout(ZoneSettingsLeft)
        ZoneSettingsLayout.addStretch()
        ZoneSettingsLayout.addLayout(ZoneSettingsRight)
        
        self.Settings.setLayout(ZoneSettingsLayout) 
Example 12
Project: nanovna-saver   Author: NanoVNA-Saver   File: VSWRAnalysis.py    License: GNU General Public License v3.0 6 votes vote down vote up
def __init__(self, app):
        super().__init__(app)

        self._widget = QtWidgets.QWidget()
        self.layout = QtWidgets.QFormLayout()
        self._widget.setLayout(self.layout)

        self.input_vswr_limit = QtWidgets.QDoubleSpinBox()
        self.input_vswr_limit.setValue(self.vswr_limit_value)
        self.input_vswr_limit.setSingleStep(0.1)
        self.input_vswr_limit.setMinimum(1)
        self.input_vswr_limit.setMaximum(25)
        self.input_vswr_limit.setDecimals(2)

        self.checkbox_move_marker = QtWidgets.QCheckBox()
        self.layout.addRow(QtWidgets.QLabel("<b>Settings</b>"))
        self.layout.addRow("VSWR limit", self.input_vswr_limit)
        self.layout.addRow(VSWRAnalysis.QHLine())

        self.results_label = QtWidgets.QLabel("<b>Results</b>")
        self.layout.addRow(self.results_label) 
Example 13
Project: orstools-qgis-plugin   Author: GIScience   File: directions_gui.py    License: MIT License 6 votes vote down vote up
def _get_avoid_options(self, avoid_boxes):
        """
        Extracts checked boxes in Advanced avoid parameters.

        :param avoid_boxes: all checkboxes in advanced paramter dialog.
        :type avoid_boxes: list of QCheckBox

        :returns: avoid_features parameter
        :rtype: JSON dump, i.e. str
        """
        avoid_features = []
        for box in avoid_boxes:
            if box.isChecked():
                avoid_features.append((box.text()))

        return avoid_features 
Example 14
Project: simnibs   Author: simnibs   File: main_gui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def set_direction_layout(self):
        box_text = "Direction Reference"
        self.direction_box = QtWidgets.QGroupBox(box_text)

        load_ref = self.reference is not None and len(self.reference) == 3

        Layout = QtWidgets.QGridLayout()

        self.check = QtWidgets.QCheckBox('Define Reference Coordinates')

        Layout.addWidget(self.check, 0,0,1,3)

        self.label_x2 = QtWidgets.QLabel("X:")
        Layout.addWidget(self.label_x2,1,1)
        self.ref_x = QtWidgets.QDoubleSpinBox()
        self.ref_x.setRange(-1000, 1000)
        if load_ref: self.ref_x.setValue(self.reference[0])
        #self.ref_x.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_x,2,1)

        self.label_y2 = QtWidgets.QLabel("Y:")
        Layout.addWidget(self.label_y2,1,2)
        self.ref_y = QtWidgets.QDoubleSpinBox()
        self.ref_y.setRange(-1000, 1000)
        if load_ref: self.ref_y.setValue(self.reference[1])
        #self.ref_y.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_y,2,2)

        self.label_z2 = QtWidgets.QLabel("Z:")
        Layout.addWidget(self.label_z2,1,3)
        self.ref_z = QtWidgets.QDoubleSpinBox()
        self.ref_z.setRange(-1000, 1000)
        if load_ref: self.ref_z.setValue(self.reference[2])
        #self.ref_z.valueChanged.connect(self.update_stimulator)
        Layout.addWidget(self.ref_z,2,3)

        self.direction_box.setLayout(Layout)

    #Returns the positions 
Example 15
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: general_settings_wt.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.show()
        self.run_on_startup_qcb = QtWidgets.QCheckBox(self.tr("Run on startup"))
        self._init_ui() 
Example 16
Project: mindfulness-at-the-computer   Author: mindfulness-at-the-computer   File: toggle_switch_wt.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self):
        super().__init__()

        self.updating_gui_bool = False

        self.turn_on_off_qcb = QtWidgets.QCheckBox()
        self.turn_on_off_qcb.toggled.connect(self._on_toggled)
        on_off_qhl = QtWidgets.QHBoxLayout()
        on_off_qhl.setContentsMargins(0,0,0,0)
        on_off_qhl.addWidget(QtWidgets.QLabel(self.tr("Turn the dialog and notifications on or off")))
        on_off_qhl.addStretch(1)
        on_off_qhl.addWidget(self.turn_on_off_qcb)
        self.setLayout(on_off_qhl) 
Example 17
Project: visma   Author: aerospaceresearch   File: settings.py    License: GNU General Public License v3.0 5 votes vote down vote up
def buttonState(button, workspace):
    """Takes action according to button and its state change trigger

    Arguments:
        button {QtWidgets.QCheckBox} -- preference checkbox
        workspace {QtWidgets.QWidget} -- main layout
    """

    workspace.clearAll()

    if button.text() == "Quick Simplifier":
        if button.isChecked() is True:
            workspace.showQSolver = True
        else:
            workspace.showQSolver = False

    elif button.text() == "Step-by-step Solution":
        if button.isChecked() is True:
            workspace.showStepByStep = True
        else:
            workspace.showStepByStep = False

    elif button.text() == "Graph Plotter":
        if button.isChecked() is True:
            workspace.showPlotter = True
        else:
            workspace.showPlotter = False 
Example 18
Project: FIRST-plugin-ida   Author: vrtadmin   File: first.py    License: GNU General Public License v2.0 5 votes vote down vote up
def init_middle_layout(self):
            #self.check_on_startup = QtWidgets.QCheckBox("Check FIRST on IDA startup")
            #self.middle_layout.addWidget(self.check_on_startup)
            self.middle_layout.addStretch() 
Example 19
Project: DevilYuan   Author: moyuanz   File: DyStockTableFilterDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self, colNames):
        self.setWindowTitle('过滤')
 
        # 控件
        table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
        table.setColNames(['列名', '表达式'])
        rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
        table.fastAppendRows(rows)

        descriptionLabel = QLabel('行过滤表达式(Python语法)')
        self._filterTextEdit = QTextEdit()
        self._newWindowCheckBox = QCheckBox('新窗口')
        self._newWindowCheckBox.setChecked(True)
        self._highlightCheckBox = QCheckBox('原窗口高亮')
        self._highlightCheckBox.setChecked(False)

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

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(table, 0, 0, 22, 1)
        grid.addWidget(self._newWindowCheckBox, 0, 1)
        grid.addWidget(self._highlightCheckBox, 0, 2)

        grid.addWidget(descriptionLabel, 1, 1)

        grid.addWidget(self._filterTextEdit, 2, 1, 20, 20)
 
        grid.addWidget(okPushButton, 0, 21)
        grid.addWidget(cancelPushButton, 1, 21)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3) 
Example 20
Project: DevilYuan   Author: moyuanz   File: DyStockIndustryCompareDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('行业对比[{0}]-基准日期[{1}]'.format(name, baseDate))
 
        # 控件
        forwardNTDaysLabel = QLabel('向前N日涨幅(%)')
        self._forwardNTDaysLineEdit = QLineEdit('30')

        self._industry2CheckBox = QCheckBox('行业二级分级')
        #self._industry2CheckBox.setChecked(True)

        self._industry3CheckBox = QCheckBox('行业三级分级')
        self._industry3CheckBox.setChecked(True)

        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(self._industry2CheckBox, 1, 0)
        grid.addWidget(self._industry3CheckBox, 1, 1)

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

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example 21
Project: DevilYuan   Author: moyuanz   File: DyStockSelectIndustryCompareDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self, name, baseDate):
        self.setWindowTitle('行业对比[{0}]-基准日期[{1}]'.format(name, baseDate))
 
        # 控件
        forwardNTDaysLabel = QLabel('向前N日涨幅(%)')
        self._forwardNTDaysLineEdit = QLineEdit('30')

        self._industry2CheckBox = QCheckBox('行业二级分级')
        #self._industry2CheckBox.setChecked(True)

        self._industry3CheckBox = QCheckBox('行业三级分级')
        self._industry3CheckBox.setChecked(True)

        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(self._industry2CheckBox, 1, 0)
        grid.addWidget(self._industry3CheckBox, 1, 1)

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

        self.setMinimumWidth(QApplication.desktop().size().width()//5) 
Example 22
Project: DevilYuan   Author: moyuanz   File: DyStockSelectRefactoryParamsDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self, header, params):
        self.setWindowTitle('重构参数')
 
        # 控件
        self._table = DyTableWidget(parent=None, readOnly=False, index=False, floatCut=True, autoScroll=False)
        self._table.setColNames(header)
        self._table.fastAppendRows(params)

        self._newWindowCheckBox = QCheckBox('新窗口')
        self._newWindowCheckBox.setChecked(True)

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

        # 布局
        grid = QGridLayout()
        grid.setSpacing(10)
 
        grid.addWidget(self._newWindowCheckBox, 0, 0)
        grid.addWidget(self._table, 1, 0, 1, 2)
 
        grid.addWidget(okPushButton, 2, 1)
        grid.addWidget(cancelPushButton, 2, 0)
 
 
        self.setLayout(grid)
        self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//4*3) 
Example 23
Project: DevilYuan   Author: moyuanz   File: DyStockDataHistTicksVerifyDlg.py    License: MIT License 5 votes vote down vote up
def _initUi(self):
        self.setWindowTitle('历史分笔数据校验')
 
        # 控件
        startDateLable = QLabel('开始日期')
        self._startDateLineEdit = QLineEdit(datetime.now().strftime("%Y-%m-%d"))

        endDateLable = QLabel('结束日期')
        self._endDateLineEdit = QLineEdit(datetime.now().strftime("%Y-%m-%d"))

        self._addCheckBox = QCheckBox('校验缺失历史分笔数据')
        self._addCheckBox.setChecked(True)
        self._deleteCheckBox = QCheckBox('校验无效历史分笔数据')
        #self._deleteCheckBox.setChecked(True)

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

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

        grid.addWidget(endDateLable, 0, 1)
        grid.addWidget(self._endDateLineEdit, 1, 1)

        grid.addWidget(self._addCheckBox, 2, 0)
        grid.addWidget(self._deleteCheckBox, 2, 1)

        grid.addWidget(okPushButton, 3, 1)
        grid.addWidget(cancelPushButton, 3, 0)
 
        self.setLayout(grid) 
Example 24
Project: ddt4all   Author: cedricp   File: dataeditor.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, data, num, parent=None):
        super(Bit_container, self).__init__(parent)
        self.data = data
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.setFixedWidth(140)

        self.layout = widgets.QVBoxLayout()
        cblayout = widgets.QHBoxLayout()
        cblayout.setContentsMargins(0, 0, 0, 0)
        cblayout.setSpacing(0)
        data = int("0x" + data, 16)
        databin = bin(data)[2:].zfill(8)

        self.checkboxes = []
        for i in range(8):
            cb = widgets.QCheckBox()
            cb.setEnabled(False)
            if databin[i] == "1":
                cb.setChecked(True)
            self.checkboxes.append(cb)
            cblayout.addWidget(cb)
            cb.setStyleSheet("color: green")

        label = widgets.QLabel(str(num + 1).zfill(2))
        label.setAlignment(core.Qt.AlignHCenter | core.Qt.AlignVCenter)

        self.labelvaluehex = widgets.QLabel("$00")
        self.labelvaluehex.setAlignment(core.Qt.AlignHCenter | core.Qt.AlignVCenter)

        self.layout.addWidget(label)
        self.layout.addWidget(self.labelvaluehex)
        self.layout.addLayout(cblayout)
        self.setLayout(self.layout) 
Example 25
Project: ddt4all   Author: cedricp   File: dataeditor.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, dataitem, parent=None):
        super(numericListPanel, self).__init__(parent)
        self.setFrameStyle(widgets.QFrame.Sunken)
        self.setFrameShape(widgets.QFrame.Box)
        self.data = dataitem

        layoutv = widgets.QVBoxLayout()
        layout = widgets.QGridLayout()
        labelnob = widgets.QLabel(_("Number of bits"))
        lablelsigned = widgets.QLabel(_("Signed"))
        newitem = widgets.QPushButton(_("Add item"))
        delitem = widgets.QPushButton(_("Del item"))

        newitem.clicked.connect(self.add_item)
        delitem.clicked.connect(self.def_item)

        layout.addWidget(labelnob, 0, 0)
        layout.addWidget(lablelsigned, 1, 0)
        layout.addWidget(newitem, 2, 0)
        layout.addWidget(delitem, 2, 1)

        self.inputnob = widgets.QSpinBox()
        self.inputnob.setRange(1, 32)
        self.inputsigned = widgets.QCheckBox()

        layout.addWidget(self.inputnob, 0, 1)
        layout.addWidget(self.inputsigned, 1, 1)

        layoutv.addLayout(layout)

        self.itemtable = widgets.QTableWidget()
        self.itemtable.setRowCount(1)
        self.itemtable.setColumnCount(2)
        self.itemtable.verticalHeader().hide()
        self.itemtable.setSelectionBehavior(widgets.QAbstractItemView.SelectRows)
        self.itemtable.setSelectionMode(widgets.QAbstractItemView.SingleSelection)

        layoutv.addWidget(self.itemtable)

        self.setLayout(layoutv)
        self.init() 
Example 26
Project: reaper   Author: ScriptSmith   File: progress.py    License: GNU General Public License v3.0 5 votes vote down vote up
def create_snapshot(self):
        self.snapshotCheckBox = QtWidgets.QCheckBox("Show snapshot")
        self.snapshotCheckBox.toggled.connect(self.toggle_snapshot)
        self.layout.addWidget(self.snapshotCheckBox)

        self.snapshot = QtWidgets.QTableWidget()
        self.snapshot.verticalHeader().setSectionResizeMode(QtWidgets.QHeaderView.Fixed)
        self.snapshot.horizontalHeader().setSectionResizeMode(
            QtWidgets.QHeaderView.Interactive
        )
        self.snapshot.horizontalHeader().setCascadingSectionResizes(True)
        self.layout.addWidget(self.snapshot) 
Example 27
Project: BaiduNetDiskAutoTransfer   Author: VinylChloride   File: mainPrgGui.py    License: GNU General Public License v3.0 5 votes vote down vote up
def __createCheckBox(self):
		self.__runModeCheckBox = QCheckBox(self.__lang.get("runModeCheckBox"),self)

		self.__widgetList.append(self.__runModeCheckBox) 
Example 28
Project: kite   Author: pyrocko   File: config.py    License: GNU General Public License v3.0 5 votes vote down vote up
def setAttributes(self):
        for attr in self.attributes:
            qw = self.__getattribute__(attr)
            if isinstance(qw, QtWidgets.QCheckBox):
                value = qw.isChecked()
            elif isinstance(qw, QtWidgets.QLineEdit):
                value = str(qw.text())
            else:
                value = qw.value()

            getConfig().__setattr__(attr, value)

        getConfig().saveConfig() 
Example 29
Project: imperialism-remake   Author: Trilarion   File: preferences.py    License: GNU General Public License v3.0 5 votes vote down vote up
def _layout_widget_preferences_music(self):
        """
        Create music options widget.
        """
        tab = QtWidgets.QWidget()
        tab_layout = QtWidgets.QVBoxLayout(tab)

        # soundtrack section
        layout = QtWidgets.QVBoxLayout()

        # mute checkbox
        checkbox = QtWidgets.QCheckBox('Mute soundtrack')
        self._register_check_box(checkbox, constants.Option.SOUNDTRACK_MUTE)
        layout.addWidget(checkbox)

        # volume slide
        layout.addWidget(QtWidgets.QLabel('Volume'))
        slider = QtWidgets.QSlider(QtCore.Qt.Horizontal)
        slider.setTickInterval(25)
        slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
        slider.setMaximumWidth(100)
        self._register_slider(slider, constants.Option.SOUNDTRACK_VOLUME)
        layout.addWidget(slider)

        # wrap in group box and add to tab
        tab_layout.addWidget(qt.wrap_in_groupbox(layout, 'Soundtrack'))

        # vertical stretch
        tab_layout.addStretch()

        # add tab
        self.tab_music = tab
        self.stacked_layout.addWidget(tab) 
Example 30
Project: 3d-nii-visualizer   Author: adamkwolf   File: MainWindow.py    License: MIT License 5 votes vote down vote up
def add_brain_slicer(self):
        slicer_cb = QtWidgets.QCheckBox("Slicer")
        slicer_cb.clicked.connect(self.brain_slicer_vc)
        return slicer_cb