本文整理汇总了Python中BAL.Devices.Relay.Relay.isToSave方法的典型用法代码示例。如果您正苦于以下问题:Python Relay.isToSave方法的具体用法?Python Relay.isToSave怎么用?Python Relay.isToSave使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BAL.Devices.Relay.Relay
的用法示例。
在下文中一共展示了Relay.isToSave方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainWindow
# 需要导入模块: from BAL.Devices.Relay import Relay [as 别名]
# 或者: from BAL.Devices.Relay.Relay import isToSave [as 别名]
#.........这里部分代码省略.........
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.currentShowDev = None
self.pushButton_2.setEnabled(True)
def save(self):
pkg = rospkg.RosPack().get_path("ric_board")
if len(self.data) == 0:
QMessageBox.critical(self, "File error", "Can not save a empty file.")
return
if self._fileName == "":
QMessageBox.critical(self, "File error", "Can not save file without a name.")
return
if not self.override:
ans = QMessageBox.question(
self, "Override", "Do you want to override this file", QMessageBox.Yes | QMessageBox.No
)
if ans == QMessageBox.Yes:
self.override = True
else:
return
parent = self.root
if self._ns != "":
parent = SubElement(self.root, "group", {"ns": self._ns})
for dev in self.data:
if dev.getDevType() != EX_DEV and dev.isToSave():
at = {"pkg": "ric_board", "type": "Start.py", "name": "RiCTraffic", "output": "screen"}
SubElement(parent, "node", at)
break
initDiffClose = "0"
initDiffOpen = "0"
initDiffCloseFour = "0"
initIMU = "0"
initGPS = "0"
initPPM = "0"
initBAT = "0"
toSave = open("%s/config/%s.yaml" % (pkg, self._fileName), "w")
launch = open("%s/launch/%s.launch" % (pkg, self._fileName), "w")
if str(self.ConPortList.currentText()) != "":
toSave.write("CON_PORT: %s\n" % str(self.ConPortList.currentText()))
else:
toSave.write("CON_PORT: RiCBoard\n")
toSave.write("FILE_NAME: %s\n" % self._fileName)
for dev in self.data:
if dev.isToSave():
if dev.getDevType() == EX_DEV:
# if dev.toDict()['type'] == ROBOT_MODEL: dev.saveToFile(self.root)
# else: dev.saveToFile(parent)
dev.saveToFile(parent)
else:
dev.saveToFile(toSave)
if dev.getDevType() == DIFF_OPEN:
initDiffOpen = "1"
elif dev.getDevType() == DIFF_CLOSE:
initDiffClose = "1"
elif dev.getDevType() == DIFF_CLOSE_FOUR: