def bind(self, event, command, extraArgs=[]): gEvent = event + self.guiId if base.config.GetBool('debug-directgui-msgs', False): from toontown.toonbase.ToonPythonUtil import StackTrace print gEvent print StackTrace() self.accept(gEvent, command, extraArgs=extraArgs)
def hide(self): self.ignore('friendsListChanged') if hasattr(self, 'frame'): self.frame.hide() else: self.notify.warning( 'hide called, but frame is deleted, self.frame deleted in:') if hasattr(self, 'frameDelStackTrace'): print self.frameDelStackTrace self.notify.warning('current stackTrace =') print StackTrace() self.notify.warning('crash averted, but root cause unknown')
def bind(self, event, command, extraArgs = []): """ Bind the command (which should expect one arg) to the specified event (such as ENTER, EXIT, B1PRESS, B1CLICK, etc.) See DirectGuiGlobals for possible events """ # Need to tack on gui item specific id gEvent = event + self.guiId if base.config.GetBool('debug-directgui-msgs', False): from toontown.toonbase.ToonPythonUtil import StackTrace print gEvent print StackTrace() self.accept(gEvent, command, extraArgs = extraArgs)
def __cleanupToonInside(self): toonName = 'None' if self.toonInside: toonName = self.toonInside.getName() self.notify.debug('__cleanupToonInside self.toonInside=%s\nstack=%s' % (toonName, StackTrace().compact())) if self.toonHead != None: self.hideToonHead() if hasattr(self.toonInside, 'nametag'): self.toonInside.nametag.remove(self.toonHead.tag) self.toonHead.delete() self.toonHead = None self.toonInside = None self.toonParentNode = None
def __setToonInside(self, toon): self.toonInside = toon toonName = 'None' if toon: toonName = toon.getName() self.notify.debug('__setToonInside self.toonInside=%s\nstack=%s' % (toonName, StackTrace().compact())) self.toonInside.stopSmooth() self.toonOriginalScale = toon.getScale() toon.useLOD(1000) self.toonParentNode = render.attachNewNode('toonOriginChange') self.toonInside.wrtReparentTo(self.toonParentNode) self.toonInside.setPosHpr(0, 0, -(self.toonInside.getHeight() / 2.0), 0, -90, 0)
def unload(self): if self.avatar: self.avatar.reconsiderCheesyEffect() self.__clearCurrentItem() if hasattr(self, 'frame'): self.frame.destroy() del self.frame self.frameDelStackTrace = StackTrace() else: self.notify.warning('unload, no self.frame') if hasattr(self, 'mailbox'): del self.mailbox else: self.notify.warning('unload, no self.mailbox') if self.dialogBox: self.dialogBox.cleanup() self.dialogBox = None for item in self.items: if isinstance(item, CatalogItem.CatalogItem): item.acceptItemCleanup() self.ignoreAll()
def _doDeleteCleanup(self): self.trickLogger.destroy() self.trickFailLogger.destroy() self.feedLogger.destroy() self.scratchLogger.destroy() del self.trickLogger del self.trickFailLogger del self.feedLogger del self.scratchLogger taskMgr.remove(self.uniqueName('clearMovie')) taskMgr.remove(self.uniqueName('PetMovieWait')) taskMgr.remove(self.uniqueName('PetMovieClear')) taskMgr.remove(self.uniqueName('PetMovieComplete')) taskMgr.remove(self.getLockMoveTaskName()) taskMgr.remove(self.getMoveTaskName()) if hasattr(self, 'zoneId'): self.announceZoneChange(ToontownGlobals.QuietZone, self.zoneId) else: myDoId = 'No doId' myTaskName = 'No task name' myStackTrace = StackTrace().trace myOldStackTrace = 'No Trace' if hasattr(self, 'doId'): myDoId = self.doId if task: myTaskName = task.name if hasattr(self, 'destroyDoStackTrace'): myOldStackTrace = self.destroyDoStackTrace.trace simbase.air.writeServerEvent('Pet RequestDelete duplicate', myDoId, 'from task %s' % myTaskName) simbase.air.writeServerEvent( 'Pet RequestDelete duplicate StackTrace', myDoId, '%s' % myStackTrace) simbase.air.writeServerEvent( 'Pet RequestDelete duplicate OldStackTrace', myDoId, '%s' % myOldStackTrace) DistributedPetAI.notify.warning( 'double requestDelete from task %s' % myTaskName) self.setParent(ToontownGlobals.SPHidden) if hasattr(self, 'activated'): if self.activated: self.activated = 0 self.brain.destroy() del self.brain self.actionFSM.destroy() del self.actionFSM self.exitPetLook() self.destroyImpulses() self.mover.destroy() del self.mover self.lockMover.destroy() del self.lockMover self.stopPosHprBroadcast() if hasattr(self, 'mood'): self.mood.destroy() del self.mood if hasattr(self, 'traits'): del self.traits for funcName in self.__funcsToDelete: if funcName in self.__dict__: del self.__dict__[funcName] if hasattr(self, 'gaitFSM'): if self.gaitFSM: self.gaitFSM.requestFinalState() del self.gaitFSM if hasattr(self, 'unstickFSM'): if self.unstickFSM: self.unstickFSM.requestFinalState() del self.unstickFSM if __dev__: del self.pscMoveResc PetLookerAI.PetLookerAI.destroy(self) self.ignoreAll() self._hasCleanedUp = True