def setSdrRoot(self, sdrroot):
self.nodeTreeWidget.clear()
nodepath = os.path.join(sdrroot, 'dev/nodes/*/DeviceManager.dcd.xml')
for dcdfile in glob.glob(nodepath):
try:
node = dcd.parse(dcdfile)
name = node.get_name()
domain = node.get_domainmanager().get_namingservice().get_name()
domain = domain.split('/')[-1]
dcdfile = dcdfile.replace(os.path.join(sdrroot,'dev'), '')
# Add the node to the tree widget, including the default domain
# as a hidden column
QtGui.QTreeWidgetItem(self.nodeTreeWidget, [name, dcdfile, domain])
except:
pass
# Readjust the column widths to ensure that the entire name is shown
# and that the scollbar allows viewing the entire DCD filename
self.nodeTreeWidget.resizeColumnToContents(0)
self.nodeTreeWidget.resizeColumnToContents(1)
# Sort alphabetically by name
self.nodeTreeWidget.sortByColumn(0, 0)
评论列表
文章目录