Ejemplo n.º 1
0
Archivo: test.py Proyecto: hanya/pyuno3
 def test_hasModule(self):
     import pyuno
     self.assertTrue(pyuno.hasModule("com"))
     self.assertTrue(pyuno.hasModule("com.sun"))
     self.assertTrue(pyuno.hasModule("com.sun.star.awt.FontWeight"))
     self.assertTrue(pyuno.hasModule("com.sun.star.awt.FontSlant"))
     self.assertFalse(pyuno.hasModule("foo"))
Ejemplo n.º 2
0
 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
Ejemplo n.º 3
0
Archivo: uno.py Proyecto: hanya/pyuno3
 def find_module(self, fullname, path=None):
     if pyuno.hasModule(fullname):
         return self.__class__.LOADER
     return None
Ejemplo n.º 4
0
Archivo: uno.py Proyecto: hanya/pyuno3
def hasModule(name):
    """ Check UNO module is there by its name. 
    
        Valid modules are module, constants and enum.
    """
    return pyuno.hasModule(name)