DistributedObject.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. """DistributedObject module: contains the DistributedObject class"""
  2. from PandaObject import *
  3. #from ToonBaseGlobal import *
  4. class DistributedObject(PandaObject):
  5. """Distributed Object class:"""
  6. def __init__(self, cr):
  7. try:
  8. self.DistributedObject_initialized
  9. except:
  10. self.DistributedObject_initialized = 1
  11. self.cr = cr
  12. return None
  13. def disable(self):
  14. """disable(self)
  15. Inheritors should redefine this to take appropriate action on disable
  16. """
  17. pass
  18. def delete(self):
  19. """delete(self)
  20. Inheritors should redefine this to take appropriate action on delete
  21. """
  22. pass
  23. def getDoId(self):
  24. """getDoId(self)
  25. Return the distributed object id
  26. """
  27. return self.doId
  28. def updateRequiredFields(self, cdc, di):
  29. for i in cdc.allRequiredCDU:
  30. i.updateField(cdc, self, di)
  31. def updateRequiredOtherFields(self, cdc, di):
  32. # First, update the required fields
  33. for i in cdc.allRequiredCDU:
  34. i.updateField(cdc, self, di)
  35. # Determine how many other fields there are
  36. numberOfOtherFields = di.getArg(STUint16)
  37. # Update each of the other fields
  38. for i in range(numberOfOtherFields):
  39. cdc.updateField(self, di)
  40. return None
  41. def sendUpdate(self, fieldName, args):
  42. self.cr.sendUpdate(self, fieldName, args)
  43. def taskName(self, taskString):
  44. return (taskString + "-" + str(self.getDoId()))