### Main Eolian Unit ########################################################
class Eolian_Unit(EolianBaseObject):
+ def __repr__(self):
+ return "<eolian.Eolian_Unit '{0.file}'>".format(self)
@property
def children(self):
if not _already_halted: # do not free after eolian_shutdown
lib.eolian_state_free(self._obj)
+ def __repr__(self):
+ return "<eolian.Eolian_State, %d units loaded>" % len(list(self.units))
+
def file_parse(self, filepath):
c_unit = lib.eolian_state_file_parse(self._obj, _str_to_bytes(filepath))
return Eolian_Unit(c_unit) if c_unit else None
return "<eolian.Object '{0.name}', {0.type!s}>".format(self)
@cached_property
+ def unit(self):
+ c_unit = lib.eolian_object_unit_get(self._obj)
+ return Eolian_Unit(c_unit) if c_unit else None
+
+ @cached_property
def name(self):
return _str_to_py(lib.eolian_object_name_get(self._obj))
lib.eolian_object_type_get.argtypes = [c_void_p]
lib.eolian_object_type_get.restype = c_int
+# EAPI const Eolian_Unit *eolian_object_unit_get(const Eolian_Object *obj);
+lib.eolian_object_unit_get.argtypes = [c_void_p,]
+lib.eolian_object_unit_get.restype = c_void_p
+
# EAPI const char *eolian_object_file_get(const Eolian_Object *obj);
lib.eolian_object_file_get.argtypes = [c_void_p]
lib.eolian_object_file_get.restype = c_char_p
self.assertIsInstance(obj, eolian.Class)
self.assertEqual(obj.name, 'Efl.Ui.Frame')
+ def test_unit(self):
+ obj = eolian_db.object_by_name_get('Efl.Ui.Frame')
+ self.assertIsInstance(obj.unit, eolian.Eolian_Unit)
+ self.assertEqual(obj.unit.file, 'efl_ui_frame.eo')
+
def test_name(self):
obj = eolian_db.object_by_name_get('Efl.Ui.Frame')
self.assertEqual(obj.name, 'Efl.Ui.Frame')