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.

contexts.py 2.1KB

1 year ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. """ A module for managing the AXDebug I*Contexts
  2. """
  3. import pythoncom
  4. import win32com.server.util
  5. from . import adb, axdebug, gateways
  6. # Utility function for wrapping object created by this module.
  7. from .util import _wrap, _wrap_remove, trace
  8. class DebugCodeContext(gateways.DebugCodeContext, gateways.DebugDocumentContext):
  9. # NOTE: We also implement the IDebugDocumentContext interface for Simple Hosts.
  10. # Thus, debugDocument may be NULL when we have smart hosts - but in that case, we
  11. # wont be called upon to provide it.
  12. _public_methods_ = (
  13. gateways.DebugCodeContext._public_methods_
  14. + gateways.DebugDocumentContext._public_methods_
  15. )
  16. _com_interfaces_ = (
  17. gateways.DebugCodeContext._com_interfaces_
  18. + gateways.DebugDocumentContext._com_interfaces_
  19. )
  20. def __init__(self, lineNo, charPos, len, codeContainer, debugSite):
  21. self.debugSite = debugSite
  22. self.offset = charPos
  23. self.length = len
  24. self.breakPointState = 0
  25. self.lineno = lineNo
  26. gateways.DebugCodeContext.__init__(self)
  27. self.codeContainer = codeContainer
  28. def _Close(self):
  29. self.debugSite = None
  30. def GetDocumentContext(self):
  31. if self.debugSite is not None:
  32. # We have a smart host - let him give it to us.
  33. return self.debugSite.GetDocumentContextFromPosition(
  34. self.codeContainer.sourceContext, self.offset, self.length
  35. )
  36. else:
  37. # Simple host - Fine - Ill do it myself!
  38. return _wrap(self, axdebug.IID_IDebugDocumentContext)
  39. def SetBreakPoint(self, bps):
  40. self.breakPointState = bps
  41. adb.OnSetBreakPoint(self, bps, self.lineno)
  42. # The DebugDocumentContext methods for simple hosts.
  43. def GetDocument(self):
  44. return self.codeContainer.debugDocument
  45. def EnumCodeContexts(self):
  46. return _wrap(EnumDebugCodeContexts([self]), axdebug.IID_IEnumDebugCodeContexts)
  47. class EnumDebugCodeContexts(gateways.EnumDebugCodeContexts):
  48. def _wrap(self, obj):
  49. return _wrap(obj, axdebug.IID_IDebugCodeContext)