示例#1
0
文件: uno.py 项目: hanya/pyuno3
    def __getattr__(self, elt):
        value = None

        RuntimeException = pyuno.getClass("com.sun.star.uno.RuntimeException")
        try:
            value = pyuno.getClass(self.__path__ + "." + elt)
        except RuntimeException:
            try:
                value = Enum(self.__path__, elt)
            except RuntimeException:
                try:
                    value = pyuno.getConstantByName(self.__path__ + "." + elt)
                except RuntimeException:
                    if elt.startswith("typeOf"):
                        try:
                            value = pyuno.getTypeByName(self.__path__ + "." + elt[6:])
                        except RuntimeException:
                            raise AttributeError("type {}.{} is unknown".format(self.__path__, elt))
                    elif elt == "__all__":
                        try:
                            module_names = pyuno.getModuleElementNames(self.__path__)
                            self.__all__ = module_names
                            return module_names
                        except RuntimeException:
                            raise AttributeError("__all__")
                    else:
                        raise AttributeError("type {}.{} is unknown".format(self.__path__, elt))
        setattr(self, elt, value)
        return value
示例#2
0
def getConstantByName( constant ):
    "Looks up the value of a idl constant by giving its explicit name"
    return pyuno.getConstantByName( constant )
示例#3
0
def getConstantByName(constant):
    """Looks up the value of an IDL constant by giving its explicit name."""

    return pyuno.getConstantByName(constant)
示例#4
0
文件: unohelper.py 项目: t2y/unotools
def constant(name: str) -> object:
    """
    >>> constant('com.sun.star.util.NumberFormat.DATE')
    2
    """
    return pyuno.getConstantByName(name)
示例#5
0
def getConstantByName(constant):
    "Looks up the value of a idl constant by giving its explicit name"
    return pyuno.getConstantByName(constant)
示例#6
0
文件: uno.py 项目: CloCkWeRX/core
def getConstantByName(constant):
    """Looks up the value of an IDL constant by giving its explicit name."""

    return pyuno.getConstantByName(constant)