当前位置: 首页>>代码示例>>Python>>正文


Python Qt.Checked方法代码示例

本文整理汇总了Python中PyQt5.QtCore.Qt.Checked方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.Checked方法的具体用法?Python Qt.Checked怎么用?Python Qt.Checked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.Qt的用法示例。


在下文中一共展示了Qt.Checked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: move_item

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def move_item(self, item: QTreeWidgetItem, favorite: bool):
        """ Move an time to or from the favorites tree. """

        if favorite:
            tree = self.tab2.options
            self.settings.user_options['favorites'].remove(item.data(0, 0))
        else:
            tree = self.tab2.favorites
            self.settings.user_options['favorites'].append(item.data(0, 0))

        self.tab2.enable_favorites(bool(self.settings.user_options['favorites']))
        tree.blockSignals(True)
        tree.addTopLevelItem(item)

        self.tab2.options.update_size()
        self.tab2.favorites.update_size()

        self.file_handler.save_settings(self.settings.settings_data)

        if item.checkState(0) == Qt.Checked:
            item.setExpanded(True)
        else:
            item.setExpanded(False)

        tree.blockSignals(False) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:27,代码来源:core.py

示例2: __GetFields

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def __GetFields(self, parent):
        fields = []
        for i in range(parent.childCount()):
            childItem = parent.child(i)

            # leaf
            if childItem.childCount() == 0:
                if childItem.checkState(0) == Qt.Checked:
                    field = self.__GetFieldByShowName(self._fields, childItem.text(0))
                    fields.append(field)
                continue
            
            if childItem.checkState(0) == Qt.Checked or childItem.checkState(0) == Qt.PartiallyChecked:
                field = self.__GetFields(childItem)
                fields.extend(field)

        return fields 
开发者ID:moyuanz,项目名称:DevilYuan,代码行数:19,代码来源:DyTreeWidget.py

示例3: value_change

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def value_change(self, imager_key):
        label, lineEdit, checkBox = self.dlog_attrs[imager_key]

        try:
            value = float(lineEdit.text())
        except ValueError:
            value = None
        finally:
            imager_inputs = self.specsheet.imager_inputs
            if value is not None:
                if imager_key in imager_inputs or len(imager_inputs) < 2:
                    imager_inputs[imager_key] = value
                    if not checkBox.isChecked():
                        checkBox.setCheckState(qt.Checked)
            else:
                if imager_key in imager_inputs:
                    del imager_inputs[imager_key]
                    if checkBox.isChecked():
                        checkBox.setChecked(False)
            self.parent.update_values() 
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:22,代码来源:idealimagerdialog.py

示例4: chkbox_change

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def chkbox_change(self, state, imager_key):
        label, lineEdit, checkBox = self.dlog_attrs[imager_key]

        checked = state == qt.Checked
        if checked:
            try:
                value = float(lineEdit.text())
            except ValueError:
                value = None
            finally:
                self.specsheet.imager_inputs[imager_key] = value
                if not checkBox.isChecked():
                    checkBox.setChecked(True)
        else:
            if imager_key in self.specsheet.imager_inputs:
                del self.specsheet.imager_inputs[imager_key]
                if checkBox.isChecked():
                    checkBox.setChecked(False)
        self.parent.update_checkboxes() 
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:21,代码来源:idealimagerdialog.py

示例5: create_draw_rays_groupbox

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def create_draw_rays_groupbox(app, pc):
    tb = QToolBar()
    fig = pc.figure

    def attr_check(fig, attr, state):
        checked = state == qt.Checked
#        cur_value = getattr(fig, attr, None)
        setattr(fig, attr, checked)
        fig.refresh()

    parax_checkBox = QCheckBox("&paraxial rays")
    parax_checkBox.setChecked(fig.do_paraxial_layout)
    parax_checkBox.stateChanged.connect(
        lambda checked: attr_check(fig, 'do_paraxial_layout', checked))
    edge_checkBox = QCheckBox("&edge rays")
    edge_checkBox.setChecked(fig.do_draw_rays)
    edge_checkBox.stateChanged.connect(
        lambda checked: attr_check(fig, 'do_draw_rays', checked))

    tb.addWidget(parax_checkBox)
    tb.addWidget(edge_checkBox)

    return tb 
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:25,代码来源:plotview.py

示例6: download_name_handler

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def download_name_handler(self):
        """ Formats download names and removes the naming string for ytdl. """
        item = self.tab2.download_option

        item.treeWidget().blockSignals(True)
        for number in range(item.childCount()):
            path = self.settings['Download location']['options'][number]
            item.child(number).setToolTip(0, path)
            item.child(number).setText(0, path_shortener(path))

        if item.checkState(0) == Qt.Checked:
            for number in range(item.childCount()):
                if item.child(number).checkState(0) == Qt.Checked:
                    self.tab2.download_lineedit.setText(item.child(number).data(0, 0))
                    self.tab2.download_lineedit.setToolTip(item.child(number).data(0, 32))
                    break
            else:
                # TODO: Add error handling here
                print('WARNING! No selected download item, this should not happen.... ')
                print('You messed with the settings... didn\'t you?!')
                # raise SettingsError('Error, no active option!')
        else:
            self.tab2.download_lineedit.setText(path_shortener(self.local_dl_path))
            self.tab2.download_lineedit.setToolTip(self.local_dl_path)
        item.treeWidget().blockSignals(False) 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:27,代码来源:core.py

示例7: _del_option

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def _del_option(self, parent: QTreeWidgetItem, child: QTreeWidgetItem):

        self.blockSignals(True)

        parent.removeChild(child)
        selected_option = False
        for i in range(parent.childCount()):
            parent.child(i).setData(0, 35, i)
            if parent.child(i).checkState(0) == Qt.Checked:
                selected_option = True

        if parent.childCount() > 0 and not selected_option:
            parent.child(0).setCheckState(0, Qt.Checked)

        # Deselects if no options left
        if not parent.childCount():
            parent.setCheckState(0, Qt.Unchecked)

        self.blockSignals(False)

        self.update_size() 
开发者ID:Thomasedv,项目名称:Grabber,代码行数:23,代码来源:parameter_tree.py

示例8: __init__

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def __init__(self, item, name, val, app):
        super().__init__(item, [name + '  '])
        self.name = name
        self.app = app
        self.required = '{%s}' % name in self.app.base_url
        
        if not self.required:
            self.setCheckState(0, Qt.Checked)
            self.last_check_state = Qt.Checked

        self.widget = QLineEdit()
        self.widget.setFrame(False)
        self.widget.setStyleSheet('padding: 1px 0')
        self.widget.textEdited.connect(self.value_changed)
        self.app.fuzzer.getTree.setItemWidget(self, 1, self.widget)
        
        self.widget.setText(val)
        self.value = val
        
        self.widget.setMouseTracking(True)
        self.widget.enterEvent = self.edit 
开发者ID:marin-m,项目名称:pbtk,代码行数:23,代码来源:fuzzer.py

示例9: get_selected_events

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def get_selected_events(self, time_selection=None):
        """Returns which events are present in one time window.

        Parameters
        ----------
        time_selection : tuple of float
            start and end of the window of interest

        Returns
        -------
        list of dict
            list of events in the window of interest
        """
        events = []
        for checkbox in self.idx_eventtype_list:
            if checkbox.checkState() == Qt.Checked:
                events.extend(self.annot.get_events(name=checkbox.text(),
                                                    time=time_selection))

        return events 
开发者ID:wonambi-python,项目名称:wonambi,代码行数:22,代码来源:notes.py

示例10: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def data(self, index, role):
        if not index.isValid():
            return None
        if index.column() == 0:
            value = ('' if self.my_data[index.row()][index.column() + 1]
                     else 'Skip')
        else:
            value = self.my_data[index.row()][index.column() + 1]
        if role == Qt.EditRole:
            return value
        elif role == Qt.DisplayRole:
            return value
        elif role == Qt.CheckStateRole:
            if index.column() == 0:
                return (
                    Qt.Checked if self.my_data[index.row()][index.column() + 1]
                    else Qt.Unchecked) 
开发者ID:jprouty,项目名称:mint-amazon-tagger,代码行数:19,代码来源:qt.py

示例11: data

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def data(self, index, rola=Qt.DisplayRole):
        """ Wyświetlanie danych """
        i = index.row()
        j = index.column()

        if rola == Qt.DisplayRole:
            return '{0}'.format(self.tabela[i][j])
        elif rola == Qt.CheckStateRole and (j == 3 or j == 4):
            if self.tabela[i][j]:
                return Qt.Checked
            else:
                return Qt.Unchecked
        elif rola == Qt.EditRole and j == 1:
            return self.tabela[i][j]
        else:
            return QVariant() 
开发者ID:koduj-z-klasa,项目名称:python101,代码行数:18,代码来源:tabmodel_z5.py

示例12: ok

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def ok(self):

        selectedSubjects = []
        for idx in range(self.lwSubjects.count()):
            cb = self.lwSubjects.itemWidget(self.lwSubjects.item(idx))
            if cb.isChecked():
                selectedSubjects.append(cb.text())
        self.selectedSubjects = selectedSubjects

        selectedBehaviors = []
        for idx in range(self.lwBehaviors.count()):
            if self.lwBehaviors.item(idx).checkState() == Qt.Checked:
                selectedBehaviors.append(self.lwBehaviors.item(idx).text())
        self.selectedBehaviors = selectedBehaviors

        self.accept() 
开发者ID:olivierfriard,项目名称:BORIS,代码行数:18,代码来源:param_panel.py

示例13: behavior_item_clicked

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def behavior_item_clicked(self, item):
        """
        check / uncheck behaviors belonging to the clicked category
        """

        if item.data(33) == "category":
            category = item.data(34)
            for i in range(self.lwBehaviors.count()):
                if self.lwBehaviors.item(i).data(34) == category and self.lwBehaviors.item(i).data(33) != "category":

                    if item.data(35):
                        self.lwBehaviors.item(i).setCheckState(Qt.Unchecked)
                    else:
                        self.lwBehaviors.item(i).setCheckState(Qt.Checked)

            item.setData(35, not item.data(35)) 
开发者ID:olivierfriard,项目名称:BORIS,代码行数:18,代码来源:param_panel.py

示例14: cb_changed

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def cb_changed(self):
        selectedSubjects = []
        for idx in range(self.lwSubjects.count()):
            cb = self.lwSubjects.itemWidget(self.lwSubjects.item(idx))
            if cb and cb.isChecked():
                selectedSubjects.append(cb.text())

        # FIX ME
        observedBehaviors = self.extract_observed_behaviors(self.selectedObservations, selectedSubjects)

        logging.debug(f"observed behaviors: {observedBehaviors}")

        for idx in range(self.lwBehaviors.count()):

            if self.lwBehaviors.item(idx).data(33) != "category":
                if self.lwBehaviors.item(idx).text() in observedBehaviors:
                    self.lwBehaviors.item(idx).setCheckState(Qt.Checked)
                else:
                    self.lwBehaviors.item(idx).setCheckState(Qt.Unchecked) 
开发者ID:olivierfriard,项目名称:BORIS,代码行数:21,代码来源:param_panel.py

示例15: set_checked

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import Checked [as 别名]
def set_checked(self, rows):
        for row in rows:
            check_item = QStandardItem()
            check_item.setCheckState(Qt.Checked)
            check_item.setEnabled(False)
            check_item.setToolTip('Already added to main collection...')
            self.setItem(row, 0, check_item) 
开发者ID:MTG,项目名称:dunya-desktop,代码行数:9,代码来源:recordingmodel.py


注:本文中的PyQt5.QtCore.Qt.Checked方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。