summaryrefslogtreecommitdiff
path: root/src/scripts/pyolian
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2019-10-07 20:32:05 +0200
committerDave Andreoli <dave@gurumeditation.it>2019-10-07 20:32:05 +0200
commit70eb1c7b1759396d45d1bee65462d1eb37204e01 (patch)
tree758bd588c1aa5c1ba6dc11a2c627e9509243496a /src/scripts/pyolian
parent3cdb87990aa92af0a395d70d04d608f49f76eb7f (diff)
Pyolian gendoc: use some aux eolian functions to simplify templates
Diffstat (limited to 'src/scripts/pyolian')
-rw-r--r--src/scripts/pyolian/eolian.py15
-rw-r--r--src/scripts/pyolian/eolian_lib.py14
-rwxr-xr-xsrc/scripts/pyolian/test_eolian.py8
3 files changed, 34 insertions, 3 deletions
diff --git a/src/scripts/pyolian/eolian.py b/src/scripts/pyolian/eolian.py
index 58c3105e03..70496debc0 100644
--- a/src/scripts/pyolian/eolian.py
+++ b/src/scripts/pyolian/eolian.py
@@ -1012,6 +1012,11 @@ class Implement(Object):
1012 return "<eolian.Implement '{0.name}'>".format(self) 1012 return "<eolian.Implement '{0.name}'>".format(self)
1013 1013
1014 @cached_property 1014 @cached_property
1015 def parent(self):
1016 c_impl = lib.eolian_aux_implement_parent_get(self)
1017 return Implement(c_impl) if c_impl else None
1018
1019 @cached_property
1015 def class_(self): 1020 def class_(self):
1016 c_cls = lib.eolian_implement_class_get(self) 1021 c_cls = lib.eolian_implement_class_get(self)
1017 return Class(c_cls) if c_cls else None 1022 return Class(c_cls) if c_cls else None
@@ -1022,10 +1027,14 @@ class Implement(Object):
1022 return Function(c_func) if c_func else None 1027 return Function(c_func) if c_func else None
1023 1028
1024 def documentation_get(self, ftype=Eolian_Function_Type.METHOD): 1029 def documentation_get(self, ftype=Eolian_Function_Type.METHOD):
1025 # something strange in this eolian api :/ (see 'documentation' property 1030 # c_doc = lib.eolian_implement_documentation_get(self, ftype)
1026 c_doc = lib.eolian_implement_documentation_get(self, ftype) 1031 c_doc = lib.eolian_aux_implement_documentation_get(self, ftype)
1032 return Documentation(c_doc) if c_doc else None
1033
1034 @cached_property
1035 def documentation_fallback(self):
1036 c_doc = lib.eolian_aux_implement_documentation_fallback_get(self)
1027 return Documentation(c_doc) if c_doc else None 1037 return Documentation(c_doc) if c_doc else None
1028 # TODO implement util properties for documentation_get
1029 1038
1030 def is_auto(self, ftype=Eolian_Function_Type.METHOD): 1039 def is_auto(self, ftype=Eolian_Function_Type.METHOD):
1031 return bool(lib.eolian_implement_is_auto(self, ftype)) 1040 return bool(lib.eolian_implement_is_auto(self, ftype))
diff --git a/src/scripts/pyolian/eolian_lib.py b/src/scripts/pyolian/eolian_lib.py
index e73c37e1db..10098bf9b3 100644
--- a/src/scripts/pyolian/eolian_lib.py
+++ b/src/scripts/pyolian/eolian_lib.py
@@ -706,3 +706,17 @@ lib.eolian_error_documentation_get.restype = c_void_p
706# EAPI Eina_Bool eolian_error_is_extern(const Eolian_Error *err); 706# EAPI Eina_Bool eolian_error_is_extern(const Eolian_Error *err);
707lib.eolian_error_is_extern.argtypes = (c_void_p,) 707lib.eolian_error_is_extern.argtypes = (c_void_p,)
708lib.eolian_error_is_extern.restype = c_bool 708lib.eolian_error_is_extern.restype = c_bool
709
710
711# Eolian Aux ################################################################
712# EAPI const Eolian_Implement *eolian_aux_implement_parent_get(const Eolian_Implement *impl);
713lib.eolian_aux_implement_parent_get.argtypes = (c_void_p,)
714lib.eolian_aux_implement_parent_get.restype = c_void_p
715
716# EAPI const Eolian_Documentation *eolian_aux_implement_documentation_get(const Eolian_Implement *impl, Eolian_Function_Type ftype);
717lib.eolian_aux_implement_documentation_get.argtypes = (c_void_p, c_int)
718lib.eolian_aux_implement_documentation_get.restype = c_void_p
719
720# EAPI const Eolian_Documentation *eolian_aux_implement_documentation_fallback_get(const Eolian_Implement *impl);
721lib.eolian_aux_implement_documentation_fallback_get.argtypes = (c_void_p,)
722lib.eolian_aux_implement_documentation_fallback_get.restype = c_void_p
diff --git a/src/scripts/pyolian/test_eolian.py b/src/scripts/pyolian/test_eolian.py
index 0271e50117..3a101691a4 100755
--- a/src/scripts/pyolian/test_eolian.py
+++ b/src/scripts/pyolian/test_eolian.py
@@ -407,6 +407,14 @@ class TestEolianImplement(unittest.TestCase):
407 self.assertFalse(im.is_prop_get) 407 self.assertFalse(im.is_prop_get)
408 self.assertFalse(im.is_property) 408 self.assertFalse(im.is_property)
409 self.assertTrue(im.is_method) 409 self.assertTrue(im.is_method)
410 self.assertIsNone(im.parent)
411
412 def test_implement_parent(self):
413 cls = eolian_db.class_by_name_get('Efl.Ui.Button')
414 im = [im for im in cls.implements if im.short_name == 'content_unset'][0]
415 self.assertIsInstance(im, eolian.Implement)
416 self.assertEqual(im.name, 'Efl.Content.content_unset') # TODO is this right??
417 self.assertEqual(im.parent.name, 'Efl.Content.content_unset')
410 418
411 419
412class TestEolianEvent(unittest.TestCase): 420class TestEolianEvent(unittest.TestCase):