Exemple #1
0
def MakeModuleForTypelib(typelibCLSID,
                         lcid,
                         major,
                         minor,
                         progressInstance=None,
                         bGUIProgress=None,
                         bForDemand=bForDemandDefault,
                         bBuildHidden=1):
    """Generate support for a type library.
	
	Given the IID, LCID and version information for a type library, generate
	and import the necessary support files.
	
	Returns the Python module.  No exceptions are caught.

	Params
	typelibCLSID -- IID of the type library.
	major -- Integer major version.
	minor -- Integer minor version.
	lcid -- Integer LCID for the library.
	progressInstance -- Instance to use as progress indicator, or None to
	                    use the GUI progress bar.
	"""
    if bGUIProgress is not None:
        print "The 'bGuiProgress' param to 'MakeModuleForTypelib' is obsolete."

    import makepy
    try:
        makepy.GenerateFromTypeLibSpec((typelibCLSID, lcid, major, minor),
                                       progressInstance=progressInstance,
                                       bForDemand=bForDemand,
                                       bBuildHidden=bBuildHidden)
    except pywintypes.com_error:
        return None
    return GetModuleForTypelib(typelibCLSID, lcid, major, minor)
Exemple #2
0
def MakeModuleForTypelibInterface(typelib_ob,
                                  progressInstance=None,
                                  bForDemand=bForDemandDefault,
                                  bBuildHidden=1):
    """Generate support for a type library.
	
	Given a PyITypeLib interface generate and import the necessary support files.  This is useful
	for getting makepy support for a typelibrary that is not registered - the caller can locate
	and load the type library itself, rather than relying on COM to find it.
	
	Returns the Python module.

	Params
	typelib_ob -- The type library itself
	progressInstance -- Instance to use as progress indicator, or None to
	                    use the GUI progress bar.
	"""
    import makepy
    try:
        makepy.GenerateFromTypeLibSpec(typelib_ob,
                                       progressInstance=progressInstance,
                                       bForDemand=bForDemandDefault,
                                       bBuildHidden=bBuildHidden)
    except pywintypes.com_error:
        return None
    tla = typelib_ob.GetLibAttr()
    guid = tla[0]
    lcid = tla[1]
    major = tla[3]
    minor = tla[4]
    return GetModuleForTypelib(guid, lcid, major, minor)
Exemple #3
0
def MakeModuleForTypelib(typelibCLSID,
                         lcid,
                         major,
                         minor,
                         progressInstance=None,
                         bForDemand=bForDemandDefault,
                         bBuildHidden=1):
    """Generate support for a type library.
	
	Given the IID, LCID and version information for a type library, generate
	and import the necessary support files.
	
	Returns the Python module.  No exceptions are caught.

	Params
	typelibCLSID -- IID of the type library.
	major -- Integer major version.
	minor -- Integer minor version.
	lcid -- Integer LCID for the library.
	progressInstance -- Instance to use as progress indicator, or None to
	                    use the GUI progress bar.
	"""
    import makepy
    makepy.GenerateFromTypeLibSpec((typelibCLSID, lcid, major, minor),
                                   progressInstance=progressInstance,
                                   bForDemand=bForDemand,
                                   bBuildHidden=bBuildHidden)
    return GetModuleForTypelib(typelibCLSID, lcid, major, minor)