本文整理汇总了Python中component.Component.get_name方法的典型用法代码示例。如果您正苦于以下问题:Python Component.get_name方法的具体用法?Python Component.get_name怎么用?Python Component.get_name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类component.Component
的用法示例。
在下文中一共展示了Component.get_name方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load
# 需要导入模块: from component import Component [as 别名]
# 或者: from component.Component import get_name [as 别名]
def load(self, filename, host="localhost", port=6499):
print "Tuner.load " + str(port)
basename = os.path.basename(str(filename))
fileroot, ext = os.path.splitext(basename)
if filename == "":
error = QtGui.QErrorMessage(self)
error.showMessage( "Error, you must specify an autopilot.xml config file name" )
return
elif not os.path.exists(filename):
error = QtGui.QErrorMessage(self)
error.showMessage( filename + ": does not exist" )
return
try:
self.xml = ET.parse(filename)
except:
error = QtGui.QErrorMessage(self)
error.showMessage( filename + ": xml parse error:\n"
+ str(sys.exc_info()[1]) )
return
self.filename = str(filename)
self.fileroot, ext = os.path.splitext(self.filename)
root = self.xml.getroot()
# Route follow parameters
self.L1 = L1Controller(changefunc=self.onChange, host=host, port=port)
self.L1.parse_xml( root.find('L1_controller') )
self.tabs.addTab( self.L1.get_widget(), "L1" )
# PID controller parameters
for i,pid_node in enumerate(root.findall('component')):
e = pid_node.find('module')
if e != None and e.text != None:
comp_type = e.text
else:
comp_type = 'unknown'
print "component found:", comp_type
if comp_type == 'pid_component':
pid = Component(index=i, changefunc=self.onChange, host=host,
port=port, type="pid")
elif comp_type == 'pid_vel_component':
pid = Component(index=i, changefunc=self.onChange, host=host,
port=port, type="vel")
else:
print "unknown ..."
next
pid.parse_xml(pid_node)
self.components.append(pid)
self.tabs.addTab( pid.get_widget(), pid.get_name() )