示例#1
0
文件: uno.py 项目: hanya/pyuno3ext
 def __getattr__(self, name):
     try:
         value = pyuno.importValue(self.__path__, name)
     except:
         raise AttributeError("constructor not found: {}.{}".format(self.__path__, name))
     setattr(self, name, value)
     return value
示例#2
0
文件: uno.py 项目: hanya/pyuno3ext
 def __getattr__(self, name):
     try:
         value = pyuno.importValue(self.__path__, name)
     except:
         if pyuno.hasModule(self.__path__ + "." + name):
             value = _UNOModuleLoader().load_module(self.__path__ + "." + name)
         elif name == "__all__" or name == "*":
             try:
                 module_names = pyuno.getModuleElementNames(self.__path__)
                 self.__all__ = module_names
                 return module_names
             except:
                 raise AttributeError(name)
         elif name.startswith("typeOf"):
             try:
                 value = pyuno.getTypeByName(self.__path__ + "." + name[6:])
             except:
                 raise AttributeError(
                         "type {}.{} is unknown".format(self.__path__, name))
         else:
             raise AttributeError(name)
     setattr(self, name, value)
     return value