Commit 206c7f57 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Remove old Load/Save TC buttons

Preffered way to load and save telecommands is to connect to a sql
database (provided by taste)
parent 44d14137
......@@ -629,25 +629,26 @@ class asn1Editor(QTreeView):
#pythonVar = self.backend.fromASN1ToPyside(native_tm)
#self.tmToEditor(pythonVar)
def saveTC(self):
''' Encode the data using GSER (ASN.1 Value Notation) and save it
to a file'''
name = self.treeItem.text()
gser = self.gser(use_dash=True)
self.log.debug('Saving ' + gser)
filename = QFileDialog.getSaveFileName(self,
"Save TC",
".",
"ASN.1 Variable (*.tc)")[0]
try:
if filename.split('.')[-1] != 'tc':
filename += ".tc"
tcFile = QFile(filename)
tcFile.open(QIODevice.WriteOnly | QIODevice.Text)
tcFile.write(str(gser))
tcFile.close()
except:
pass
# def saveTC(self):
# DEPRECATED - Load/Save TC must be done with databases
# ''' Encode the data using GSER (ASN.1 Value Notation) and save it
# to a file'''
# name = self.treeItem.text()
# gser = self.gser(use_dash=True)
# self.log.debug('Saving ' + gser)
# filename = QFileDialog.getSaveFileName(self,
# "Save TC",
# ".",
# "ASN.1 Variable (*.tc)")[0]
# try:
# if filename.split('.')[-1] != 'tc':
# filename += ".tc"
# tcFile = QFile(filename)
# tcFile.open(QIODevice.WriteOnly | QIODevice.Text)
# tcFile.write(str(gser))
# tcFile.close()
# except:
# pass
def gser(self, use_dash=False):
''' Helper API function: return the GSER representation of the data '''
......@@ -676,23 +677,28 @@ class asn1Editor(QTreeView):
self.msc.emit('out', msg)
self.backend.sendTC(self.asn1Instance)
def loadTC(self):
''' Load/Decode a TC and populate the values in the model '''
filename = QFileDialog.getOpenFileName(self,
"Open TC",
".",
"ASN.1 Variable (*.tc)")[0]
if len(filename) == 0:
return
try:
tcFile = QFile(filename)
tcFile.open(QIODevice.ReadOnly | QIODevice.Text)
asnVN = str(tcFile.readData(tcFile.size()))
tcFile.close()
pythonVar = vn.fromValueNotationToPySide(self.treeItem.text(), asnVN)
self.updateVariable(pythonVar)
except:
pass
# def loadTC(self, dest=None):
# DEPRECATED / Load/Save of TC must be done with databases
# ''' Load/Decode a TC and populate the values in the model '''
# dest = dest or self.asn1Instance
# filename = QFileDialog.getOpenFileName(self,
# "Open TC",
# ".",
# "ASN.1 Variable (*.tc)")[0]
# if len(filename) == 0:
# return
# try:
# tcFile = QFile(filename)
# tcFile.open(QIODevice.ReadOnly | QIODevice.Text)
# asnVN = str(tcFile.readData(tcFile.size()))
# tcFile.close()
# vn.valueNotationToCTypes(gser=asnVN,
# dest=dest,
# sort=,
# ASN1Mod=,
# ASN1_AST=)
# except:
# self.log.error('TC not loaded')
def dataPath(self, idx):
''' Create a textual representation of a field path
......
......@@ -456,9 +456,13 @@ def gui():
encoder_backend.udpController = udp
for button in myButtons:
if button.objectName() == 'saveButton':
button.clicked.connect(editor.saveTC)
# DEPRECATED - Use databases to load/save TC
button.hide()
#button.clicked.connect(editor.saveTC)
elif button.objectName() == 'loadButton':
button.clicked.connect(editor.loadTC)
# DEPRECATED - Use databases to load/save TC
button.hide()
#button.clicked.connect(editor.loadTC)
elif button.objectName() == 'sendButton':
button.clicked.connect(editor.sendTC)
if dll:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment