Commit c8415f5f authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Install errCode as a standalone command

parent 289c8f41
......@@ -8,4 +8,5 @@
import asn1_value_editor
import gui
import errCode
__version__ = asn1_value_editor.__version__
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
This module extracts the error code and corresponding message from
the files generated by ASN1SCC. Used by the ASN.1 Value editor to
......@@ -9,20 +9,26 @@
import re
import sys
if len(sys.argv) != 2:
print 'usage: errCodes.py dataview.h'
sys.exit(-1)
def errCode():
''' Get error codes from provided data view include file '''
if len(sys.argv) != 2:
print 'usage: errCodes.py dataview.h'
return -1
f = open (sys.argv[1], 'r')
f = open (sys.argv[1], 'r')
errCodes = {}
errCodes = {}
for line in f.readlines():
if line.startswith('#define ERR'):
errName=re.search('(ERR_)(?P<A>\w*)',line).group('A')
errValue=int(re.search('[0-9]+',line).group(0))
const=re.search('(/\*\s*)(?P<A>[\S\s]*)(\*/)',line).group('A').strip()
errCodes[errValue]={'name':errName, 'constraint':const}
for line in f.readlines():
if line.startswith('#define ERR'):
errName=re.search('(ERR_)(?P<A>\w*)',line).group('A')
errValue=int(re.search('[0-9]+',line).group(0))
const=re.search('(/\*\s*)(?P<A>[\S\s]*)(\*/)',line).group('A').strip()
errCodes[errValue]={'name':errName, 'constraint':const}
print errCodes
return 0
print errCodes
if __name__ == '__main__':
sys.exit(gui())
......@@ -57,7 +57,7 @@ import resources
from mscHandler import mscHandler
from PySide.QtCore import QThread, QFile, Qt, Signal
from PySide.QtCore import QThread, QFile, Qt, Signal, QObject
from PySide.QtGui import(QApplication, QStatusBar, QLabel, QWidget,
QListWidget, QPushButton, QDockWidget, QTabWidget, QMenu, QAction)
......@@ -313,6 +313,13 @@ def gui():
editor.hideExtraColumns()
# Import the backend generated by the pyside_B_mapper from aadl2glueC
encoder_backend = __import__("%s_backend" % editor.objectName())
# Set the callbacks in the backend to forward incoming TM to the GUI
encoder_backend.editor = editor
TMHandler = type('TMHandler', (QObject,), {'got_tm': Signal()})
encoder_backend.tm_callback = TMHandler()
encoder_backend.tm_callback.got_tm.connect(editor.receivedTM)
encoder_backend.log = log
encoder_backend.statusbar = statusbar
editor.statusBarMessage.connect(statusbar.showMessage)
......@@ -371,7 +378,7 @@ def gui():
udp.tmPool = g_tmPool
udp.start(hasTM)
elif dll:
# TODO Should register the TMs callbacks
# Nothing to do, the TM callbacks have already been connected (above)
pass
# Associate the plotter manager to the main app
......
......@@ -36,4 +36,5 @@
/usr/local/lib/python2.7/dist-packages/asn1_value_editor-1.0-py2.7.egg/EGG-INFO/not-zip-safe
/usr/local/lib/python2.7/dist-packages/asn1_value_editor-1.0-py2.7.egg/EGG-INFO/SOURCES.txt
/usr/local/lib/python2.7/dist-packages/asn1_value_editor-1.0-py2.7.egg/EGG-INFO/top_level.txt
/usr/local/bin/taste_gui
/usr/local/bin/taste-asn1-errCodes
/usr/local/bin/taste-gui
......@@ -2,7 +2,7 @@
# Resource object code
#
# Created: Sun Nov 16 14:02:35 2014
# Created: Wed Nov 19 21:57:01 2014
# by: The Resource Compiler for PySide (Qt v4.8.6)
#
# WARNING! All changes made in this file will be lost!
......
......@@ -29,7 +29,8 @@ setup(
],
entry_points={
'console_scripts': [
'taste_gui = asn1_value_editor.gui:gui'
'taste-gui = asn1_value_editor.gui:gui',
'taste-asn1-errCodes = asn1_value_editor.errCode:errCode'
]
},
)
Supports Markdown
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