本文整理汇总了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.')