change interfaces_class to interface_classes
according to the newset SECoP syntax accept both namings on the client side Change-Id: I23abfa163d189044d997b715c912359158c16e42 Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/21478 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
parent
98f87f1306
commit
1768aaefaa
@ -383,6 +383,11 @@ class Client:
|
||||
describing_data = self._decode_substruct(
|
||||
['modules'], describing_data)
|
||||
for modname, module in list(describing_data['modules'].items()):
|
||||
# convert old namings of interface_classes
|
||||
if 'interface_class' in module:
|
||||
module['interface_classes'] = module.pop('interface_class')
|
||||
elif 'interfaces' in module:
|
||||
module['interface_classes'] = module.pop('interfaces')
|
||||
describing_data['modules'][modname] = self._decode_substruct(
|
||||
['accessibles'], module)
|
||||
|
||||
@ -551,7 +556,7 @@ class Client:
|
||||
return self.describing_data['modules'][module]['properties']
|
||||
|
||||
def getModuleBaseClass(self, module):
|
||||
return self.getModuleProperties(module)['interface_class']
|
||||
return self.getModuleProperties(module)['interface_classes']
|
||||
|
||||
def getCommands(self, module):
|
||||
cmds = filter(lambda item: isinstance(item[1]['datatype'], CommandType),
|
||||
|
@ -135,10 +135,7 @@ class NodeCtrl(QWidget):
|
||||
row = 0
|
||||
for modname in sorted(self._node.modules):
|
||||
modprops = self._node.getModuleProperties(modname)
|
||||
if 'interface_class' in modprops:
|
||||
interfaces = modprops['interface_class']
|
||||
else:
|
||||
interfaces = modprops.get('interfaces', '')
|
||||
interfaces = modprops.get('interface_classes', '')
|
||||
description = modprops.get('description', '!!! missing description !!!')
|
||||
|
||||
# fallback: allow (now) invalid 'Driveable'
|
||||
|
@ -74,8 +74,8 @@ class Module(HasProperties, metaclass=ModuleMeta):
|
||||
default='user', extname='visibility'),
|
||||
'implementation': Property('Internal name of the implementation class of the module', StringType(),
|
||||
extname='implementation'),
|
||||
'interface_class': Property('Offical highest Interface-class of the module', ArrayOf(StringType()),
|
||||
extname='interface_class'),
|
||||
'interface_classes': Property('Offical highest Interface-class of the module', ArrayOf(StringType()),
|
||||
extname='interface_classes'),
|
||||
# what else?
|
||||
}
|
||||
|
||||
@ -111,10 +111,10 @@ class Module(HasProperties, metaclass=ModuleMeta):
|
||||
myclassname = '%s.%s' % (mycls.__module__, mycls.__name__)
|
||||
self.properties['implementation'] = myclassname
|
||||
# list of all 'secop' modules
|
||||
self.properties['interface_class'] = [
|
||||
self.properties['interface_classes'] = [
|
||||
b.__name__ for b in mycls.__mro__ if b.__module__.startswith('secop.modules')]
|
||||
# list of only the 'highest' secop module class
|
||||
self.properties['interface_class'] = [[
|
||||
self.properties['interface_classes'] = [[
|
||||
b.__name__ for b in mycls.__mro__ if b.__module__.startswith('secop.modules')][0]]
|
||||
|
||||
# handle Features
|
||||
|
@ -138,7 +138,7 @@ def test_ModuleMeta():
|
||||
assert o2.parameters['a1'].datatype.unit == 'mm/s'
|
||||
cfg = newclass2.configurables
|
||||
assert set(cfg.keys()) == {'export', 'group', 'description',
|
||||
'meaning', 'visibility', 'implementation', 'interface_class', 'target', 'stop',
|
||||
'meaning', 'visibility', 'implementation', 'interface_classes', 'target', 'stop',
|
||||
'status', 'param1', 'param2', 'cmd', 'a2', 'pollinterval', 'b2', 'cmd2', 'value',
|
||||
'a1'}
|
||||
assert set(cfg['value'].keys()) == {'group', 'export', 'relative_resolution',
|
||||
|
Loading…
x
Reference in New Issue
Block a user