本文整理汇总了Python中BAL.Devices.Relay.Relay.isValid方法的典型用法代码示例。如果您正苦于以下问题:Python Relay.isValid方法的具体用法?Python Relay.isValid怎么用?Python Relay.isValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAL.Devices.Relay.Relay
的用法示例。
在下文中一共展示了Relay.isValid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from BAL.Devices.Relay import Relay [as 别名]
# 或者: from BAL.Devices.Relay.Relay import isValid [as 别名]
#.........这里部分代码省略.........
if self.currentShowDev.getDevType() == CLOSE_LOP_ONE:
self.encoders.addItem(self.currentShowDev.getEncoder())
if self.currentShowDev.getDevType() == CLOSE_LOP_TWO:
self.encoders.addItem(self.currentShowDev.getEncoders()[0])
self.encoders.addItem(self.currentShowDev.getEncoders()[1])
self.currentShowDev.showDetails()
self.pushButton.clicked.connect(self.editList)
def removeAllFields(self):
for i in xrange(self.DevFrame.layout().count()):
self.DevFrame.layout().itemAt(i).widget().deleteLater()
def interruptHandler(self):
self.removeAllFields()
if self.listMode:
self.Edit.clicked.disconnect(self.devEdit)
self.Delete.clicked.disconnect(self.devDelete)
self.saveStatus.clicked.disconnect(self.changeDevSaveStatus)
self.listMode = False
if self.editMode:
self.pushButton.clicked.disconnect(self.editList)
if self.currentShowDev.getDevType() == SERVO:
self.servoPorts.removeItem(self.currentShowDev.findItem())
if self.currentShowDev.getDevType() == SWITCH:
self.switchPorts.removeItem(self.currentShowDev.findItem())
if self.currentShowDev.getDevType() == RELAY:
self.relayPorts.removeItem(self.currentShowDev.findItem())
if self.currentShowDev.getDevType() == URF:
self.urfPorts.removeItem(self.currentShowDev.findItem())
if self.currentShowDev.getDevType() == CLOSE_LOP_ONE:
self.encoders.removeItem(self.currentShowDev.findItem())
if self.currentShowDev.getDevType() == CLOSE_LOP_TWO:
self.encoders.removeItem(self.currentShowDev.findItem())
self.encoders.removeItem(self.currentShowDev.findItem2())
self.editMode = False
if self.newDevMode:
self.pushButton.clicked.disconnect(self.addDevToList)
self.newDevMode = False
def removeFields(self):
if self.currentShowDev.isValid():
self.removeAllFields()
self.pushButton.clicked.disconnect(self.removeFields)
self.newDevMode = False
def addDevToList(self):
self.currentShowDev.add()
if self.currentShowDev.isValid():
if self.currentShowDev.getDevType() == BATTERY:
self.haveBattery = True
if self.currentShowDev.getDevType() == IMU:
self.haveIMU = True
if self.currentShowDev.getDevType() == PPM:
self.havePPM = True
if self.currentShowDev.getDevType() == GPS:
self.haveGPS = True
if (self.currentShowDev.getDevType() == CLOSE_LOP_ONE) or (
self.currentShowDev.getDevType() == CLOSE_LOP_TWO
):
self.haveCloseLoop = True
self.motors.append(self.currentShowDev.getName())
if self.currentShowDev.getDevType() == OPEN_LOP:
self.haveOpenLoop = True
self.motors.append(self.currentShowDev.getName())
if (
self.currentShowDev.getDevType() == DIFF_CLOSE
or self.currentShowDev.getDevType() == DIFF_OPEN
or self.currentShowDev.getDevType() == DIFF_CLOSE_FOUR
):
self.haveDiff = True
self.diffEnable = True
self.devList.addItem(QListWidgetItem(self.currentShowDev.getName()))
self.data.append(self.currentShowDev)
self.removeAllFields()
self.currentShowDev = None
self.pushButton.clicked.disconnect(self.addDevToList)
self.newDevMode = False
def editList(self):
oldName = self.currentShowDev.getName()
self.currentShowDev.add()
if self.currentShowDev.isValid():
self.devList.currentItem().setText(self.currentShowDev.getName())
self.data[self.devList.currentRow()] = self.currentShowDev
if (
self.currentShowDev.getDevType() == OPEN_LOP
or self.currentShowDev.getDevType() == CLOSE_LOP_ONE
or self.currentShowDev.getDevType() == CLOSE_LOP_TWO
):
for i in xrange(len(self.motors)):
if self.motors[i] == oldName:
self.motors[i] = self.currentShowDev.getName()
break
self.removeAllFields()
self.currentShowDev = None
self.pushButton.clicked.disconnect(self.editList)
self.editMode = False