From f4756996f44bf6c5b8dafa898b5c903ce831ac20 Mon Sep 17 00:00:00 2001 From: Joe Shochet Date: Fri, 6 Apr 2001 17:36:12 +0000 Subject: [PATCH] *** empty log message *** --- direct/src/actor/Actor.py | 8 ++++---- direct/src/ffi/FFIInterrogateDatabase.py | 4 +++- direct/src/ffi/FFITypes.py | 13 ++++++++----- direct/src/gui/OnscreenText.py | 3 +++ direct/src/showbase/Loader.py | 21 ++++++++++----------- direct/src/showbase/Messenger.py | 24 +++++++++++------------- direct/src/showbase/PythonUtil.py | 4 +--- 7 files changed, 40 insertions(+), 37 deletions(-) diff --git a/direct/src/actor/Actor.py b/direct/src/actor/Actor.py index 9084ea10e2..eb6ec3be72 100644 --- a/direct/src/actor/Actor.py +++ b/direct/src/actor/Actor.py @@ -709,7 +709,7 @@ class Actor(PandaObject, NodePath): for geomNum in range(0, numGeoms): thisGeom = thisGeomNode.node().getGeom(geomNum) thisGeom.markBoundStale() - Actor.notify.info("fixing bounds for node %s, geom %s" % \ + Actor.notify.debug("fixing bounds for node %s, geom %s" % \ (nodeNum, geomNum)) thisGeomNode.node().markBoundStale() @@ -860,7 +860,7 @@ class Actor(PandaObject, NodePath): name(defaults to "modelRoot") and an lod name(defaults to "lodRoot"). If copy is set to 0, do a lodModelOnce instead of a loadModelCopy. """ - Actor.notify.info("in loadModel: %s , part: %s, lod: %s, copy: %s" % \ + Actor.notify.debug("in loadModel: %s , part: %s, lod: %s, copy: %s" % \ (modelPath, partName, lodName, copy)) # load the model and extract its part bundle @@ -910,8 +910,8 @@ class Actor(PandaObject, NodePath): to 'lodRoot' for non-LOD actors) and dict of corresponding anims in the form animName:animPath{}""" - Actor.notify.info("in loadAnims: %s, part: %s, lod: %s" % - (anims, partName, lodName)) + Actor.notify.debug("in loadAnims: %s, part: %s, lod: %s" % + (anims, partName, lodName)) animDict = {} diff --git a/direct/src/ffi/FFIInterrogateDatabase.py b/direct/src/ffi/FFIInterrogateDatabase.py index 8246f61f40..811471b799 100644 --- a/direct/src/ffi/FFIInterrogateDatabase.py +++ b/direct/src/ffi/FFIInterrogateDatabase.py @@ -719,7 +719,9 @@ class FFIInterrogateDatabase: FFIConstants.notify.info( 'Generating global downcast code...') downcastFile = constructDowncastFile(codeDir, CModuleName) # Output all the imports based on this list of functions - outputGlobalFileImports(downcastFile, self.environment.downcastFunctions, CModuleName) + outputGlobalFileImports(downcastFile, + self.environment.downcastFunctions, + CModuleName) for type in self.environment.downcastFunctions: type.generateGlobalDowncastCode(downcastFile) diff --git a/direct/src/ffi/FFITypes.py b/direct/src/ffi/FFITypes.py index 9634e5aa62..2dcda61f5f 100644 --- a/direct/src/ffi/FFITypes.py +++ b/direct/src/ffi/FFITypes.py @@ -487,6 +487,7 @@ class ClassTypeDescriptor(BaseTypeDescriptor): self.outputImports(file, nesting) self.outputClassHeader(file, nesting) self.outputClassComment(file, nesting) + self.outputClassCModules(file, nesting) self.outputNestedTypes(file, nesting) @@ -684,13 +685,15 @@ class ClassTypeDescriptor(BaseTypeDescriptor): file.write(', ') file.write('FFIExternalObject.FFIExternalObject):\n') + + def outputClassCModules(self, file, nesting): # Store the class C modules for the class so they do not # get garbage collected before we do - # TODO: this did not appear to work - indent(file, nesting+1, '__CModules__ = [') - for moduleName in self.getCModules(): - file.write(moduleName + ',') - file.write(']\n') + # TODO: this did not appear to work so I'm taking it out + # indent(file, nesting+1, '__CModules__ = [') + # for moduleName in self.getCModules(): + # file.write(moduleName + ',') + # file.write(']\n') # Store the downcast function modules so the FFIExternalObject # can index into them to find the downcast functions diff --git a/direct/src/gui/OnscreenText.py b/direct/src/gui/OnscreenText.py index c7c7560405..53098b860c 100644 --- a/direct/src/gui/OnscreenText.py +++ b/direct/src/gui/OnscreenText.py @@ -221,6 +221,9 @@ class OnscreenText(PandaObject, NodePath): def setText(self, text): self.textNode.setText(text) + + def getText(self): + return self.textNode.getText() def setPos(self, x, y): """setPos(self, float, float) diff --git a/direct/src/showbase/Loader.py b/direct/src/showbase/Loader.py index bc7a539900..3fb07ea328 100644 --- a/direct/src/showbase/Loader.py +++ b/direct/src/showbase/Loader.py @@ -8,7 +8,6 @@ class Loader: """Loader class: contains method to load models, sounds and code""" notify = directNotify.newCategory("Loader") - # notify.setInfo(1) # special methods def __init__(self, base): @@ -22,7 +21,7 @@ class Loader: """loadModel(self, string) Attempt to load a model from given file path, return a nodepath to the model if successful or None otherwise.""" - Loader.notify.info("Loading model: %s" % (modelPath) ) + Loader.notify.debug("Loading model: %s" % (modelPath) ) node = self.loader.loadSync(Filename(modelPath)) if (node != None): nodePath = self.base.hidden.attachNewNode(node) @@ -35,7 +34,7 @@ class Loader: Attempt to load a model from modelPool, if not present then attempt to load it from disk. Return a nodepath to the model if successful or None otherwise""" - Loader.notify.info("Loading model once: %s" % (modelPath)) + Loader.notify.debug("Loading model once: %s" % (modelPath)) node = ModelPool.loadModel(modelPath) if (node != None): nodePath = self.base.hidden.attachNewNode(node) @@ -48,7 +47,7 @@ class Loader: Attempt to load a model from modelPool, if not present then attempt to load it from disk. Return a nodepath to a copy of the model if successful or None otherwise""" - Loader.notify.info("Loading model copy: %s" % (modelPath)) + Loader.notify.debug("Loading model copy: %s" % (modelPath)) node = ModelPool.loadModel(modelPath) if (node != None): return (NodePath(node).copyTo(self.base.hidden)) @@ -65,13 +64,13 @@ class Loader: anyway--it prevents accumulation of instances of the font model under hidden.""" - Loader.notify.info("Loading model once node: %s" % (modelPath)) + Loader.notify.debug("Loading model once node: %s" % (modelPath)) return ModelPool.loadModel(modelPath) def unloadModel(self, modelPath): """unloadModel(self, string) """ - Loader.notify.info("Unloading model: %s" % (modelPath)) + Loader.notify.debug("Unloading model: %s" % (modelPath)) ModelPool.releaseModel(modelPath) # texture loading funcs @@ -81,17 +80,17 @@ class Loader: TexturePool class. Returns None if not found""" if alphaPath == None: - Loader.notify.info("Loading texture: %s" % (texturePath) ) + Loader.notify.debug("Loading texture: %s" % (texturePath) ) texture = TexturePool.loadTexture(texturePath) else: - Loader.notify.info("Loading texture: %s %s" % (texturePath, alphaPath) ) + Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath) ) texture = TexturePool.loadTexture(texturePath, alphaPath) return texture def unloadTexture(self, texture): """unloadTexture(self, texture) """ - Loader.notify.info("Unloading texture: %s" % (texture) ) + Loader.notify.debug("Unloading texture: %s" % (texture) ) TexturePool.releaseTexture(texture) # sound loading funcs @@ -99,7 +98,7 @@ class Loader: """loadSound(self, string) Attempt to load a sound from the given file path using Cary's sound class. Returns None if not found""" - Loader.notify.info("Loading sound: %s" % (soundPath) ) + Loader.notify.debug("Loading sound: %s" % (soundPath) ) sound = AudioPool.loadSound(soundPath) return sound @@ -107,7 +106,7 @@ class Loader: """unloadSound(self, sound) """ if sound: - Loader.notify.info("Unloading sound: %s" % (sound) ) + Loader.notify.debug("Unloading sound: %s" % (sound) ) AudioPool.releaseSound(sound) diff --git a/direct/src/showbase/Messenger.py b/direct/src/showbase/Messenger.py index 49dcc8a600..c9fdc8c886 100644 --- a/direct/src/showbase/Messenger.py +++ b/direct/src/showbase/Messenger.py @@ -171,29 +171,27 @@ class Messenger: def toggleVerbose(self): Messenger.notify.setDebug(1 - Messenger.notify.getDebug()) - def listAllEvents(self): - str = 'Messenger\n' - str = str + '='*50 + '\n' + def __repr__(self): + """ + Compact version of event, acceptor pairs + """ + str = "="*64 + "\n" keys = self.dict.keys() keys.sort() for event in keys: - str = str + 'Event: ' + event + '\n' + str = str + event.ljust(32) + '\t' acceptorDict = self.dict[event] for object in acceptorDict.keys(): method, extraArgs, persistent = acceptorDict[object] className = object.__class__.__name__ methodName = method.__name__ - str = str + '\t' + className + '.' + methodName + '(' - if extraArgs: - str = str + `extraArgs` + ' + ' - str = str + 'sentArgs)\n' + str = str + className + '.' + methodName + ' ' str = str + '\n' - str = str + '='*50 + '\n' - print str + return str - def __repr__(self): - """__repr__(self) - Print out the table in a readable format + def detailedRepr(self): + """ + Print out the table in a detailed readable format """ import types str = 'Messenger\n' diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 0cb743c79f..f2988e72b4 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -18,10 +18,8 @@ def indent(stream, numIndents, str): """ Write str to stream with numIndents in front it it """ - #indentString = '\t' # To match emacs, instead of a tab character we will use 4 spaces - indentString = ' ' - stream.write(indentString * numIndents + str) + stream.write(' ' * numIndents + str) def apropos(obj, *args): """