本文整理汇总了Python中BAL.Devices.Relay.Relay.getEncoder方法的典型用法代码示例。如果您正苦于以下问题:Python Relay.getEncoder方法的具体用法?Python Relay.getEncoder怎么用?Python Relay.getEncoder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAL.Devices.Relay.Relay
的用法示例。
在下文中一共展示了Relay.getEncoder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from BAL.Devices.Relay import Relay [as 别名]
# 或者: from BAL.Devices.Relay.Relay import getEncoder [as 别名]
#.........这里部分代码省略.........
else:
self.devList.item(index).setForeground(QColor(0, 0, 0))
self.currentShowDev.setToSave(True)
def namespaceEven(self, text):
self._ns = str(text)
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