Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CLSIDToClass.py 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. """Manages a dictionary of CLSID strings to Python classes.
  2. Primary use of this module is to allow modules generated by
  3. makepy.py to share classes. @makepy@ automatically generates code
  4. which interacts with this module. You should never need to reference
  5. this module directly.
  6. This module only provides support for modules which have been previously
  7. been imported. The gencache module provides some support for loading modules
  8. on demand - once done, this module supports it...
  9. As an example, the MSACCESS.TLB type library makes reference to the
  10. CLSID of the Database object, as defined in DAO3032.DLL. This
  11. allows code using the MSAccess wrapper to natively use Databases.
  12. This obviously applies to all cooperating objects, not just DAO and
  13. Access.
  14. """
  15. mapCLSIDToClass = {}
  16. def RegisterCLSID(clsid, pythonClass):
  17. """Register a class that wraps a CLSID
  18. This function allows a CLSID to be globally associated with a class.
  19. Certain module will automatically convert an IDispatch object to an
  20. instance of the associated class.
  21. """
  22. mapCLSIDToClass[str(clsid)] = pythonClass
  23. def RegisterCLSIDsFromDict(dict):
  24. """Register a dictionary of CLSID's and classes.
  25. This module performs the same function as @RegisterCLSID@, but for
  26. an entire dictionary of associations.
  27. Typically called by makepy generated modules at import time.
  28. """
  29. mapCLSIDToClass.update(dict)
  30. def GetClass(clsid):
  31. """Given a CLSID, return the globally associated class.
  32. clsid -- a string CLSID representation to check.
  33. """
  34. return mapCLSIDToClass[clsid]
  35. def HasClass(clsid):
  36. """Determines if the CLSID has an associated class.
  37. clsid -- the string CLSID to check
  38. """
  39. return clsid in mapCLSIDToClass