Commit aed1c704 authored by Maxime Perrotin's avatar Maxime Perrotin

Fix checks for type case

parent 222c849f
......@@ -14,7 +14,7 @@
This version needs ASN.1 version 3.x.x
Copyright (c) 2012-2015 European Space Agency
Copyright (c) 2012-2017 European Space Agency
Designed and implemented by Maxime Perrotin
......@@ -242,7 +242,14 @@ class SingleValueEditor(QObject):
self.widgets[name] = {'widget': loader.load(uiFile)}
uiFile.close()
widget = self.widgets[name]['widget']
pyType = self.tc[name.replace('_', '-')]
for tc in self.tc.iterkeys():
if tc.lower().replace('_', '-') == name.lower().replace('_', '-'):
tcNameWithCase = tc
break
else:
raise TypeError ("No type named {} is defined in the ASN.1 model"
.format(name))
pyType = self.tc[tcNameWithCase]
self.widgets[name]['editor'] = widget.findChild(asn1Editor, 'ASN1EDITOR')
self.widgets[name]['editor'].log = logger
okButton = widget.findChild(QToolButton, 'okButton')
......@@ -266,6 +273,7 @@ class SingleValueEditor(QObject):
widget = self.widgets[param]
# Create a ctypes instance of the variable and set it to the editor
# print dir(self.asn1ctypes), self.asn1ctypes.__file__
instance = getattr(self.asn1ctypes, asnType.replace('-', '_'))()
widget['editor'].asn1Instance = instance
logger.info('Created instance of ' + asnType)
......
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