Commit ae199538 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩

Python wrapper single listener changes

parent 150fcfaf
......@@ -254,7 +254,7 @@ class PythonTranslator(object):
listenedClass = _method.find_first_ancestor_by_type(AbsApi.Interface).listenedClass
callbackDict['callback_setter'] = listenedClass.name.to_snake_case(fullName=True) + '_cbs_set_' + _method.name.to_snake_case()[3:]
callbackDict['is_single_listener'] = not listenedClass.multilistener
callbackDict['is_single_listener'] = listenedClass.singlelistener
callbackDict['is_multi_listener'] = listenedClass.multilistener
callbackDict['params'] = []
......@@ -427,7 +427,7 @@ class PythonTranslator(object):
if _obj.multilistener:
objDict['methods'].append(self.create_add_callbacks_method(_obj))
objDict['methods'].append(self.create_remove_callbacks_method(_obj))
else:
if _obj.singlelistener:
objDict['properties'].append(self.create_get_callbacks_method(_obj))
for _method in _obj.classMethods:
......@@ -471,7 +471,7 @@ class Pylinphone(object):
self.c_methods.append(translator.create_c_add_callback_for_interface(_class))
self.c_methods.append(translator.create_c_remove_callback_for_interface(_class))
self.factory_constructors.append(translator.create_listener_constructor(_class))
else:
if _class.singlelistener:
self.c_methods.append(translator.create_c_get_callbacks_for_interface(_class))
self.c_methods.append(translator.create_c_listener_constructor(_class))
......
......@@ -193,11 +193,13 @@ cdef class {{python_name}}:
{{/is_bool}}
{{/params}}
callbacks = None
{{#is_multi_listener}}
callbacks = {{first_python_param_name}}_obj.current_callbacks
{{/is_multi_listener}}
{{#is_single_listener}}
callbacks = {{first_python_param_name}}_obj.listener
if callbacks is None:
callbacks = {{first_python_param_name}}_obj.listener
{{/is_single_listener}}
if callbacks.{{callback_var_name}} is not None:
callbacks.{{callback_var_name}}({{computed_params}})
......
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