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


Python QTreeWidgetItem.setCheckState方法代码示例

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


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

示例1: process_duplicates

# 需要导入模块: from PyQt4.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTreeWidgetItem import setCheckState [as 别名]
    def process_duplicates(self, db, duplicates):
        ta = _('%(title)s by %(author)s')
        bf = QFont(self.dup_list.font())
        bf.setBold(True)
        itf = QFont(self.dup_list.font())
        itf.setItalic(True)

        for mi, cover, formats in duplicates:
            item = QTreeWidgetItem([ta%dict(
                title=mi.title, author=mi.format_field('authors')[1])] , 0)
            item.setCheckState(0, Qt.Checked)
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsUserCheckable)
            item.setData(0, Qt.FontRole, bf)
            item.setData(0, Qt.UserRole, (mi, cover, formats))
            matching_books = db.books_with_same_title(mi)

            def add_child(text):
                c = QTreeWidgetItem([text], 1)
                c.setFlags(Qt.ItemIsEnabled)
                item.addChild(c)
                return c

            add_child(_('Already in calibre:')).setData(0, Qt.FontRole, itf)

            for book_id in matching_books:
                aut = [a.replace('|', ',') for a in (db.authors(book_id,
                    index_is_id=True) or '').split(',')]
                add_child(ta%dict(
                    title=db.title(book_id, index_is_id=True),
                    author=authors_to_string(aut)))
            add_child('')

            yield item
开发者ID:john-peterson,项目名称:calibre,代码行数:35,代码来源:duplicates.py

示例2: create_item

# 需要导入模块: from PyQt4.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTreeWidgetItem import setCheckState [as 别名]
 def create_item(self, f, parent):
     name = f.name
     ans = QTreeWidgetItem(parent, [name])
     ans.setData(0, Qt.UserRole, '/'.join(f.full_path[1:]))
     ans.setFlags(Qt.ItemIsUserCheckable | Qt.ItemIsEnabled)
     ans.setCheckState(0,
         Qt.Unchecked if self.dev.is_folder_ignored(f.storage_id, f.full_path[1:]) else Qt.Checked)
     ans.setData(0, Qt.DecorationRole, file_icon_provider().icon_from_ext('dir'))
     return ans
开发者ID:089git,项目名称:calibre,代码行数:11,代码来源:mtp_folder_browser.py

示例3: readControlFile

# 需要导入模块: from PyQt4.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTreeWidgetItem import setCheckState [as 别名]
    def readControlFile(self, filename):
        self.control = controlPoints(self.N,filename)
#         obs=obsSplit(obs)
        for x,y in self.control.iteritems():
            #print coord
            item = QTreeWidgetItem(self.treeControl)
            item.setText(0, x)
            item.setText(1, str(round(y.y,3)))
            item.setText(2, str(round(y.x,3)))
            item.setText(3, str(round(y.h,3)))
            item.setCheckState(0, Qt.Checked)
开发者ID:CraigNielsen,项目名称:LeastSquaresGui,代码行数:13,代码来源:main1.py

示例4: process_duplicates

# 需要导入模块: from PyQt4.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTreeWidgetItem import setCheckState [as 别名]
    def process_duplicates(self, db, duplicates):
        ta = _('%(title)s by %(author)s [%(formats)s]')
        bf = QFont(self.dup_list.font())
        bf.setBold(True)
        itf = QFont(self.dup_list.font())
        itf.setItalic(True)

        for mi, cover, formats in duplicates:
            # formats is a list of file paths
            # Grab just the extension and display to the user
            # Based only off the file name, no file type tests are done.
            incoming_formats = ', '.join(os.path.splitext(path)[-1].replace('.', '').upper() for path in formats)
            item = QTreeWidgetItem([ta%dict(
                title=mi.title, author=mi.format_field('authors')[1],
                formats=incoming_formats)] , 0)
            item.setCheckState(0, Qt.Checked)
            item.setFlags(Qt.ItemIsEnabled|Qt.ItemIsUserCheckable)
            item.setData(0, Qt.FontRole, bf)
            item.setData(0, Qt.UserRole, (mi, cover, formats))
            matching_books = db.books_with_same_title(mi)

            def add_child(text):
                c = QTreeWidgetItem([text], 1)
                c.setFlags(Qt.ItemIsEnabled)
                item.addChild(c)
                return c

            add_child(_('Already in calibre:')).setData(0, Qt.FontRole, itf)

            for book_id in matching_books:
                aut = [a.replace('|', ',') for a in (db.authors(book_id,
                    index_is_id=True) or '').split(',')]
                add_child(ta%dict(
                    title=db.title(book_id, index_is_id=True),
                    author=authors_to_string(aut),
                    formats=db.formats(book_id, index_is_id=True,
                                       verify_formats=False)))
            add_child('')

            yield item
开发者ID:089git,项目名称:calibre,代码行数:42,代码来源:duplicates.py

示例5: readObsFile

# 需要导入模块: from PyQt4.Qt import QTreeWidgetItem [as 别名]
# 或者: from PyQt4.Qt.QTreeWidgetItem import setCheckState [as 别名]
 def readObsFile(self, filename):
     self.N,self.stationsOrder,self.obsOrder = Observations(filename)
     N=self.N
     self.obs1,self.ObsList=getObs(N)
     self.obs=obsSplit(self.obs1)
     for name in self.stationsOrder:
         item = QTreeWidgetItem(self.treeObs)
         item.setText(0, name)
         
         for t,j in self.obs[name].iteritems():
             subitem=QTreeWidgetItem(item)
             subitem.setText(1, t[0:-2])
             if j.type=='direction':
                 subitem.setText(2,str( rad2dms(j.direction))) 
                 subitem.setCheckState(0, Qt.Checked)          
             if j.type=='distance':
                 subitem.setCheckState(0, Qt.Checked)
                 subitem.setText(3, str(j.distance))
             if j.type=='both':
                 subitem.setText(2,str( rad2dms(j.direction))) 
                 subitem.setCheckState(0, Qt.Checked)
                 subitem.setText(3, str(j.distance))
             item.setCheckState(0, Qt.Checked)
开发者ID:CraigNielsen,项目名称:LeastSquaresGui,代码行数:25,代码来源:main1.py


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