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


Python Relay.getEncoders方法代码示例

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


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

示例1: MainWindow

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

#.........这里部分代码省略.........

    def fileNameEven(self, text):
        self._fileName = str(text)
        self.pushButton_2.setEnabled(False)

    def devDelete(self):
        if self.currentShowDev.getDevType() == SERVO:
            self.servoPorts.addItem(self.currentShowDev.getPort())
        if self.currentShowDev.getDevType() == BATTERY:
            self.haveBattery = False
        if self.currentShowDev.getDevType() == SWITCH:
            self.switchPorts.addItem(self.currentShowDev.getPort())
        if self.currentShowDev.getDevType() == IMU:
            self.haveIMU = False
        if self.currentShowDev.getDevType() == PPM:
            self.havePPM = False
        if self.currentShowDev.getDevType() == GPS:
            self.haveGPS = False
        if self.currentShowDev.getDevType() == RELAY:
            self.relayPorts.addItem(self.currentShowDev.getPort())
        if self.currentShowDev.getDevType() == URF:
            self.urfPorts.addItem(self.currentShowDev.getPort())
        if self.currentShowDev.getDevType() == CLOSE_LOP_ONE:
            if self.haveDiff:
                QMessageBox.critical(self, "Error", "Can't delete a motor while differential drive is present")
                return
            self.motors.remove(self.currentShowDev.getName())
            self.encoders.addItem(self.currentShowDev.getEncoder())
        if self.currentShowDev.getDevType() == CLOSE_LOP_TWO:
            if self.haveDiff:
                QMessageBox.critical(self, "Error", "Can't delete a motor while differential drive is present")
                return
            self.motors.remove(self.currentShowDev.getName())
            self.encoders.addItem(self.currentShowDev.getEncoders()[0])
            self.encoders.addItem(self.currentShowDev.getEncoders()[1])
        if self.currentShowDev.getDevType() == OPEN_LOP:
            if self.haveDiff:
                QMessageBox.critical(self, "Error", "Can't delete a motor while differential drive is present")
                return
            self.motors.remove(self.currentShowDev.getName())
        if (
            self.currentShowDev.getDevType() == DIFF_CLOSE
            or self.currentShowDev.getDevType() == DIFF_OPEN
            or self.currentShowDev.getDevType() == DIFF_CLOSE_FOUR
        ):
            self.haveDiff = False
            self.diffEnable = False

        self.data.remove(self.currentShowDev)
        self.devList.takeItem(self.devList.currentRow())
        self.removeAllFields()

        if len(self.motors) == 0 and self.haveCloseLoop:
            self.haveCloseLoop = False
        if len(self.motors) == 0 and self.haveOpenLoop:
            self.haveOpenLoop = False

        self.Edit.clicked.disconnect(self.devEdit)
        self.Delete.clicked.disconnect(self.devDelete)
        self.listMode = False

    def devEdit(self):
        self.interruptHandler()
        self.editMode = True
        if self.currentShowDev.getDevType() == SERVO:
            self.servoPorts.addItem(self.currentShowDev.getPort())
开发者ID:nirlevi5,项目名称:bgumodo_ws,代码行数:70,代码来源:MainWindow.py


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