use Properties from secop.properties for datatypes
this change is triggered by the fact, that assigining a unit
in the config file did no longer work.
this change has several implications:
1) secop.properties must not import secop.datatypes:
- as ValueType can not be imported, the default behaviour with
'mandatory' and 'default' arguments was slightly changed
- instead of checking for DataType when exporting, a try/except
was used
2) the datatype of datatype properties is sometimes not yet defined.
a stub is used in this cases instead, which is later replaced by
the proper datatype. The number of stubs may be reduced, but this
should be done in a later change, as the diff will be much less
readable.
3) in config files, datatype properties can be changed like parameter
properties. HasProperties.setProperties/checkProperties/getProperties
are overridden for this.
the config editor seems still to work, an issue (probably py3) had
to be fixed there
Change-Id: I1efddf51f2c760510e913dbcaa099e8a89c9cab5
Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21399
Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de>
Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@@ -57,22 +57,22 @@ def write_config(file_name, tree_widget):
|
||||
blank_lines += 1
|
||||
value = value.replace('\n\n', '\n.\n')
|
||||
value = value.replace('\n', '\n ')
|
||||
itm_lines[itm] = '[%s %s]\n' % (itm.kind, itm.name) +\
|
||||
itm_lines[id(itm)] = '[%s %s]\n' % (itm.kind, itm.name) +\
|
||||
value_str % (SECTIONS[itm.kind], value)
|
||||
# TODO params and props
|
||||
elif itm.kind == PARAMETER and value:
|
||||
itm_lines[itm] = value_str % (itm.name, value)
|
||||
itm_lines[id(itm)] = value_str % (itm.name, value)
|
||||
elif itm.kind == PROPERTY:
|
||||
prop_name = '.%s' % itm.name
|
||||
if par.kind == PARAMETER:
|
||||
prop_name = par.name + prop_name
|
||||
itm_lines[itm] = value_str % (prop_name, value)
|
||||
itm_lines[id(itm)] = value_str % (prop_name, value)
|
||||
elif itm.kind == COMMENT:
|
||||
temp_itm_lines = OrderedDict()
|
||||
for key, dict_value in itm_lines.items():
|
||||
if key == par:
|
||||
if key == id(par):
|
||||
value = value.replace('\n', '\n# ')
|
||||
temp_itm_lines[itm] = '# %s' % value
|
||||
temp_itm_lines[id(itm)] = '# %s' % value
|
||||
temp_itm_lines[key] = dict_value
|
||||
itm_lines.clear()
|
||||
itm_lines.update(temp_itm_lines)
|
||||
|
||||
Reference in New Issue
Block a user