本文整理汇总了Python中BAL.Devices.Relay.Relay.fromDict方法的典型用法代码示例。如果您正苦于以下问题:Python Relay.fromDict方法的具体用法?Python Relay.fromDict怎么用?Python Relay.fromDict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAL.Devices.Relay.Relay
的用法示例。
在下文中一共展示了Relay.fromDict方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from BAL.Devices.Relay import Relay [as 别名]
# 或者: from BAL.Devices.Relay.Relay import fromDict [as 别名]
#.........这里部分代码省略.........
def load(self):
pkg = rospkg.RosPack().get_path("ric_board")
fileName = QFileDialog.getOpenFileName(self, self.tr("Load File"), "%s/DATA" % pkg, self.tr("RiC File (*.RIC)"))
if fileName != "":
self.new()
self.override = False
load = open(fileName)
data = pickle.load(load)
self._fileName = data[0]
self._ns = data[1]
yaml = open("%s/config/%s.yaml" % (pkg, self._fileName))
conDev = yaml.readline().split(": ")[1][:-1]
allDevs = [str(self.ConPortList.itemText(i)) for i in xrange(self.ConPortList.count())]
for i in xrange(len(allDevs)):
if conDev == allDevs[i]:
self.ConPortList.setCurrentIndex(i)
break
self.nameSpace.setText(self._ns)
self.fileName.setText(self._fileName)
devices = data[2]
# print devices
for dev in devices:
if dev["type"] == BATTERY:
self.currentShowDev = Battery(self.DevFrame, self.data)
self.currentShowDev.fromDict(dev)
elif dev["type"] == SERVO:
self.currentShowDev = Servo(self.DevFrame, self.data, self.servoPorts)
self.currentShowDev.fromDict(dev)
self.servoPorts.removeItem(self.currentShowDev.findItem())
elif dev["type"] == SWITCH:
self.currentShowDev = Switch(self.DevFrame, self.data, self.switchPorts)
self.currentShowDev.fromDict(dev)
self.switchPorts.removeItem(self.currentShowDev.findItem())
elif dev["type"] == IMU:
self.currentShowDev = Imu(self.DevFrame, self.data)
self.currentShowDev.fromDict(dev)
elif dev["type"] == PPM:
self.currentShowDev = Ppm(self.DevFrame, self.data)
self.currentShowDev.fromDict(dev)
elif dev["type"] == GPS:
self.currentShowDev = Gps(self.DevFrame, self.data)
self.currentShowDev.fromDict(dev)
elif dev["type"] == RELAY:
self.currentShowDev = Relay(self.DevFrame, self.data, self.relayPorts)
self.currentShowDev.fromDict(dev)
self.relayPorts.removeItem(self.currentShowDev.findItem())
elif dev["type"] == URF:
self.currentShowDev = Urf(self.DevFrame, self.data, self.urfPorts)
self.currentShowDev.fromDict(dev)
self.urfPorts.removeItem(self.currentShowDev.findItem())
elif dev["type"] == CLOSE_LOP_ONE:
self.currentShowDev = CloseLoop(self.DevFrame, self.data, self.encoders)
self.currentShowDev.fromDict(dev)
self.encoders.removeItem(self.currentShowDev.findItem())
elif dev["type"] == CLOSE_LOP_TWO:
self.currentShowDev = CloseLoopTwo(self.DevFrame, self.data, self.encoders)
self.currentShowDev.fromDict(dev)