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


Python HardwareRepository.isDevice方法代码示例

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


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

示例1: fill

# 需要导入模块: from HardwareRepository import HardwareRepository [as 别名]
# 或者: from HardwareRepository.HardwareRepository import isDevice [as 别名]
    def fill(self):
        #
        # fill Hardware Objects tree
        #
        _instance = HardwareRepository()

        self.treeNodes = {}
        self.itemStates = {}

        self.hardwareObjectsTree.clear()
        self.root = QListViewItem(self.hardwareObjectsTree, 'Hardware Repository')

        if _instance is not None:
            filesgen = _instance.getHardwareRepositoryFiles()
            
            for name, file in filesgen:
                #
                # every name begins with '/'
                #
                dirnames = name.split('/')[1:]
                objectName = dirnames.pop()

                parent = self.root
                for dir in dirnames:
                    if dir in self.treeNodes:
                        parent = self.treeNodes[dir]
                    else:
                        newNode =  QListViewItem(parent, dir)
                        self.treeNodes[dir] = newNode
                        newNode.setPixmap(0, QPixmap(self.folderClosed))
                        parent = newNode

                newLeaf = QCheckListItem(parent, objectName, QCheckListItem.CheckBox)
                newLeaf.setText(2, name)
                    
                if _instance.hasHardwareObject(name):
                    newLeaf.setOn(True)
                    self.itemStates[name] = True

                    if _instance.isDevice(name):
                        newLeaf.setText(1, 'Device')
                    elif _instance.isEquipment(name):
                        newLeaf.setText(1, 'Equipment')
                    elif _instance.isProcedure(name):
                        newLeaf.setText(1, 'Procedure')
                else:
                    self.itemStates[name] = False
                        
            self.root.setOpen(True)
            self.hardwareObjectsTree.sort()
        else:
            logging.getLogger('HWR').error('Cannot get Hardware Repository files : not connected to server.')
开发者ID:MAXLABMX,项目名称:HardwareRepository,代码行数:54,代码来源:HardwareRepositoryBrowser.py


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