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


Python Relay.findItem方法代码示例

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


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

示例1: MainWindow

# 需要导入模块: from BAL.Devices.Relay import Relay [as 别名]
# 或者: from BAL.Devices.Relay.Relay import findItem [as 别名]

#.........这里部分代码省略.........
            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)
                    self.encoders.removeItem(self.currentShowDev.findItem())
                    self.encoders.removeItem(self.currentShowDev.findItem2())
                elif dev["type"] == OPEN_LOP:
                    self.currentShowDev = OpenLoop(self.DevFrame, self.data)
开发者ID:nirlevi5,项目名称:bgumodo_ws,代码行数:70,代码来源:MainWindow.py


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