Browse Source

*** empty log message ***

Joe Shochet 24 years ago
parent
commit
a7cd155bb1

+ 5 - 4
direct/src/actor/Actor.py

@@ -221,10 +221,11 @@ class Actor(PandaObject, NodePath):
         # compareTo() method to compare different NodePaths.  But we
         # don't want this behavior for Actors; Actors should only be
         # compared pointerwise.  A NodePath that happens to reference
-        # the same node is still different from the Actor.  Thus, we
-        # redefine __cmp__ to always return a failed comparison.
-        return 1
-
+        # the same node is still different from the Actor.
+        if self is other:
+            return 0
+        else:
+            return 1
 
     def __str__(self):
         """__str__(self)

+ 1 - 2
direct/src/directnotify/Notifier.py

@@ -2,6 +2,7 @@
    for the programmer/user"""
 
 from LoggerGlobal import *
+from NotifySeverity import *
 import time
 
 class Notifier:
@@ -42,7 +43,6 @@ class Notifier:
 
     # Severity funcs
     def setSeverity(self, severity):
-        from NotifySeverity import *
         if severity >= NSError:
             self.setWarning(0)
             self.setInfo(0)
@@ -61,7 +61,6 @@ class Notifier:
             self.setDebug(1)
 
     def getSeverity(self):
-        from NotifySeverity import *
         if self.getDebug():
             return NSDebug
         elif self.getInfo():

+ 8 - 8
direct/src/directtools/DirectSession.py

@@ -93,24 +93,24 @@ class DirectSession(PandaObject):
         self.radamec = None
         self.fastrak = []
         if base.config.GetBool('want-vrpn', 0):
-            from DirectDeviceManager import *
-            self.deviceManager = DirectDeviceManager()
+            import DirectDeviceManager
+            self.deviceManager = DirectDeviceManager.DirectDeviceManager()
             # Automatically create any devices specified in config file
             joybox = base.config.GetString('vrpn-joybox-device', '')
             radamec = base.config.GetString('vrpn-radamec-device', '')
             fastrak = base.config.GetString('vrpn-fastrak-device', '')
             if joybox:
-                from DirectJoybox import *
-                self.joybox = DirectJoybox(joybox)
+                import DirectJoybox
+                self.joybox = DirectJoybox.DirectJoybox(joybox)
             if radamec:
-                from DirectRadamec import *
-                self.radamec = DirectRadamec(radamec)
+                import DirectRadamec
+                self.radamec = DirectRadamec.DirectRadamec(radamec)
             if fastrak:
-                from DirectFastrak import *
+                import DirectFastrak
                 # parse string into format device:N where N is the sensor name
                 fastrak = string.split(fastrak)
                 for i in range(len(fastrak))[1:]:
-                    self.fastrak.append(DirectFastrak(fastrak[0] + ':' + fastrak[i]))
+                    self.fastrak.append(DirectFastrak.DirectFastrak(fastrak[0] + ':' + fastrak[i]))
                 
             
         self.fControl = 0

+ 5 - 4
direct/src/distributed/DistributedNode.py

@@ -38,10 +38,11 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath.NodePath):
         # NodePath's compareTo() method to compare different
         # NodePaths.  But we don't want this behavior for
         # DistributedNodes; DistributedNodes should only be compared
-        # pointerwise.  A NodePath that happens to reference the same
-        # node is still different from the DistributedNode.  Thus, we
-        # redefine __cmp__ to always return a failed comparison.
-        return 1
+        # pointerwise.
+        if self is other:
+            return 0
+        else:
+            return 1
 
     ### setParent ###
 

+ 21 - 19
direct/src/extensions/Datagram-extensions.py

@@ -1,54 +1,54 @@
 
     def putArg(self, arg, subatomicType, divisor=1):
         # Import the type numbers
-        from DCSubatomicType import *
-        if subatomicType == STInt8:
+        import DCSubatomicType
+        if subatomicType == DCSubatomicType.STInt8:
             self.addInt8(int(arg*divisor))
-        elif subatomicType == STInt16:
+        elif subatomicType == DCSubatomicType.STInt16:
             self.addInt16(int(arg*divisor))
-        elif subatomicType == STInt32:
+        elif subatomicType == DCSubatomicType.STInt32:
             self.addInt32(int(arg*divisor))
-        elif subatomicType == STInt64:
+        elif subatomicType == DCSubatomicType.STInt64:
             self.addInt64(int(arg*divisor))
-        elif subatomicType == STUint8:
+        elif subatomicType == DCSubatomicType.STUint8:
             self.addUint8(int(arg*divisor))
-        elif subatomicType == STUint16:
+        elif subatomicType == DCSubatomicType.STUint16:
             self.addUint16(int(arg*divisor))
-        elif subatomicType == STUint32:
+        elif subatomicType == DCSubatomicType.STUint32:
             self.addUint32(int(arg*divisor))
-        elif subatomicType == STUint64:
+        elif subatomicType == DCSubatomicType.STUint64:
             self.addUint64(int(arg*divisor))
-        elif subatomicType == STFloat64:
+        elif subatomicType == DCSubatomicType.STFloat64:
             self.addFloat64(arg)
-        elif subatomicType == STString:
+        elif subatomicType == DCSubatomicType.STString:
             self.addString(arg)
-        elif subatomicType == STBlob:
+        elif subatomicType == DCSubatomicType.STBlob:
             self.addString(arg)
-        elif subatomicType == STInt8array:
+        elif subatomicType == DCSubatomicType.STInt8array:
             self.addUint16(len(arg))
             for i in arg:
                 self.addInt8(int(i*divisor))
-        elif subatomicType == STInt16array:
+        elif subatomicType == DCSubatomicType.STInt16array:
             self.addUint16(len(arg) << 1)
             for i in arg:
                 self.addInt16(int(i*divisor))
-        elif subatomicType == STInt32array:
+        elif subatomicType == DCSubatomicType.STInt32array:
             self.addUint16(len(arg) << 2)
             for i in arg:
                 self.addInt32(int(i*divisor))
-        elif subatomicType == STUint8array:
+        elif subatomicType == DCSubatomicType.STUint8array:
             self.addUint16(len(arg))
             for i in arg:
                 self.addUint8(int(i*divisor))
-        elif subatomicType == STUint16array:
+        elif subatomicType == DCSubatomicType.STUint16array:
             self.addUint16(len(arg) << 1)
             for i in arg:
                 self.addUint16(int(i*divisor))
-        elif subatomicType == STUint32array:
+        elif subatomicType == DCSubatomicType.STUint32array:
             self.addUint16(len(arg) << 2)
             for i in arg:
                 self.addUint32(int(i*divisor))
-        elif subatomicType == STUint32uint8array:
+        elif subatomicType == DCSubatomicType.STUint32uint8array:
             self.addUint16(len(arg) * 5)
             for i in arg:
                 self.addUint32(int(i[0]*divisor))
@@ -56,3 +56,5 @@
         else:
             raise Exception("Error: No such type as: " + str(subatomicType))
         return None
+
+

+ 37 - 37
direct/src/extensions/DatagramIterator-extensions.py

@@ -1,62 +1,62 @@
 
     def getArg(self, subatomicType, divisor=1):
         # Import the type numbers
-        from DCSubatomicType import *
+        import DCSubatomicType
         if divisor == 1:
             # No division necessary
-            if subatomicType == STInt8:
+            if subatomicType == DCSubatomicType.STInt8:
                 retVal = self.getInt8()
-            elif subatomicType == STInt16:
+            elif subatomicType == DCSubatomicType.STInt16:
                 retVal = self.getInt16()
-            elif subatomicType == STInt32:
+            elif subatomicType == DCSubatomicType.STInt32:
                 retVal = self.getInt32()
-            elif subatomicType == STInt64:
+            elif subatomicType == DCSubatomicType.STInt64:
                 retVal = self.getInt64()
-            elif subatomicType == STUint8:
+            elif subatomicType == DCSubatomicType.STUint8:
                 retVal = self.getUint8()
-            elif subatomicType == STUint16:
+            elif subatomicType == DCSubatomicType.STUint16:
                 retVal = self.getUint16()
-            elif subatomicType == STUint32:
+            elif subatomicType == DCSubatomicType.STUint32:
                 retVal = self.getUint32()
-            elif subatomicType == STUint64:
+            elif subatomicType == DCSubatomicType.STUint64:
                 retVal = self.getUint64()
-            elif subatomicType == STFloat64:
+            elif subatomicType == DCSubatomicType.STFloat64:
                 retVal = self.getFloat64()
-            elif subatomicType == STString:
+            elif subatomicType == DCSubatomicType.STString:
                 retVal = self.getString()
-            elif subatomicType == STBlob:
+            elif subatomicType == DCSubatomicType.STBlob:
                 retVal = self.getString()
-            elif subatomicType == STInt8array:
+            elif subatomicType == DCSubatomicType.STInt8array:
                 len = self.getUint16()
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt8())
-            elif subatomicType == STInt16array:
+            elif subatomicType == DCSubatomicType.STInt16array:
                 len = self.getUint16() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt16())
-            elif subatomicType == STInt32array:
+            elif subatomicType == DCSubatomicType.STInt32array:
                 len = self.getUint16() >> 2
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt32())
-            elif subatomicType == STUint8array:
+            elif subatomicType == DCSubatomicType.STUint8array:
                 len = self.getUint16()
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint8())
-            elif subatomicType == STUint16array:
+            elif subatomicType == DCSubatomicType.STUint16array:
                 len = self.getUint16() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint16())
-            elif subatomicType == STUint32array:
+            elif subatomicType == DCSubatomicType.STUint32array:
                 len = self.getUint16() >> 2
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint32())
-            elif subatomicType == STUint32uint8array:
+            elif subatomicType == DCSubatomicType.STUint32uint8array:
                 len = self.getUint16() / 5
                 retVal = []
                 for i in range(len):
@@ -67,59 +67,59 @@
                 raise Exception("Error: No such type as: " + str(subAtomicType))
         else:
             # This needs to be divided
-            if subatomicType == STInt8:
+            if subatomicType == DCSubatomicType.STInt8:
                 retVal = (self.getInt8()/float(divisor))
-            elif subatomicType == STInt16:
+            elif subatomicType == DCSubatomicType.STInt16:
                 retVal = (self.getInt16()/float(divisor))
-            elif subatomicType == STInt32:
+            elif subatomicType == DCSubatomicType.STInt32:
                 retVal = (self.getInt32()/float(divisor))
-            elif subatomicType == STInt64:
+            elif subatomicType == DCSubatomicType.STInt64:
                 retVal = (self.getInt64()/float(divisor))
-            elif subatomicType == STUint8:
+            elif subatomicType == DCSubatomicType.STUint8:
                 retVal = (self.getUint8()/float(divisor))
-            elif subatomicType == STUint16:
+            elif subatomicType == DCSubatomicType.STUint16:
                 retVal = (self.getUint16()/float(divisor))
-            elif subatomicType == STUint32:
+            elif subatomicType == DCSubatomicType.STUint32:
                 retVal = (self.getUint32()/float(divisor))
-            elif subatomicType == STUint64:
+            elif subatomicType == DCSubatomicType.STUint64:
                 retVal = (self.getUint64()/float(divisor))
-            elif subatomicType == STFloat64:
+            elif subatomicType == DCSubatomicType.STFloat64:
                 retVal = self.getFloat64()
-            elif subatomicType == STString:
+            elif subatomicType == DCSubatomicType.STString:
                 retVal = self.getString()
-            elif subatomicType == STBlob:
+            elif subatomicType == DCSubatomicType.STBlob:
                 retVal = self.getString()
-            elif subatomicType == STInt8array:
+            elif subatomicType == DCSubatomicType.STInt8array:
                 len = self.getUint8() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt8()/float(divisor))
-            elif subatomicType == STInt16array:
+            elif subatomicType == DCSubatomicType.STInt16array:
                 len = self.getUint16() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt16()/float(divisor))
-            elif subatomicType == STInt32array:
+            elif subatomicType == DCSubatomicType.STInt32array:
                 len = self.getUint16() >> 2
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getInt32()/float(divisor))
-            elif subatomicType == STUint8array:
+            elif subatomicType == DCSubatomicType.STUint8array:
                 len = self.getUint8() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint8()/float(divisor))
-            elif subatomicType == STUint16array:
+            elif subatomicType == DCSubatomicType.STUint16array:
                 len = self.getUint16() >> 1
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint16()/float(divisor))
-            elif subatomicType == STUint32array:
+            elif subatomicType == DCSubatomicType.STUint32array:
                 len = self.getUint16() >> 2
                 retVal = []
                 for i in range(len):
                     retVal.append(self.getUint32()/float(divisor))
-            elif subatomicType == STUint32uint8array:
+            elif subatomicType == DCSubatomicType.STUint32uint8array:
                 len = self.getUint16() / 5
                 retVal = []
                 for i in range(len):

+ 3 - 3
direct/src/extensions/MouseWatcherRegion-extensions.py

@@ -13,14 +13,14 @@
         node parented within the render2d hierarchy.
 
         """
-        from PandaModules import *
+        import Point3
         
         # Get the relative transform to the node.
         mat = np.getMat(render2d)
 
         # Use this matrix to transform the corners of the region.
-        ll = mat.xformPoint(Point3(left, 0, bottom))
-        ur = mat.xformPoint(Point3(right, 0, top))
+        ll = mat.xformPoint(Point3.Point3(left, 0, bottom))
+        ur = mat.xformPoint(Point3.Point3(right, 0, top))
 
         # Set the frame to the transformed coordinates.
         self.setFrame(ll[0], ur[0], ll[2], ur[2])

+ 4 - 3
direct/src/extensions/Node-extensions.py

@@ -7,11 +7,12 @@
     def isHidden(self):
         """Determine if a node is hidden.  Just pick the first parent,
         since this is an ambiguous question for instanced nodes"""
-        from PandaModules import *
-        rrClass = RenderRelation.getClassType()
+        import RenderRelation
+        import PruneTransition
+        rrClass = RenderRelation.RenderRelation.getClassType()
         if self.getNumParents(rrClass) > 0:
             arc = self.getParent(rrClass, 0)
-            if arc.hasTransition(PruneTransition.getClassType()):
+            if arc.hasTransition(PruneTransition.PruneTransition.getClassType()):
                 return 1
             else:
                 return arc.getParent().isHidden()

+ 12 - 14
direct/src/extensions/NodePath-extensions.py

@@ -84,7 +84,6 @@
 
     def remove(self):
         """Remove a node path from the scene graph"""
-        from PandaObject import *
         # Send message in case anyone needs to do something
         # before node is deleted
         messenger.send('preRemoveNodePath', [self])
@@ -112,9 +111,9 @@
             return [self]
 
     def getTightBounds(self):
-        from Point3 import Point3
-        v1 = Point3(0)
-        v2 = Point3(0)
+        import Point3
+        v1 = Point3.Point3(0)
+        v2 = Point3.Point3(0)
         self.calcTightBounds(v1,v2)
         return v1, v2
 
@@ -272,8 +271,9 @@
         # functorFunc is a function which can be called to create a functor.
         # functor creation is defered so initial state (sampled in functorFunc)
         # will be appropriate for the time the lerp is spawned
-        from TaskManagerGlobal import *
-
+        import Task
+        from TaskManagerGlobal import taskMgr
+        
         # upon death remove the functorFunc
         def lerpUponDeath(task):
             # Try to break circular references
@@ -327,8 +327,6 @@
         This lerp uses C++ to handle the stepping. Bonus is
         its more efficient, trade-off is there is less control"""
         import AutonomousLerp
-        # from ShowBaseGlobal import *
-
         # make a lerp that lives in C++ land
         functor = functorFunc()
         lerp = AutonomousLerp.AutonomousLerp(functor, time,
@@ -789,8 +787,8 @@
     def place(self):
         base.wantDIRECT = 1
         base.wantTk = 1
-        from ShowBaseGlobal import *
-        from DirectSession import *
+        #from ShowBaseGlobal import *
+        #from DirectSession import *
         import TkGlobal
         import Placer
         return Placer.place(self)
@@ -798,7 +796,7 @@
     def explore(self):
         base.wantDIRECT = 1
         base.wantTk = 1
-        from ShowBaseGlobal import *
+        #from ShowBaseGlobal import *
         import TkGlobal
         import SceneGraphExplorer
         return SceneGraphExplorer.explore(self)
@@ -806,7 +804,7 @@
     def rgbPanel(self, cb = None):
         base.wantDIRECT = 1
         base.wantTk = 1
-        from ShowBaseGlobal import *
+        #from ShowBaseGlobal import *
         import TkGlobal
         import EntryScale
         return EntryScale.rgbPanel(self, cb)
@@ -814,14 +812,14 @@
     def select(self):
         base.wantDIRECT = 1
         base.wantTk = 1
-        from ShowBaseGlobal import *
+        #from ShowBaseGlobal import *
         import TkGlobal
         direct.select(self)
 
     def deselect(self):
         base.wantDIRECT = 1
         base.wantTk = 1
-        from ShowBaseGlobal import *
+        #from ShowBaseGlobal import *
         import TkGlobal
         direct.deselect(self)
 

+ 0 - 3
direct/src/ffi/FFIConstants.py

@@ -6,9 +6,6 @@ notify = directNotify.newCategory("FFI")
 # This is the name of the file that the importing code will be stored
 importModuleName = 'PandaModules'
 
-# This is the name of the file where the static helper class will be stored
-staticModuleName = 'PandaStatic'
-
 # A header for all the generated files
 generatedHeader = '# This file is automatically generated. It would be unwise to edit.\n\n'
 

+ 1 - 1
direct/src/ffi/FFIExternalObject.py

@@ -1,6 +1,5 @@
 
 import FFIConstants
-import TypedObject
 
 WrapperClassMap = {}
 
@@ -20,6 +19,7 @@ DowncastMap = {}
 # The type map is used for upcasting and downcasting through
 # the panda inheritance chain
 def registerInTypeMap(pythonClass):
+    import TypedObject
     if issubclass(pythonClass, TypedObject.TypedObject):
         typeIndex = pythonClass.getClassType().getIndex()
         WrapperClassMap[typeIndex] = pythonClass

+ 2 - 18
direct/src/ffi/FFIInterrogateDatabase.py

@@ -141,8 +141,8 @@ def outputImportFileImports(file, typeList, CModuleName):
     file.write('\n')
 
     file.write('# Generate the classes\n')
-    for moduleName in moduleList:
-        file.write(moduleName + '.generateClass_' + moduleName + '()\n')
+    #for moduleName in moduleList:
+    #    file.write(moduleName + '.generateClass_' + moduleName + '()\n')
     file.write('\n')
         
     file.write('# Copy the classes into our own namespace\n')
@@ -159,19 +159,6 @@ def outputImportFileImports(file, typeList, CModuleName):
 
 
 
-def generateStaticClass(codeDir):
-    """
-    Create a file that will hold the static class definition
-    """
-    file = open(os.path.join(codeDir, FFIConstants.staticModuleName + '.py'), 'w')
-    # Print the standard header
-    file.write(FFIConstants.generatedHeader)
-    file.write('class ' + FFIConstants.staticModuleName + ':\n')
-    file.write('    def __init__(self, function):\n')
-    file.write('        self.__call__ = function\n')
-    file.close()
-    return file
-
 def getTypeName(typeIndex, scoped=0):
     """
     Return a fully specified type name for this type index
@@ -696,9 +683,6 @@ class FFIInterrogateDatabase:
 
 
     def generateCode(self, codeDir, extensionsDir):
-        FFIConstants.notify.info( 'Generating static class...')
-        generateStaticClass(codeDir)
-
         # Import all the C++ modules
         for CModuleName in FFIConstants.CodeModuleNameList:
             self.generateCodeLib(codeDir, extensionsDir, CModuleName)

+ 14 - 3
direct/src/ffi/FFIOverload.py

@@ -3,6 +3,7 @@ from types import *
 import string
 import FFIConstants
 import FFISpecs
+import FFITypes
 
 """
 Things that are not supported:
@@ -236,9 +237,9 @@ class FFIMethodArgumentTreeCollection:
         indent(file, nesting+1, '\n')
 
     def outputOverloadedStaticFooter(self, file, nesting):
-        indent(file, nesting+1, self.methodSpecList[0].name + ' = '
-                   + FFIConstants.staticModuleName + '.' + FFIConstants.staticModuleName
-                   + '(' + self.methodSpecList[0].name + ')\n')
+        # foo = staticmethod(foo)
+        methodName = self.methodSpecList[0].name
+        indent(file, nesting+1, methodName + ' = staticmethod(' + methodName + ')\n')
     
     def setup(self):
         for method in self.methodSpecList:
@@ -338,6 +339,16 @@ class FFIMethodArgumentTree:
         sortedKeys = self.tree.keys()
         # Sort the keys based on inheritance hierarchy, most generic classes first
         sortedKeys.sort(subclass)
+        # Import everybody we need
+        for i in range(len(sortedKeys)):
+            typeDesc = sortedKeys[i]
+            if ((typeDesc != 0) and
+                (not typeDesc.isNested) and
+                # Do not put our own module in the import list
+                (self.classTypeDesc != typeDesc) and
+                # If this is a class (not a primitive), put it on the list
+                (typeDesc.__class__ == FFITypes.ClassTypeDescriptor)):
+                indent(file, nesting+2, 'import ' + typeDesc.foreignTypeName + '\n')
         for i in range(len(sortedKeys)):
             typeDesc = sortedKeys[i]
             # See if this takes no arguments

+ 9 - 4
direct/src/ffi/FFISpecs.py

@@ -48,6 +48,13 @@ class FunctionSpecification:
                            methodArgSpec.name + ', types.FloatType) or isinstance(' +
                            methodArgSpec.name + ', types.IntType)))\n')
                 else:
+                    # Get the real return type (not derived)
+                    if ((not typeDesc.isNested) and
+                        # Do not put our own module in the import list
+                        (methodClass != typeDesc) and
+                        # If this is a class (not a primitive), put it on the list
+                        (typeDesc.__class__ == FFITypes.ClassTypeDescriptor)):
+                        indent(file, nesting, 'import ' + typeDesc.foreignTypeName + '\n')
                     indent(file, nesting, 'assert(isinstance(' +
                            methodArgSpec.name + ', ' + typeName + '))\n')
 
@@ -429,10 +436,8 @@ class MethodSpecification(FunctionSpecification):
                                               1, nesting+2)
 
     def outputStaticFooter(self, methodClass, file, nesting):
-        indent(file, nesting+1, self.getFinalName() + ' = '
-                   + FFIConstants.staticModuleName + '.' + FFIConstants.staticModuleName
-                   + '(' + self.getFinalName() + ')\n')
-        indent(file, nesting+1, '\n')        
+        indent(file, nesting+1, self.getFinalName() + ' = staticmethod(' + self.getFinalName() + ')\n')
+        indent(file, nesting+1, '\n')
 
     ##################################################
     ## Upcast Method Code Generation

+ 35 - 29
direct/src/ffi/FFITypes.py

@@ -595,7 +595,6 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
 
     def outputBaseImports(self, file):
         indent(file, 0, '# CMODULE [' + self.moduleName + ']\n')
-        indent(file, 0, 'import ' + FFIConstants.staticModuleName + '\n')
         # Everybody imports types for type checking
         indent(file, 0, 'import types\n')
         indent(file, 0, '\n')
@@ -610,8 +609,9 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
 
 
     def outputImportsRecursively(self, parent, file, nesting):
-        for parentType in parent.parentTypes:
-            self.outputImportsRecursively(parentType, file, nesting)
+        # Not sure why we need to import parent types...
+        #for parentType in parent.parentTypes:
+        #    self.outputImportsRecursively(parentType, file, nesting)
 
         parentTypeName = parent.foreignTypeName
         fullNestedName = parent.getFullNestedName()
@@ -622,10 +622,10 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
         else:
             indent(file, nesting, 'import ' + parent.foreignTypeName + '\n')
 
-        returnTypeModules = parent.getReturnTypeModules()
-        if len(returnTypeModules):
-            for moduleName in returnTypeModules:
-                indent(file, nesting, 'import ' + moduleName + '\n')
+        #returnTypeModules = parent.getReturnTypeModules()
+        #if len(returnTypeModules):
+        #    for moduleName in returnTypeModules:
+        #        indent(file, nesting, 'import ' + moduleName + '\n')
         
 
     def outputImports(self, file, nesting):
@@ -636,10 +636,10 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
         indent(file, nesting, '# and all the shadow class modules this class uses\n')
 
         # Output all of our return types
-        returnTypeModules = self.getReturnTypeModules()
-        if len(returnTypeModules):
-            for moduleName in returnTypeModules:
-                indent(file, nesting, 'import ' + moduleName + '\n')
+        #returnTypeModules = self.getReturnTypeModules()
+        #if len(returnTypeModules):
+        #    for moduleName in returnTypeModules:
+        #        indent(file, nesting, 'import ' + moduleName + '\n')
        
         for parentType in self.parentTypes:
             self.outputImportsRecursively(parentType, file, nesting)
@@ -669,22 +669,25 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
         if (self.foreignTypeName == ''):
             FFIConstants.notify.warning('Class with no name')
 
-        # If this is the toplevel, we need to delay the generation of this
-        # class to avoid circular imports, so put the entire class in a function
-        # that we will call later
-        if (nesting==0):
-            indent(file, nesting, '# Delay the definition of this class until all the imports are done\n')
-            indent(file, nesting, '# Make sure we only define this class once\n')
-            indent(file, nesting, 'classDefined = 0\n')
-            indent(file, nesting, 'def generateClass_' + self.foreignTypeName + '():\n')
-            indent(file, nesting, ' if classDefined: return\n')
-            indent(file, nesting, ' global classDefined\n')
-            indent(file, nesting, ' classDefined = 1\n')
-            # Start the class definition indented a space to account for the function
-            indent(file, nesting, ' class ' + self.foreignTypeName)
-        else:
-            # Start the class definition
-            indent(file, nesting, 'class ' + self.foreignTypeName)
+        
+#          # If this is the toplevel, we need to delay the generation of this
+#          # class to avoid circular imports, so put the entire class in a function
+#          # that we will call later
+#          if (nesting==0):
+#              indent(file, nesting, '# Delay the definition of this class until all the imports are done\n')
+#              indent(file, nesting, '# Make sure we only define this class once\n')
+#              indent(file, nesting, 'classDefined = 0\n')
+#              indent(file, nesting, 'def generateClass_' + self.foreignTypeName + '():\n')
+#              indent(file, nesting, ' if classDefined: return\n')
+#              indent(file, nesting, ' global classDefined\n')
+#              indent(file, nesting, ' classDefined = 1\n')
+#              # Start the class definition indented a space to account for the function
+#              indent(file, nesting, ' class ' + self.foreignTypeName)
+#          else:
+#              # Start the class definition
+#              indent(file, nesting, 'class ' + self.foreignTypeName)
+
+        indent(file, nesting, 'class ' + self.foreignTypeName)
 
         # Everybody inherits from FFIExternalObject
         file.write('(')
@@ -726,8 +729,9 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
 
 
     def outputClassFooter(self, file):
-        indent(file, 0, " # When this class gets defined, put it in this module's namespace\n")
-        indent(file, 0, " globals()['" + self.foreignTypeName + "'] = " + self.foreignTypeName + '\n')
+        #indent(file, 0, " # When this class gets defined, put it in this module's namespace\n")
+        #indent(file, 0, " globals()['" + self.foreignTypeName + "'] = " + self.foreignTypeName + '\n')
+        pass
 
     
     def outputBaseConstructor(self, file, nesting):
@@ -800,6 +804,8 @@ class ClassTypeDescriptor(BaseTypeDescriptor):
         class destructor with None as the only parameter to get an
         empty shadow object.
         """
+        if classTypeDesc != self:
+            indent(file, nesting, 'import ' + self.foreignTypeName + '\n')
         indent(file, nesting, 'returnObject = ')
         # Do not put Class.Class if this file is the file that defines Class
         # Also check for nested classes. They do not need the module name either

+ 1 - 1
direct/src/interval/Interval.py

@@ -174,7 +174,7 @@ class Interval(DirectObject):
         import fpformat
         import string
         # I moved this here because Toontown does not ship Tk
-        from Tkinter import *
+        from Tkinter import Toplevel, Frame, Button
         import Pmw
         import EntryScale
         if tl == None:

+ 4 - 4
direct/src/showbase/ShowBase.py

@@ -17,7 +17,6 @@ import Task
 import EventManager
 import math
 import sys
-import Transitions
 import Loader
 import time
 import FSM
@@ -128,9 +127,6 @@ class ShowBase:
         self.createAudioManager()
         self.createStats()
 
-        # Transition effects (fade, iris, etc)
-        self.transitions = Transitions.Transitions(self.loader)
-
         self.AppHasAudioFocus = 1
 
         __builtin__.base = self
@@ -148,6 +144,10 @@ class ShowBase:
         __builtin__.ostream = Notify.out()
         __builtin__.directNotify = directNotify
 
+        # Transition effects (fade, iris, etc)
+        import Transitions
+        self.transitions = Transitions.Transitions(self.loader)
+
         # Tk
         if self.wantTk:
             import TkGlobal

+ 1 - 1
direct/src/showbase/Transitions.py

@@ -1,5 +1,6 @@
 
 from PandaModules import *
+from DirectGui import *
 import Task
 
 class Transitions:
@@ -255,7 +256,6 @@ class Transitions:
 
     def loadFade(self):
         if self.fade == None:
-            from DirectGui import *
 
             # We create a DirectFrame for the fade polygon, instead of
             # simply loading the polygon model and using it directly,

+ 2 - 2
direct/src/task/Task.py

@@ -583,8 +583,8 @@ class TaskManager:
             task.setStartTimeFrame(self.currentTime, self.currentFrame)
 
     def popupControls(self):
-        from TaskManagerPanel import *
-        return TaskManagerPanel(self)
+        import TaskManagerPanel
+        return TaskManagerPanel.TaskManagerPanel(self)
 
 
 """