summaryrefslogtreecommitdiff
path: root/src/scripts
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
parent3cdb87990aa92af0a395d70d04d608f49f76eb7f (diff)
Pyolian gendoc: use some aux eolian functions to simplify templates
Diffstat (limited to 'src/scripts')
-rw-r--r--src/scripts/gendoc/doc_macros.include30
-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
4 files changed, 40 insertions, 27 deletions
diff --git a/src/scripts/gendoc/doc_macros.include b/src/scripts/gendoc/doc_macros.include
index 877b7c67bf..1527e09f43 100644
--- a/src/scripts/gendoc/doc_macros.include
+++ b/src/scripts/gendoc/doc_macros.include
@@ -7,14 +7,8 @@ ${UNTOKENIZE(tokens=obj.summary_tokens)}$#!
7 <!--(elif isinstance(obj, Implement))--> 7 <!--(elif isinstance(obj, Implement))-->
8 <!--(if obj.documentation_get(obj.function.type))--> 8 <!--(if obj.documentation_get(obj.function.type))-->
9${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).summary_tokens)}$#! 9${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).summary_tokens)}$#!
10 <!--(else)--> 10 <!--(elif obj.documentation_fallback)-->
11 <!--(for parent_impl in obj.class_.implements)--> 11${UNTOKENIZE(tokens=obj.documentation_fallback.summary_tokens)}$#!
12 <!--(if parent_impl.function.name == obj.function.name)-->
13 <!--(if parent_impl.documentation_get(parent_impl.function.type))-->
14${UNTOKENIZE(tokens=parent_impl.documentation_get(parent_impl.function.type).summary_tokens)}$#!
15 <!--(end)-->
16 <!--(end)-->
17 <!--(end)-->
18 <!--(end)--> 12 <!--(end)-->
19 <!--(elif obj and obj.documentation)--> 13 <!--(elif obj and obj.documentation)-->
20${UNTOKENIZE(tokens=obj.documentation.summary_tokens)}$#! 14${UNTOKENIZE(tokens=obj.documentation.summary_tokens)}$#!
@@ -31,14 +25,8 @@ ${UNTOKENIZE(tokens=obj.description_tokens)}$#!
31 <!--(elif isinstance(obj, Implement))--> 25 <!--(elif isinstance(obj, Implement))-->
32 <!--(if obj.documentation_get(obj.function.type))--> 26 <!--(if obj.documentation_get(obj.function.type))-->
33${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).description_tokens)}$#! 27${UNTOKENIZE(tokens=obj.documentation_get(obj.function.type).description_tokens)}$#!
34 <!--(else)--> 28 <!--(elif obj.documentation_fallback)-->
35 <!--(for parent_impl in obj.class_.implements)--> 29${UNTOKENIZE(tokens=obj.documentation_fallback.description_tokens)}$#!
36 <!--(if parent_impl.function.name == obj.function.name)-->
37 <!--(if parent_impl.documentation_get(parent_impl.function.type))-->
38${UNTOKENIZE(tokens=parent_impl.documentation_get(parent_impl.function.type).description_tokens)}$#!
39 <!--(end)-->
40 <!--(end)-->
41 <!--(end)-->
42 <!--(end)--> 30 <!--(end)-->
43 <!--(elif obj and obj.documentation)--> 31 <!--(elif obj and obj.documentation)-->
44${UNTOKENIZE(tokens=obj.documentation.description_tokens)}$#! 32${UNTOKENIZE(tokens=obj.documentation.description_tokens)}$#!
@@ -55,14 +43,8 @@ ${UNTOKENIZE(tokens=obj.documentation.description_tokens)}$#!
55 <!--(elif isinstance(obj, Implement))--> 43 <!--(elif isinstance(obj, Implement))-->
56 <!--(if obj.documentation_get(obj.function.type))--> 44 <!--(if obj.documentation_get(obj.function.type))-->
57//Since ${obj.documentation_get(obj.function.type).since}$// 45//Since ${obj.documentation_get(obj.function.type).since}$//
58 <!--(else)--> 46 <!--(elif obj.documentation_fallback)-->
59 <!--(for parent_impl in obj.class_.implements)--> 47//Since ${obj.documentation_fallback.since}$//
60 <!--(if parent_impl.function.name == obj.function.name)-->
61 <!--(if parent_impl.documentation_get(parent_impl.function.type))-->
62//Since ${parent_impl.documentation_get(parent_impl.function.type).since}$//
63 <!--(end)-->
64 <!--(end)-->
65 <!--(end)-->
66 <!--(end)--> 48 <!--(end)-->
67 <!--(elif obj and obj.documentation and obj.documentation.since)--> 49 <!--(elif obj and obj.documentation and obj.documentation.since)-->
68//Since ${obj.documentation.since}$// 50//Since ${obj.documentation.since}$//
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):