mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
debugging printInterests
This commit is contained in:
parent
81a399781b
commit
5099a543c0
@ -25,6 +25,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
_interestIdAssign = 1;
|
_interestIdAssign = 1;
|
||||||
_interestIdScopes = 100;
|
_interestIdScopes = 100;
|
||||||
_interests = {}
|
_interests = {}
|
||||||
|
if __debug__:
|
||||||
|
_debug_currentInterests = []
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
assert self.notify.debugCall()
|
assert self.notify.debugCall()
|
||||||
@ -41,7 +43,7 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
scopeId = DoInterestManager._interestIdScopes
|
scopeId = DoInterestManager._interestIdScopes
|
||||||
DoInterestManager._interests[contextId] = [description, scopeId, event, "Active"]
|
DoInterestManager._interests[contextId] = [description, scopeId, event, "Active"]
|
||||||
self._sendAddInterest(contextId, scopeId, parentId, zoneIdList)
|
self._sendAddInterest(contextId, scopeId, parentId, zoneIdList)
|
||||||
assert self.printInterests()
|
assert self.printInterestsIfDebug()
|
||||||
return contextId
|
return contextId
|
||||||
|
|
||||||
def removeInterest(self, contextId, event=None):
|
def removeInterest(self, contextId, event=None):
|
||||||
@ -65,7 +67,7 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
answer = 1
|
answer = 1
|
||||||
else:
|
else:
|
||||||
self.notify.warning("removeInterest: contextId not found: %s" % (contextId))
|
self.notify.warning("removeInterest: contextId not found: %s" % (contextId))
|
||||||
assert self.printInterests()
|
assert self.printInterestsIfDebug()
|
||||||
return answer
|
return answer
|
||||||
|
|
||||||
def alterInterest(self, contextId, parentId, zoneIdList, description=None, event=None):
|
def alterInterest(self, contextId, parentId, zoneIdList, description=None, event=None):
|
||||||
@ -83,7 +85,7 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
DoInterestManager._interests[contextId][2] = event;
|
DoInterestManager._interests[contextId][2] = event;
|
||||||
self._sendAddInterest(contextId, DoInterestManager._interestIdScopes, parentId, zoneIdList)
|
self._sendAddInterest(contextId, DoInterestManager._interestIdScopes, parentId, zoneIdList)
|
||||||
answer = 1
|
answer = 1
|
||||||
assert self.printInterests()
|
assert self.printInterestsIfDebug()
|
||||||
else:
|
else:
|
||||||
self.notify.warning("alterInterest: contextId not found: %s" % (contextId))
|
self.notify.warning("alterInterest: contextId not found: %s" % (contextId))
|
||||||
return answer
|
return answer
|
||||||
@ -125,22 +127,21 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
del DoInterestManager._interests[handle]
|
del DoInterestManager._interests[handle]
|
||||||
|
|
||||||
if __debug__:
|
if __debug__:
|
||||||
def printInterests(self):
|
def printInterestsIfDebug(self):
|
||||||
"""
|
|
||||||
Part of the new otp-server code.
|
|
||||||
"""
|
|
||||||
if self.notify.getDebug():
|
if self.notify.getDebug():
|
||||||
print "*********************** Interest Sets **************"
|
self.printInterests()
|
||||||
for i in DoInterestManager._interests.keys():
|
|
||||||
print "Interest ID:%s, Description=%s Scope=%s Event=%s Mode=%s"%(
|
|
||||||
i,
|
|
||||||
DoInterestManager._interests[i][0],
|
|
||||||
DoInterestManager._interests[i][1],
|
|
||||||
DoInterestManager._interests[i][2],
|
|
||||||
DoInterestManager._interests[i][3])
|
|
||||||
print "****************************************************"
|
|
||||||
return 1 # for assert()
|
return 1 # for assert()
|
||||||
|
|
||||||
|
def printInterests(self):
|
||||||
|
print "*********************** Interest Sets **************"
|
||||||
|
print "(Interest ID, Description, Scope, Event, Mode)"
|
||||||
|
for i in DoInterestManager._interests.keys():
|
||||||
|
print DoInterestManager._interests[i]
|
||||||
|
print "****************************************************"
|
||||||
|
for i in DoInterestManager._debug_currentInterests:
|
||||||
|
print i
|
||||||
|
print "****************************************************"
|
||||||
|
|
||||||
def _sendAddInterest(self, contextId, scopeId, parentId, zoneIdList):
|
def _sendAddInterest(self, contextId, scopeId, parentId, zoneIdList):
|
||||||
"""
|
"""
|
||||||
Part of the new otp-server code.
|
Part of the new otp-server code.
|
||||||
@ -151,6 +152,8 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
on another client.
|
on another client.
|
||||||
"""
|
"""
|
||||||
assert self.notify.debugCall()
|
assert self.notify.debugCall()
|
||||||
|
if __debug__:
|
||||||
|
DoInterestManager._debug_currentInterests.append((contextId, scopeId, parentId, zoneIdList))
|
||||||
datagram = PyDatagram()
|
datagram = PyDatagram()
|
||||||
# Add message type
|
# Add message type
|
||||||
datagram.addUint16(CLIENT_ADD_INTEREST)
|
datagram.addUint16(CLIENT_ADD_INTEREST)
|
||||||
@ -203,5 +206,5 @@ class DoInterestManager(DirectObject.DirectObject):
|
|||||||
else:
|
else:
|
||||||
print "handleInterestDoneMessage--> Scope MisMatch :%s :%s"%(expect_scope,scope);
|
print "handleInterestDoneMessage--> Scope MisMatch :%s :%s"%(expect_scope,scope);
|
||||||
|
|
||||||
assert self.printInterests()
|
assert self.printInterestsIfDebug()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user