Commit f8112a1c authored by Michael Büsch's avatar Michael Büsch

gui/interfedit: Automatically sanitize types

Signed-off-by: Michael Büsch's avatarMichael Buesch <m@bues.ch>
parent 2a047b8b
......@@ -24,6 +24,8 @@ from awlsim.common.compat import *
from awlsim.common.xmlfactory import *
from awlsim.core.datatypes import *
from awlsim.gui.interfedit.interfdef import *
from awlsim.gui.util import *
......@@ -579,7 +581,18 @@ class AwlInterfaceModel(AbstractTableModel):
if self.__isColumn_name(column):
field.name = value.strip()
elif self.__isColumn_type(column):
field.typeStr = value.strip()
# Try to parse the type and use the actual type name
# But only do this, if the type does not start with
# a space. This way the user can disable
# this automatic matching.
if not value.startswith(" "):
try:
dataType = AwlDataType.makeByName(value.split())
if dataType:
value = str(dataType)
except AwlSimError as e:
pass
field.typeStr = value
elif self.__isColumn_initValue(column):
field.initValueStr = value
elif self.__isColumn_comment(column):
......
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