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


Python QStandardItem.setCheckable方法代码示例

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


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

示例1: __connect_events

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
 def __connect_events(self):
     self.model = QStandardItemModel()
     self.mass_list = []
     for i in range(10):
         mass = 184 + i
         self.mass_list.append(str(mass))
     for i in range(10):
         mass = 209 + i
         self.mass_list.append(str(mass))
     for i in range(10):
         mass = 273.3 + i
         self.mass_list.append(str(mass))
     for i in range(10):
         mass = 294 + i
         self.mass_list.append(str(mass))
     for mass in self.mass_list:
         item = QStandardItem(mass)
         item.setCheckable(True)
         item.setEditable(True)
         self.model.appendRow(item)
     self.view = self.ui.listView_Mass
     self.view.setModel(self.model)
     # changes in one item, don't know which one
     self.model.itemChanged.connect(self.change_list)
     # changes in button
     self.ui.pushButton_ChangeList.clicked.connect(self.emit_list_signal)
     # get peaks found and update automatically the mass list
     self.ana.masstabSelectorRaisedSignal.connect(self.update_list_view)
开发者ID:odile9999,项目名称:asan,代码行数:30,代码来源:masstab_selector.py

示例2: scanPath

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def scanPath(self):
        path=self.path
        sbpCheck=self.subPathCheck.checkState()==2
        listdir=[]
        if sbpCheck:
            [[listdir.append(p.replace(path+os.sep,"")+os.sep+x if p.replace(path,"")!="" else x) for x in f] for (p,d,f) in os.walk(path)]
        else:
            listdir=os.listdir(path)
        #print(listdir)
        iconDict={"doc":QIcon("icons\\doc.png"),"docx":QIcon("icons\\docx.png")}
        model=self.FilesTableModel
        model.clear()
        self.FilesList.clear()
        for x in listdir:
            filepath=self.path+os.sep+x
            if not os.path.exists(filepath) or os.path.isdir(filepath): continue

            attrs=win32api.GetFileAttributes(filepath)
            #print(p,x, attrs,    win32con.FILE_ATTRIBUTE_HIDDEN) Исключаем все скрытые файлы
            if attrs in [2,3,34,35]: continue#win32con.FILE_ATTRIBUTE_HIDDEN=2,arch=32,readonly=1
            keyIcon=x.split(".")[-1]
            if keyIcon in iconDict.keys():
                item=QStandardItem(iconDict[keyIcon],x)
                item.setCheckable(True)
                item.setCheckState(2)
                item.setEditable(False)
                model.appendRow(item)
        self.ChangeFilesList()
开发者ID:tyrbonit,项目名称:WordPackReplacer,代码行数:30,代码来源:FilesTableWidget.py

示例3: fillReferences

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
 def fillReferences(self):
     
     for value in self.referenceList:                   
         item = QStandardItem(value[0])
         check = Qt.Checked if value[1] else Qt.Unchecked
         item.setCheckState(check)
         item.setCheckable(True)
         self.referenceListModel.appendRow(item)
开发者ID:MiRichter,项目名称:OptiSim,代码行数:10,代码来源:fitting_advanced.py

示例4: addTreeEntry

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
 def addTreeEntry(self, parent, name, parameter, func, level = 1):
     child = QStandardItem(name)
     child.setCheckable(True)
     value = QStandardItem(str(parameter))
     parent.appendRow([child, value])
     
     if level == 3:
         osciNum = parent.parent().rowCount() - 2
         itemNum = parent.rowCount() - 1
         self.parameterList.append([parameter, func, osciNum, itemNum])
     else:
         self.parameterList.append([parameter, func])
开发者ID:MiRichter,项目名称:OptiSim,代码行数:14,代码来源:fitting_advanced.py

示例5: update_list_view

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def update_list_view(self, xind):
        self.mass_list = []
        for i in range(len(xind)):
            m = "{:.1f}".format(float(xind[i]))
            self.mass_list.append(str(m))
        self.model.clear()
        self.model = QStandardItemModel()

        for mass in self.mass_list:
            item = QStandardItem(mass)
            item.setCheckable(True)
            item.setEditable(True)
            item.setCheckState(Qt.Checked)
            self.model.appendRow(item)
        self.view = self.ui.listView_Mass
        self.view.setModel(self.model)
        # changes in one item, don't know which one
        self.model.itemChanged.connect(self.change_list)
开发者ID:odile9999,项目名称:asan,代码行数:20,代码来源:masstab_selector.py

示例6: __init__

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def __init__(self, availableScalars, scalarsToShow, parent=None):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        super().__init__(parent)
        self.setupUi(self)
        
        self.ValueListModel = QStandardItemModel()

        for value in availableScalars:                   
            item = QStandardItem(value)
            check = Qt.Checked if value in scalarsToShow else Qt.Unchecked
            item.setCheckState(check)
            item.setCheckable(True)
            self.ValueListModel.appendRow(item)
        
        
        self.ValueListView.setModel(self.ValueListModel)
开发者ID:MiRichter,项目名称:OptiSim,代码行数:22,代码来源:calculatedvalues.py

示例7: updateTree

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def updateTree(self, root_item):
        self.model.clear()
        self.model.setHorizontalHeaderLabels(('Name',))
        parentItem = self.model.invisibleRootItem()

        for date_item in root_item.children:
            item = QStandardItem(date_item.data)
            parentItem.appendRow(item)
            items = [item]
            childrenS = [date_item.children]
            while items:
                cur_parent_item = items.pop()
                his_children = childrenS.pop()
                for child in his_children:
                    item = QStandardItem(child.data)
                    item.setCheckable(True)
                    cur_parent_item.appendRow(item)
                    if child.has_children:
                        items.append(item)
                        childrenS.append(child.children)
开发者ID:imelentsov,项目名称:amrecover,代码行数:22,代码来源:amrecover.py

示例8: addRow

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
 def addRow(self,arg=None,FindRepl=["",""]):
     #print(arg,FindRepl)
     row=self.replaceTable.currentIndex().row()
     ToolTipText=["Текст для поиска","Текст замены",
                  "Использовать индивидуальные настройки для данной строки"]
     items=[]
     for i, TText in enumerate(ToolTipText):
         Item=QStandardItem()
         Item.setData(TText,Qt.ToolTipRole)
         if i>1:
             Item.setData(False,Qt.CheckStateRole)
             Item.setData("Задать",Qt.DisplayRole)
             Item.setData(self.optionWdgt,Qt.UserRole)
             Item.setEditable(False)
             Item.setCheckable(True)
         else:
             Item.setData(FindRepl[i],Qt.DisplayRole)
         items.append(Item)
     self.ReplaceModel.insertRow(row+1,items)
     self.replaceTable.selectRow(row+1)
     self.replaceTable.resizeRowsToContents()
开发者ID:tyrbonit,项目名称:WordPackReplacer,代码行数:23,代码来源:ReplaceTableWidget.py

示例9: fill_tree

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def fill_tree(self, children: List[FsFileInfo]) -> None:

        self.item.removeRows(0, self.item.rowCount())
        for child in self.tree.sort_children(children):
            subitem = QStandardItem(child.get_label())
            if child.checkable():
                subitem.setCheckable(True)
                subitem.setCheckState(True)
                subitem.setTristate(True)
                subitem.setCheckState(child.state)
            subitem.setEnabled(child.enable())
            subitem.setSelectable(child.selectable())
            subitem.setEditable(False)
            subitem.setData(QVariant(child), Qt.UserRole)

            if child.folderish():
                # Add "Loading..." entry in advance for when the user
                # will click to expand it.
                loaditem = QStandardItem(Translator.get("LOADING"))
                loaditem.setSelectable(False)
                subitem.appendRow(loaditem)

            self.item.appendRow(subitem)
开发者ID:nuxeo,项目名称:nuxeo-drive,代码行数:25,代码来源:folders_treeview.py

示例10: refreshInputDirectory

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def refreshInputDirectory(self):
        if not str(self.ui.lineInputDir.text()):
            return

        self.listViewFilesModel = QStandardItemModel(self.ui.listViewFiles)
        self.listViewFilesModel.itemChanged.connect(self.listViewChanged)

        self.inputFiles = []
        for file in os.listdir(self.ui.lineInputDir.text()):
            if self.ui.lineFilter.text().upper() in file.upper():
                if file.endswith(".svg"):
                    item = QStandardItem(file)
                    item.setCheckable(True)
                    item.setCheckState(QtCore.Qt.Unchecked)
                    self.listViewFilesModel.appendRow(item)

        self.ui.listViewFiles.setModel(self.listViewFilesModel)

        if self.listViewFilesModel.rowCount() == 1:
            self.ui.labelFilter.setText("{0} svg file found".format(self.listViewFilesModel.rowCount()))
        else:
            self.ui.labelFilter.setText("{0} svg files found".format(self.listViewFilesModel.rowCount()))
        self.ui.labelSelected.setText("0 svg files selected")
        self.ui.btnConvert.setEnabled(False)
开发者ID:fhaze,项目名称:FlandreSVGTool,代码行数:26,代码来源:FlandreSVGTool.py

示例11: _populate_plan_ui

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def _populate_plan_ui(ui, model, plan):
        """
        Fill all widgets with current model data.
        """
        from PyQt5.QtGui import QStandardItemModel
        from PyQt5.QtGui import QStandardItem

        # ----------- General Info Tab ---------------------------
        ui.lineEdit.setText(plan.basename)
        ui.lineEdit_2.setText(plan.comment)
        ui.lineEdit_3.setText(str(plan.__uuid__))

        # ----------- Target Tab ---------------------------------
        voinames = [voi.name for voi in model.vdx.vois]

        # TARGET
        ui.comboBox.clear()
        for voi in model.vdx.vois:
            ui.comboBox.addItem(voi.name, voi)
            if plan.voi_target:
                _i = ui.comboBox.findData(voi)
                if _i == -1:  # not found
                    logger.warning("_populate_plan_ui() FIXME")
                else:
                    ui.comboBox.setCurrentIndex(_i)
            else:
                plan.voi_target = model.vdx.vois[0]
                ui.comboBox.setCurrentIndex(0)

        # OAR
        list = ui.listView
        # https://www.pythoncentral.io/pyside-pyqt-tutorial-qlistview-and-qstandarditemmodel/
        listmodel = QStandardItemModel(list)
        for voiname in voinames:
            item = QStandardItem(voiname)
            item.setCheckable(True)
            listmodel.appendRow(item)
        list.setModel(listmodel)

        # INCUBE
        ui.comboBox_2.clear()
        if model.dos:
            for dos in model.dos:
                ui.comboBox_2.addItem(dos.basename, dos)

            if plan.incube_basename:
                ui.comboBox_2.setEnabled(True)
                ui.checkBox.setChecked(True)
                _i = ui.comboBox_2.findText(dos.basename)
                if _i == -1:  # not found
                    logger.warning("_populate_plan_ui() FIXME 2")
                else:
                    ui.comboBox_2.setCurrentIndex(_i)
            else:
                plan.incube_basename = None
                ui.comboBox_2.setEnabled(False)
                ui.checkBox.setChecked(False)

        # TISSUE
        ui.comboBox_3.clear()
        ui.comboBox_3.addItem("(not implemented)")
        ui.comboBox_3.setEnabled(False)

        # RESIDUAL TISSUE
        ui.comboBox_4.clear()
        ui.comboBox_4.addItem("(not implemented)")
        ui.comboBox_4.setEnabled(False)

        # ----------- Dose Delivery Tab ---------------------------
        # TODO: Projectile
        PlanController._setup_plan_combobox(ui.comboBox_5, Plan.opt_methods)
        # TODO: Ripple filter

        # Target Dose Percent
        ui.doubleSpinBox.setValue(plan.target_dose_percent)
        ui.doubleSpinBox_4.setValue(plan.target_dose)

        # ----------- Optimization Tab ----------------------------
        # Iterations
        ui.spinBox.setValue(plan.iterations)
        ui.doubleSpinBox_2.setValue(plan.eps)
        ui.doubleSpinBox_3.setValue(plan.geps)

        PlanController._setup_plan_combobox(ui.comboBox_7, Plan.opt_methods)
        PlanController._setup_plan_combobox(ui.comboBox_8, Plan.opt_principles)
        PlanController._setup_plan_combobox(ui.comboBox_9, Plan.dose_algs)
        PlanController._setup_plan_combobox(ui.comboBox_10, Plan.bio_algs)
        PlanController._setup_plan_combobox(ui.comboBox_11, Plan.opt_algs)

        # ----------- Results Tab --------------------------------
        ui.checkBox_2.setChecked(plan.want_phys_dose)
        ui.checkBox_3.setChecked(plan.want_bio_dose)
        ui.checkBox_4.setChecked(plan.want_dlet)
        ui.checkBox_5.setChecked(plan.want_rst)
        ui.checkBox_6.setEnabled(False)
        ui.checkBox_7.setEnabled(False)
开发者ID:pytrip,项目名称:pytripgui,代码行数:98,代码来源:plan_cont.py

示例12: __init__

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def __init__(self, font, parent=None):
        super().__init__(parent, name="OS/2")

        # OS2Group = QGroupBox("OS/2 table", self)
        # OS2Group.setFlat(True)
        OS2Layout = QGridLayout(self)

        usWidthClassLabel = QLabel("usWidthClass:", self)
        self.usWidthClassDrop = QComboBox(self)
        items = [
            "None", "Ultra-condensed", "Extra-condensed", "Condensed",
            "Semi-Condensed", "Medium (normal)", "Semi-expanded", "Expanded",
            "Extra-expanded", "Ultra-expanded"]
        self.usWidthClassDrop.insertItems(0, items)
        if font.info.openTypeOS2WidthClass is not None:
            self.usWidthClassDrop.setCurrentIndex(
                font.info.openTypeOS2WidthClass)

        fsSelectionLabel = QLabel("fsSelection:", self)
        fsSelection = font.info.openTypeOS2Selection
        self.fsSelectionList = QListView(self)
        items = [
            "1 UNDERSCORE", "2 NEGATIVE", "3 OUTLINED", "4 STRIKEOUT",
            "7 USE_TYPO_METRICS", "8 WWS", "9 OBLIQUE"]
        # http://stackoverflow.com/a/26613163
        model = QStandardItemModel(7, 1)
        for index, elem in enumerate(items):
            item = QStandardItem()
            item.setText(elem)
            item.setCheckable(True)
            bit = index + 1
            if fsSelection is not None and bit in fsSelection:
                # maybe default setting? if so, unneeded
                item.setCheckState(Qt.Checked)
            else:
                item.setCheckState(Qt.Unchecked)
            model.setItem(index, item)
        self.fsSelectionList.setModel(model)

        achVendorIDLabel = QLabel("achVendorID:", self)
        self.achVendorIDEdit = QLineEdit(font.info.openTypeOS2VendorID, self)
        self.achVendorIDEdit.setMaxLength(4)

        fsTypeLabel = QLabel("fsType:", self)
        fsType = font.info.openTypeOS2Type
        self.fsTypeDrop = QComboBox(self)
        items = [
            "No embedding restrictions", "Restricted embedding",
            "Preview and print embedding allowed",
            "Editable embedding allowed"]
        self.allowSubsettingBox = QCheckBox("Allow subsetting", self)
        self.allowBitmapEmbeddingBox = QCheckBox(
            "Allow only bitmap embedding", self)
        self.fsTypeDrop.currentIndexChanged[int].connect(
            self._updateFsTypeVisibility)
        self.fsTypeDrop.insertItems(0, items)
        if fsType is not None:
            for i in range(1, 4):
                if i in fsType:
                    self.fsTypeDrop.setCurrentIndex(i)
                    break
            self.allowSubsettingBox.setChecked(8 not in fsType)
            self.allowBitmapEmbeddingBox.setChecked(9 in fsType)

        # XXX: ulUnicodeRange

        # XXX: ulCodePageRange

        sTypoAscenderLabel = QLabel("sTypoAscender:", self)
        sTypoDescenderLabel = QLabel("sTypoDescender:", self)
        sTypoLineGapLabel = QLabel("sTypoLineGap:", self)
        usWeightClassLabel = QLabel("usWeightClass:", self)
        usWinAscentLabel = QLabel("usWinAscent:", self)
        usWinDescentLabel = QLabel("usWinDescent:", self)
        ySubscriptXSizeLabel = QLabel("ySubscriptXSize:", self)
        ySubscriptYSizeLabel = QLabel("ySubscriptYSize:", self)
        ySubscriptXOffsetLabel = QLabel("ySubscriptXOffset:", self)
        ySubscriptYOffsetLabel = QLabel("ySubscriptYOffset:", self)
        ySuperscriptXSizeLabel = QLabel("ySuperscriptXSize:", self)
        ySuperscriptYSizeLabel = QLabel("ySuperscriptYSize:", self)
        ySuperscriptXOffsetLabel = QLabel("ySuperscriptXOffset:", self)
        ySuperscriptYOffsetLabel = QLabel("ySuperscriptYOffset:", self)
        yStrikeoutSizeLabel = QLabel("yStrikeoutSize:", self)
        yStrikeoutPositionLabel = QLabel("yStrikeoutPosition:", self)
        self.loadPositiveInteger(
            font, "openTypeOS2WeightClass", "usWeightClass")
        self.loadInteger(font, "openTypeOS2TypoAscender", "sTypoAscender")
        self.loadInteger(font, "openTypeOS2TypoDescender", "sTypoDescender")
        self.loadInteger(font, "openTypeOS2TypoLineGap", "sTypoLineGap")
        self.loadPositiveInteger(font, "openTypeOS2WinAscent", "usWinAscent")
        self.loadPositiveInteger(font, "openTypeOS2WinDescent", "usWinDescent")
        self.loadInteger(font, "openTypeOS2SubscriptXSize", "ySubscriptXSize")
        self.loadInteger(font, "openTypeOS2SubscriptYSize", "ySubscriptYSize")
        self.loadInteger(
            font, "openTypeOS2SubscriptXOffset", "ySubscriptXOffset")
        self.loadInteger(
            font, "openTypeOS2SubscriptYOffset", "ySubscriptYOffset")
        self.loadInteger(
            font, "openTypeOS2SuperscriptXSize", "ySuperscriptXSize")
        self.loadInteger(
#.........这里部分代码省略.........
开发者ID:pathumego,项目名称:trufont,代码行数:103,代码来源:fontInfo.py

示例13: populate

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
    def populate(self):
        """Populate the tree view with data from the installed extensions.
        """

        # TODO/Question:
        # Would it make sense to move this to a dedicated model class
        # complementing the FailedModel?

        root = self.tree.model().invisibleRootItem()
        extensions = app.extensions()
        for ext in extensions.installed_extensions():
            ext_infos = extensions.infos(ext)
            display_name = ext_infos.get(ext, ext) if ext_infos else ext.name()
            loaded_extension = extensions.get(ext)
            if loaded_extension:
                display_name += ' ({})'.format(loaded_extension.load_time())

            name_item = QStandardItem(display_name)
            name_item.extension_name = ext
            name_item.setCheckable(True)
            self.name_items[ext] = name_item
            icon = extensions.icon(ext)
            if icon:
                name_item.setIcon(icon)
            root.appendRow([name_item])
            for entry in [
                'extension-name',
                'short-description',
                'description',
                'version',
                'api-version',
                'dependencies',
                'maintainers',
                'repository',
                'website',
                'license'
            ]:
                label_item = QStandardItem('{}:'.format(
                    self.config_labels[entry]))
                label_item.setTextAlignment(Qt.AlignTop)
                bold = QFont()
                bold.setWeight(QFont.Bold)
                label_item.setFont(bold)
                details = ext_infos.get(entry, "") if ext_infos else ""
                if type(details) == list:
                    details = '\n'.join(details)
                details_item = QStandardItem(details)
                details_item.setTextAlignment(Qt.AlignTop)
                if entry == 'api-version':
                    # Check for correct(ly formatted) api-version entry
                    # and highlight it in case of mismatch
                    api_version = appinfo.extension_api
                    if not details:
                        details_item.setFont(bold)
                        details_item.setText(
                            _("Misformat: {api}").format(details))
                    elif not details == api_version:
                            details_item.setFont(bold)
                            details_item.setText('{} ({}: {})'.format(
                                details,
                                appinfo.appname,
                                api_version))
                name_item.appendRow([label_item, details_item])
开发者ID:wbsoft,项目名称:frescobaldi,代码行数:65,代码来源:extensions.py

示例14: create_new_list_item

# 需要导入模块: from PyQt5.QtGui import QStandardItem [as 别名]
# 或者: from PyQt5.QtGui.QStandardItem import setCheckable [as 别名]
def create_new_list_item(text):
    item = QStandardItem()
    item.setText(text)
    item.setCheckable(True)
    item.setEditable(False)
    return item
开发者ID:frmwrk123,项目名称:oeprint,代码行数:8,代码来源:model_helper.py


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