mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
reorder acceptOnce cleanup
This commit is contained in:
parent
c65538b0e1
commit
5a32627a8d
@ -129,21 +129,23 @@ class Messenger:
|
|||||||
callInfo = acceptorDict.get(object)
|
callInfo = acceptorDict.get(object)
|
||||||
if callInfo:
|
if callInfo:
|
||||||
method, extraArgs, persistent = callInfo
|
method, extraArgs, persistent = callInfo
|
||||||
apply(method, (extraArgs + sentArgs))
|
|
||||||
# If this object was only accepting this event once,
|
# If this object was only accepting this event once,
|
||||||
# remove it from the dictionary
|
# remove it from the dictionary
|
||||||
if not persistent:
|
if not persistent:
|
||||||
# notify the object that the event has been triggered
|
# notify the object that the event has been triggered
|
||||||
object._INTERNAL_acceptOnceExpired(event)
|
object._INTERNAL_acceptOnceExpired(event)
|
||||||
# We need to check this because the apply above might
|
|
||||||
# have done an ignore.
|
|
||||||
if acceptorDict.has_key(object):
|
|
||||||
del acceptorDict[object]
|
del acceptorDict[object]
|
||||||
# If the dictionary at this event is now empty, remove
|
# If the dictionary at this event is now empty, remove
|
||||||
# the event entry from the Messenger altogether
|
# the event entry from the Messenger altogether
|
||||||
if (self.dict.has_key(event) and (len(self.dict[event]) == 0)):
|
if (self.dict.has_key(event) and (len(self.dict[event]) == 0)):
|
||||||
del self.dict[event]
|
del self.dict[event]
|
||||||
|
|
||||||
|
# It is important to make the actual call here, after
|
||||||
|
# we have cleaned up the accept hook, because the
|
||||||
|
# method itself might call accept() or acceptOnce()
|
||||||
|
# again.
|
||||||
|
apply(method, (extraArgs + sentArgs))
|
||||||
|
|
||||||
def clear(self):
|
def clear(self):
|
||||||
"""clear(self)
|
"""clear(self)
|
||||||
Start fresh with a clear dict
|
Start fresh with a clear dict
|
||||||
|
Loading…
x
Reference in New Issue
Block a user