Browse Source

Merge remote-tracking branch 'upstream/master' into cmake

kestred 12 years ago
parent
commit
b25669af6f
100 changed files with 422 additions and 479 deletions
  1. 3 3
      direct/src/actor/Actor.py
  2. 11 11
      direct/src/cluster/ClusterClient.py
  3. 7 7
      direct/src/cluster/ClusterServer.py
  4. 9 0
      direct/src/directscripts/packpanda.nsi
  5. 1 1
      direct/src/directscripts/packpanda.py
  6. 2 2
      direct/src/directtools/DirectLights.py
  7. 7 7
      direct/src/directtools/DirectSession.py
  8. 1 1
      direct/src/directtools/DirectUtil.py
  9. 5 8
      direct/src/directutil/DirectMySQLdbConnection.py
  10. 4 4
      direct/src/distributed/CRCache.py
  11. 1 1
      direct/src/distributed/ClientRepository.py
  12. 5 5
      direct/src/distributed/ClientRepositoryBase.py
  13. 1 1
      direct/src/distributed/DistributedCartesianGridAI.py
  14. 2 2
      direct/src/distributed/DistributedObjectGlobalUD.py
  15. 6 6
      direct/src/distributed/DoInterestManager.py
  16. 1 1
      direct/src/distributed/MsgTypes.py
  17. 1 1
      direct/src/distributed/MsgTypesCMU.py
  18. 1 1
      direct/src/distributed/OldClientRepository.py
  19. 3 3
      direct/src/distributed/ParentMgr.py
  20. 2 2
      direct/src/distributed/ServerRepository.py
  21. 15 25
      direct/src/extensions_native/CInterval_extensions.py
  22. 0 4
      direct/src/extensions_native/EggGroupNode_extensions.py
  23. 0 4
      direct/src/extensions_native/EggPrimitive_extensions.py
  24. 0 4
      direct/src/extensions_native/HTTPChannel_extensions.py
  25. 0 4
      direct/src/extensions_native/Mat3_extensions.py
  26. 0 4
      direct/src/extensions_native/NodePathCollection_extensions.py
  27. 4 6
      direct/src/extensions_native/NodePath_extensions.py
  28. 0 4
      direct/src/extensions_native/OdeBody_extensions.py
  29. 0 4
      direct/src/extensions_native/OdeGeom_extensions.py
  30. 0 4
      direct/src/extensions_native/OdeJoint_extensions.py
  31. 0 4
      direct/src/extensions_native/OdeSpace_extensions.py
  32. 0 4
      direct/src/extensions_native/Ramfile_extensions.py
  33. 0 4
      direct/src/extensions_native/StreamReader_extensions.py
  34. 0 5
      direct/src/extensions_native/VBase3_extensions.py
  35. 0 5
      direct/src/extensions_native/VBase4_extensions.py
  36. 43 18
      direct/src/extensions_native/extension_native_helpers.py
  37. 29 6
      direct/src/ffi/DoGenPyCode.py
  38. 1 1
      direct/src/ffi/FFIEnvironment.py
  39. 1 1
      direct/src/ffi/FFIInterrogateDatabase.py
  40. 1 1
      direct/src/ffi/FFIOverload.py
  41. 1 1
      direct/src/ffi/FFIRename.py
  42. 52 52
      direct/src/filter/CommonFilters.py
  43. 6 7
      direct/src/fsm/State.py
  44. 1 1
      direct/src/fsm/StatePush.py
  45. 3 3
      direct/src/gui/DirectDialog.py
  46. 5 5
      direct/src/gui/DirectGuiBase.py
  47. 1 1
      direct/src/gui/DirectGuiTest.py
  48. 3 3
      direct/src/gui/DirectScrolledList.py
  49. 1 1
      direct/src/gui/DirectWaitBar.py
  50. 1 1
      direct/src/http/WebRequest.py
  51. 3 3
      direct/src/http/webAIInspector.py
  52. 3 4
      direct/src/interval/FunctionInterval.py
  53. 4 4
      direct/src/interval/MetaInterval.py
  54. 3 3
      direct/src/leveleditor/ObjectPropertyUI.py
  55. 7 7
      direct/src/p3d/DeploymentTools.py
  56. 2 2
      direct/src/p3d/FileSpec.py
  57. 6 6
      direct/src/p3d/PackageInfo.py
  58. 5 6
      direct/src/p3d/Packager.py
  59. 1 1
      direct/src/p3d/packp3d.py
  60. 2 0
      direct/src/p3d/panda3d.pdef
  61. 1 1
      direct/src/particles/ParticleEffect.py
  62. 26 26
      direct/src/particles/Particles.py
  63. 2 2
      direct/src/plugin/p3dPythonRun.cxx
  64. 1 1
      direct/src/plugin_installer/make_installer.py
  65. 1 1
      direct/src/plugin_standalone/make_osx_bundle.py
  66. 1 1
      direct/src/pyinst/finder.py
  67. 1 1
      direct/src/pyinst/imputil.py
  68. 6 6
      direct/src/pyinst/modulefinder.py
  69. 1 1
      direct/src/pyinst/resource.py
  70. 3 3
      direct/src/showbase/Audio3DManager.py
  71. 10 10
      direct/src/showbase/ElementTree.py
  72. 0 1
      direct/src/showbase/ExceptionVarDump.py
  73. 1 1
      direct/src/showbase/Factory.py
  74. 18 19
      direct/src/showbase/Finder.py
  75. 1 2
      direct/src/showbase/Messenger.py
  76. 32 50
      direct/src/showbase/PythonUtil.py
  77. 1 1
      direct/src/showbase/ShowBase.py
  78. 1 2
      direct/src/showbase/VFSImporter.py
  79. 1 1
      direct/src/showbase/VerboseImport.py
  80. 1 1
      direct/src/showutil/FreezeTool.py
  81. 1 1
      direct/src/showutil/TexMemWatcher.py
  82. 3 4
      direct/src/task/Task.py
  83. 2 3
      direct/src/tkpanels/DirectSessionPanel.py
  84. 1 1
      direct/src/tkpanels/FSMInspector.py
  85. 3 3
      direct/src/tkpanels/Inspector.py
  86. 1 1
      direct/src/tkpanels/MopathRecorder.py
  87. 2 2
      direct/src/tkpanels/ParticlePanel.py
  88. 1 1
      direct/src/tkpanels/Placer.py
  89. 1 2
      direct/src/tkwidgets/EntryScale.py
  90. 1 2
      direct/src/tkwidgets/Floater.py
  91. 1 1
      direct/src/tkwidgets/Slider.py
  92. 3 3
      direct/src/tkwidgets/Tree.py
  93. 3 5
      direct/src/tkwidgets/Valuator.py
  94. 1 2
      direct/src/tkwidgets/VectorWidgets.py
  95. 12 12
      direct/src/wxwidgets/WxPandaShell.py
  96. 0 3
      dtool/Config.Android.pp
  97. 0 3
      dtool/Config.FreeBSD.pp
  98. 0 3
      dtool/Config.Irix.pp
  99. 0 3
      dtool/Config.Linux.pp
  100. 0 3
      dtool/Config.OSX.pp

+ 3 - 3
direct/src/actor/Actor.py

@@ -1006,7 +1006,7 @@ class Actor(DirectObject, NodePath):
             return
 
         # remove the part
-        if (partBundleDict.has_key(partName)):
+        if (partName in partBundleDict):
             partBundleDict[partName].partBundleNP.removeNode()
             del(partBundleDict[partName])
 
@@ -1019,7 +1019,7 @@ class Actor(DirectObject, NodePath):
             return
 
         # remove the animations
-        if (partDict.has_key(partName)):
+        if (partName in partDict):
             del(partDict[partName])
 
         # remove the bundle handle, in case this part is ever
@@ -1802,7 +1802,7 @@ class Actor(DirectObject, NodePath):
                 # Get all main parts, but not sub-parts.
                 animDictItems = []
                 for thisPart, animDict in partDict.items():
-                    if not self.__subpartDict.has_key(thisPart):
+                    if thisPart not in self.__subpartDict:
                         animDictItems.append((thisPart, animDict))
 
             else:

+ 11 - 11
direct/src/cluster/ClusterClient.py

@@ -137,7 +137,7 @@ class ClusterClient(DirectObject.DirectObject):
             object     = pair[1]
             name       = self.controlMappings[object][0]
             serverList = self.controlMappings[object][1]
-            if (self.objectMappings.has_key(object)):
+            if (object in self.objectMappings):
                 self.moveObject(self.objectMappings[object],name,serverList,
                                 self.controlOffsets[object], self.objectHasColor[object])
         self.sendNamedMovementDone()
@@ -204,20 +204,20 @@ class ClusterClient(DirectObject.DirectObject):
 
 
     def addNamedObjectMapping(self,object,name,hasColor = True):
-        if (not self.objectMappings.has_key(name)):
+        if (name not in self.objectMappings):
             self.objectMappings[name] = object
             self.objectHasColor[name] = hasColor
         else:
             self.notify.debug('attempt to add duplicate named object: '+name)
 
     def removeObjectMapping(self,name):
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings.pop(name)
 
 
     def addControlMapping(self,objectName,controlledName, serverList = None,
                           offset = None, priority = 0):
-        if (not self.controlMappings.has_key(objectName)):
+        if (objectName not in self.controlMappings):
             if (serverList == None):
                 serverList = range(len(self.serverList))
             if (offset == None):
@@ -239,11 +239,11 @@ class ClusterClient(DirectObject.DirectObject):
             #self.notify.debug('attempt to add duplicate controlled object: '+name)
 
     def setControlMappingOffset(self,objectName,offset):
-        if (self.controlMappings.has_key(objectName)):
+        if (objectName in self.controlMappings):
             self.controlOffsets[objectName] = offset
 
     def removeControlMapping(self,name, serverList = None):
-        if (self.controlMappings.has_key(name)):
+        if (name in self.controlMappings):
 
             if (serverList == None):
                 self.controlMappings.pop(name)
@@ -299,7 +299,7 @@ class ClusterClient(DirectObject.DirectObject):
 
     def selectNodePath(self, nodePath):
         name = self.getNodePathName(nodePath)
-        if self.taggedObjects.has_key(name):
+        if name in self.taggedObjects:
             taskMgr.remove("moveSelectedTask")
             tag = self.taggedObjects[name]
             function = tag["selectFunction"]
@@ -312,7 +312,7 @@ class ClusterClient(DirectObject.DirectObject):
 
     def deselectNodePath(self, nodePath):
         name = self.getNodePathName(nodePath)
-        if self.taggedObjects.has_key(name):
+        if name in self.taggedObjects:
             tag = self.taggedObjects[name]
             function = tag["deselectFunction"]
             args     = tag["deselectArgs"]        
@@ -323,7 +323,7 @@ class ClusterClient(DirectObject.DirectObject):
 
     def sendCamFrustum(self, focalLength, filmSize, filmOffset, indexList=[]):
         if indexList:
-            serverList = map(lambda i: self.serverList[i], indexList)
+            serverList = [self.serverList[i] for i in indexList]
         else:
             serverList = self.serverList
         for server in serverList:
@@ -381,7 +381,7 @@ class ClusterClient(DirectObject.DirectObject):
         #print "name"
         #if (name == "camNode"):
         #    print x,y,z,h,p,r, sx, sy, sz,red,g,b,a, hidden
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             if (self.objectHasColor[name]):
@@ -598,7 +598,7 @@ def createClusterClient():
     # setup camera offsets based on cluster-config
     clusterConfig = base.config.GetString('cluster-config', 'single-server')
     # No cluster config specified!
-    if not ClientConfigs.has_key(clusterConfig):
+    if clusterConfig not in ClientConfigs:
         base.notify.warning(
             'createClusterClient: %s cluster-config is undefined.' %
             clusterConfig)

+ 7 - 7
direct/src/cluster/ClusterServer.py

@@ -102,14 +102,14 @@ class ClusterServer(DirectObject.DirectObject):
 
     def addNamedObjectMapping(self,object,name,hasColor = True,
                               priority = 0):
-        if (not self.objectMappings.has_key(name)):
+        if (name not in self.objectMappings):
             self.objectMappings[name] = object
             self.objectHasColor[name] = hasColor
         else:
             self.notify.debug('attempt to add duplicate named object: '+name)
 
     def removeObjectMapping(self,name):
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings.pop(name)
 
 
@@ -125,7 +125,7 @@ class ClusterServer(DirectObject.DirectObject):
 
     def addControlMapping(self,objectName,controlledName, offset = None,
                           priority = 0):
-        if (not self.controlMappings.has_key(objectName)):
+        if (objectName not in self.controlMappings):
             self.controlMappings[objectName] = controlledName
             if (offset == None):
                 offset = Vec3(0,0,0)
@@ -136,12 +136,12 @@ class ClusterServer(DirectObject.DirectObject):
             self.notify.debug('attempt to add duplicate controlled object: '+name)
 
     def setControlMappingOffset(self,objectName,offset):
-        if (self.controlMappings.has_key(objectName)):
+        if (objectName in self.controlMappings):
             self.controlOffsets[objectName] = offset
     
 
     def removeControlMapping(self,name):
-        if (self.controlMappings.has_key(name)):
+        if (name in self.controlMappings):
             self.controlMappings.pop(name)
             self.controlPriorities.pop(name)
         self.redoSortedPriorities()
@@ -156,7 +156,7 @@ class ClusterServer(DirectObject.DirectObject):
         for pair in self.sortedControlPriorities:
             object = pair[1]
             name   = self.controlMappings[object] 
-            if (self.objectMappings.has_key(object)):
+            if (object in self.objectMappings):
                 self.moveObject(self.objectMappings[object],name,self.controlOffsets[object],
                                 self.objectHasColor[object])
 
@@ -297,7 +297,7 @@ class ClusterServer(DirectObject.DirectObject):
     def handleNamedMovement(self, data):
         """ Update cameraJig position to reflect latest position """
         (name,x, y, z, h, p, r,sx,sy,sz, red, g, b, a, hidden) = data
-        if (self.objectMappings.has_key(name)):
+        if (name in self.objectMappings):
             self.objectMappings[name].setPosHpr(render, x, y, z, h, p, r)
             self.objectMappings[name].setScale(render,sx,sy,sz)
             self.objectMappings[name].setColor(red,g,b,a)

+ 9 - 0
direct/src/directscripts/packpanda.nsi

@@ -22,6 +22,7 @@
 ;   PANDACONF     - name of panda config directory - usually $PANDA\etc 
 ;   PSOURCE       - location of the panda source-tree if available, OR location of panda install tree.
 ;   PYEXTRAS      - directory containing python extras, if any.
+;   REGVIEW       - either 32 or 64, depending on the build architecture.
 ;
 ;   PPGAME      - directory containing prepagaged game, if any        (ie, "C:\My Games\Airblade")
 ;   PPMAIN      - python program containing prepackaged game, if any  (ie, "Airblade.py")
@@ -240,6 +241,10 @@ SectionEnd
 
 Section -post
 
+        !ifdef REGVIEW
+        SetRegView ${REGVIEW}
+        !endif
+
         !ifndef PPGAME
 
         # Add the "bin" directory to the PATH.
@@ -282,6 +287,10 @@ SectionEnd
 
 Section Uninstall
 
+        !ifdef REGVIEW
+        SetRegView ${REGVIEW}
+        !endif
+
         !ifndef PPGAME
         Push "$INSTDIR\python"
         Call un.RemoveFromPath

+ 1 - 1
direct/src/directscripts/packpanda.py

@@ -165,7 +165,7 @@ if (sys.platform == "win32"):
 
 def limitedCopyTree(src, dst, rmdir):
     if (os.path.isdir(src)):
-        if (rmdir.has_key(os.path.basename(src))):
+        if (os.path.basename(src) in rmdir):
             return
         if (not os.path.isdir(dst)): os.mkdir(dst)
         for x in os.listdir(src):

+ 2 - 2
direct/src/directtools/DirectLights.py

@@ -48,11 +48,11 @@ class DirectLights(NodePath):
             self.delete(light)
 
     def asList(self):
-        return map(lambda n, s=self: s[n], self.getNameList())
+        return [self[n] for n in self.getNameList()]
 
     def getNameList(self):
         # Return a sorted list of all lights in the light dict
-        nameList = map(lambda x: x.getName(), self.lightDict.values())
+        nameList = [x.getName() for x in self.lightDict.values()]
         nameList.sort()
         return nameList
 

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

@@ -42,7 +42,7 @@ class DirectSession(DirectObject):
         self.fIgnoreDirectOnlyKeyMap = 0 # [gjeon] to skip old direct controls in new LE
 
         self.drList = DisplayRegionList()
-        self.iRayList = map(lambda x: x.iRay, self.drList)
+        self.iRayList = [x.iRay for x in self.drList]
         self.dr = self.drList[0]
         self.win = base.win
         self.camera = base.camera
@@ -196,8 +196,8 @@ class DirectSession(DirectObject):
                               'alt', 'alt-up', 'alt-repeat',
                                ]
 
-        keyList = map(chr, range(97, 123))
-        keyList.extend(map(chr, range(48, 58)))
+        keyList = [chr(i) for i in range(97, 123)]
+        keyList.extend([chr(i) for i in range(48, 58)])
         keyList.extend(["`", "-", "=", "[", "]", ";", "'", ",", ".", "/", "\\"])
 
         self.specialKeys = ['escape', 'delete', 'page_up', 'page_down', 'enter']
@@ -209,8 +209,8 @@ class DirectSession(DirectObject):
             return "shift-%s"%a
 
         self.keyEvents = keyList[:]
-        self.keyEvents.extend(map(addCtrl, keyList))
-        self.keyEvents.extend(map(addShift, keyList))        
+        self.keyEvents.extend(list(map(addCtrl, keyList)))
+        self.keyEvents.extend(list(map(addShift, keyList)))        
         self.keyEvents.extend(self.specialKeys)
 
         self.mouseEvents = ['mouse1', 'mouse1-up',
@@ -996,7 +996,7 @@ class DirectSession(DirectObject):
             # Get last item off of redo list
             undoGroup = self.popUndoGroup()
             # Record redo information
-            nodePathList = map(lambda x: x[0], undoGroup)
+            nodePathList = [x[0] for x in undoGroup]
             self.pushRedo(nodePathList)
             # Now undo xform for group
             for pose in undoGroup:
@@ -1010,7 +1010,7 @@ class DirectSession(DirectObject):
             # Get last item off of redo list
             redoGroup = self.popRedoGroup()
             # Record undo information
-            nodePathList = map(lambda x: x[0], redoGroup)
+            nodePathList = [x[0] for x in redoGroup]
             self.pushUndo(nodePathList, fResetRedo = 0)
             # Redo xform
             for pose in redoGroup:

+ 1 - 1
direct/src/directtools/DirectUtil.py

@@ -79,7 +79,7 @@ def getFileData(filename, separator = ','):
         if l:
             # If its a valid line, split on separator and
             # strip leading/trailing whitespace from each element
-            data = map(lambda s: s.strip(), l.split(separator))
+            data = [s.strip() for s in l.split(separator)]
             fileData.append(data)
     return fileData
 

+ 5 - 8
direct/src/directutil/DirectMySQLdbConnection.py

@@ -8,19 +8,16 @@ class DirectMySQLdbConnection(Connection):
         from MySQLdb.constants import CLIENT, FIELD_TYPE
         from MySQLdb.converters import conversions
         from weakref import proxy, WeakValueDictionary
-        
+
         import types
 
         kwargs2 = kwargs.copy()
-        
-        if kwargs.has_key('conv'):
-            conv = kwargs['conv']
-        else:
-            conv = conversions
+
+        conv = kwargs.get('conv', conversions)
 
         kwargs2['conv'] = dict([ (k, v) for k, v in conv.items()
                                  if type(k) is int ])
-    
+
         self.cursorclass = kwargs2.pop('cursorclass', self.default_cursor)
         charset = kwargs2.pop('charset', '')
 
@@ -28,7 +25,7 @@ class DirectMySQLdbConnection(Connection):
             use_unicode = True
         else:
             use_unicode = False
-            
+
         use_unicode = kwargs2.pop('use_unicode', use_unicode)
         sql_mode = kwargs2.pop('sql_mode', '')
 

+ 4 - 4
direct/src/distributed/CRCache.py

@@ -59,7 +59,7 @@ class CRCache:
         doId = distObj.getDoId()
         # Error check
         success = False
-        if self.dict.has_key(doId):
+        if doId in self.dict:
             CRCache.notify.warning("Double cache attempted for distObj "
                                    + str(doId))
         else:
@@ -89,7 +89,7 @@ class CRCache:
 
     def retrieve(self, doId):
         assert self.checkCache()
-        if self.dict.has_key(doId):
+        if doId in self.dict:
             # Find the object
             distObj = self.dict[doId]
             # Remove it from the dictionary
@@ -103,11 +103,11 @@ class CRCache:
             return None
 
     def contains(self, doId):
-        return self.dict.has_key(doId)
+        return doId in self.dict
 
     def delete(self, doId):
         assert self.checkCache()
-        assert self.dict.has_key(doId)
+        assert doId in self.dict
         # Look it up
         distObj = self.dict[doId]
         # Remove it from the dict and fifo

+ 1 - 1
direct/src/distributed/ClientRepository.py

@@ -372,7 +372,7 @@ class ClientRepository(ClientRepositoryBase):
         This is not a distributed message and does not delete the
         object on the server or on any other client.
         """
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # If it is in the dictionary, remove it.
             obj = self.doId2do[doId]
             # Remove it from the dictionary

+ 5 - 5
direct/src/distributed/ClientRepositoryBase.py

@@ -221,7 +221,7 @@ class ClientRepositoryBase(ConnectionRepository):
         return Task.done
 
     def generateWithRequiredFields(self, dclass, doId, di, parentId, zoneId):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # Just update it.
             distObj = self.doId2do[doId]
@@ -269,7 +269,7 @@ class ClientRepositoryBase(ConnectionRepository):
 
     def generateWithRequiredOtherFields(self, dclass, doId, di,
                                         parentId = None, zoneId = None):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # Just update it.
             distObj = self.doId2do[doId]
@@ -315,7 +315,7 @@ class ClientRepositoryBase(ConnectionRepository):
         return distObj
 
     def generateWithRequiredOtherFieldsOwner(self, dclass, doId, di):
-        if self.doId2ownerView.has_key(doId):
+        if doId in self.doId2ownerView:
             # ...it is in our dictionary.
             # Just update it.
             self.notify.error('duplicate owner generate for %s (%s)' % (
@@ -359,7 +359,7 @@ class ClientRepositoryBase(ConnectionRepository):
     def disableDoId(self, doId, ownerView=False):
         table, cache = self.getTables(ownerView)
         # Make sure the object exists
-        if table.has_key(doId):
+        if doId in table:
             # Look up the object
             distObj = table[doId]
             # remove the object from the dictionary
@@ -378,7 +378,7 @@ class ClientRepositoryBase(ConnectionRepository):
                     # make sure we're not leaking
                     distObj.detectLeaks()
 
-        elif self.deferredDoIds.has_key(doId):
+        elif doId in self.deferredDoIds:
             # The object had been deferred.  Great; we don't even have
             # to generate it now.
             del self.deferredDoIds[doId]

+ 1 - 1
direct/src/distributed/DistributedCartesianGridAI.py

@@ -65,7 +65,7 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
 
         # Remove grid parent for this av
         avId = av.doId
-        if self.gridObjects.has_key(avId):
+        if avId in self.gridObjects:
             del self.gridObjects[avId]
 
         # Stop task if there are no more av's being managed

+ 2 - 2
direct/src/distributed/DistributedObjectGlobalUD.py

@@ -35,7 +35,7 @@ class DistributedObjectGlobalUD(DistributedObjectUD):
     def __execMessage(self, message):
         if not self.ExecNamespace:
             # Import some useful variables into the ExecNamespace initially.
-            exec 'from pandac.PandaModules import *' in globals(), self.ExecNamespace
+            exec('from pandac.PandaModules import *', globals(), self.ExecNamespace)
             #self.importExecNamespace()
 
         # Now try to evaluate the expression using ChatInputNormal.ExecNamespace as
@@ -48,7 +48,7 @@ class DistributedObjectGlobalUD(DistributedObjectUD):
             # "import math".  These aren't expressions, so eval()
             # fails, but they can be exec'ed.
             try:
-                exec message in globals(), self.ExecNamespace
+                exec(message, globals(), self.ExecNamespace)
                 return 'ok'
             except:
                 exception = sys.exc_info()[0]

+ 6 - 6
direct/src/distributed/DoInterestManager.py

@@ -147,7 +147,7 @@ class DoInterestManager(DirectObject.DirectObject):
         # still a valid interest handle
         if not isinstance(handle, InterestHandle):
             return False
-        return DoInterestManager._interests.has_key(handle.asInt())
+        return handle.asInt() in DoInterestManager._interests
 
     def updateInterestDescription(self, handle, desc):
         iState = DoInterestManager._interests.get(handle.asInt())
@@ -240,7 +240,7 @@ class DoInterestManager(DirectObject.DirectObject):
         if not event:
             event = self._getAnonymousEvent('removeInterest')
         handle = handle.asInt()
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             existed = True
             intState = DoInterestManager._interests[handle]
             if event:
@@ -287,7 +287,7 @@ class DoInterestManager(DirectObject.DirectObject):
         assert isinstance(handle, InterestHandle)
         existed = False
         handle = handle.asInt()
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             existed = True
             intState = DoInterestManager._interests[handle]
             if intState.isPendingDelete():
@@ -345,7 +345,7 @@ class DoInterestManager(DirectObject.DirectObject):
         exists = False
         if event is None:
             event = self._getAnonymousEvent('alterInterest')
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             if description is not None:
                 DoInterestManager._interests[handle].desc = description
             else:
@@ -427,7 +427,7 @@ class DoInterestManager(DirectObject.DirectObject):
         """
         assert DoInterestManager.notify.debugCall()
         
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             if DoInterestManager._interests[handle].isPendingDelete():
                 # make sure there is no pending event for this interest
                 if DoInterestManager._interests[handle].context == NO_CONTEXT:
@@ -594,7 +594,7 @@ class DoInterestManager(DirectObject.DirectObject):
         DoInterestManager.notify.debug(
             "handleInterestDoneMessage--> Received handle %s, context %s" % (
             handle, contextId))
-        if DoInterestManager._interests.has_key(handle):
+        if handle in DoInterestManager._interests:
             eventsToSend = []
             # if the context matches, send out the event
             if contextId == DoInterestManager._interests[handle].context:

+ 1 - 1
direct/src/distributed/MsgTypes.py

@@ -108,7 +108,7 @@ MsgId2Names = invertDictLossless(MsgName2Id)
     
 # put msg names in module scope, assigned to msg value
 for name, value in MsgName2Id.items():
-    exec '%s = %s' % (name, value)
+    exec('%s = %s' % (name, value))
 del name, value
 
 # These messages are ignored when the client is headed to the quiet zone

+ 1 - 1
direct/src/distributed/MsgTypesCMU.py

@@ -27,5 +27,5 @@ MsgId2Names = invertDictLossless(MsgName2Id)
     
 # put msg names in module scope, assigned to msg value
 for name, value in MsgName2Id.items():
-    exec '%s = %s' % (name, value)
+    exec('%s = %s' % (name, value))
 del name, value

+ 1 - 1
direct/src/distributed/OldClientRepository.py

@@ -168,7 +168,7 @@ class OldClientRepository(ClientRepositoryBase):
         dclass.stopGenerate()
 
     def generateWithRequiredFields(self, dclass, doId, di):
-        if self.doId2do.has_key(doId):
+        if doId in self.doId2do:
             # ...it is in our dictionary.
             # Just update it.
             distObj = self.doId2do[doId]

+ 3 - 3
direct/src/distributed/ParentMgr.py

@@ -57,7 +57,7 @@ class ParentMgr:
             self.pendingParentToken2children[parentToken].remove(child)
 
     def requestReparent(self, child, parentToken):
-        if self.token2nodepath.has_key(parentToken):
+        if parentToken in self.token2nodepath:
             # this parent has registered
             # this child may already be waiting on a different parent;
             # make sure they aren't any more
@@ -82,7 +82,7 @@ class ParentMgr:
             child.reparentTo(hidden)
             
     def registerParent(self, token, parent):
-        if self.token2nodepath.has_key(token):
+        if token in self.token2nodepath:
             self.notify.error(
                 "registerParent: token '%s' already registered, referencing %s" %
                 (token, repr(self.token2nodepath[token])))
@@ -141,7 +141,7 @@ class ParentMgr:
                 del self.pendingChild2parentToken[child]
 
     def unregisterParent(self, token):
-        if not self.token2nodepath.has_key(token):
+        if token not in self.token2nodepath:
             self.notify.warning("unregisterParent: unknown parent token '%s'" %
                                 token)
             return

+ 2 - 2
direct/src/distributed/ServerRepository.py

@@ -699,7 +699,7 @@ class ServerRepository:
         
         if self.notify.getDebug():
             self.notify.debug(
-                "ServerRepository sending to all in zone %s except %s:" % (zoneId, map(lambda c: c.doIdBase, exceptionList)))
+                "ServerRepository sending to all in zone %s except %s:" % (zoneId, [c.doIdBase for c in exceptionList]))
             #datagram.dumpHex(ostream)
 
         for client in self.zonesToClients.get(zoneId, []):
@@ -716,7 +716,7 @@ class ServerRepository:
         
         if self.notify.getDebug():
             self.notify.debug(
-                "ServerRepository sending to all except %s:" % (map(lambda c: c.doIdBase, exceptionList),))
+                "ServerRepository sending to all except %s:" % ([c.doIdBase for c in exceptionList],))
             #datagram.dumpHex(ostream)
 
         for client in self.clientsByConnection.values():

+ 15 - 25
direct/src/extensions_native/CInterval_extensions.py

@@ -1,13 +1,3 @@
-from extension_native_helpers import *
-try:
-  Dtool_PreloadDLL("libp3direct")
-  from libp3direct import *
-except:
-  Dtool_PreloadDLL("libdirect")
-  from libdirect import *
-
-#####################################################################
-
 from direct.directnotify.DirectNotifyGlobal import directNotify
 notify = directNotify.newCategory("Interval")
 Dtool_ObjectToDict(CInterval,"notify", notify)
@@ -26,39 +16,39 @@ del setT
 #####################################################################
 
 def play(self, t0 = 0.0, duration = None, scale = 1.0):
-        self.notify.error("using deprecated CInterval.play() interface")
-        if duration:  # None or 0 implies full length
-            self.start(t0, t0 + duration, scale)
-        else:
-            self.start(t0, -1, scale)
+    self.notify.error("CInterval.play() is deprecated, use start() instead")
+    if duration:  # None or 0 implies full length
+        self.start(t0, t0 + duration, scale)
+    else:
+        self.start(t0, -1, scale)
 
 Dtool_funcToMethod(play, CInterval)
 del play
 #####################################################################
 
 def stop(self):
-        self.notify.error("using deprecated CInterval.stop() interface")
-        self.finish()
+    self.notify.error("CInterval.stop() is deprecated, use finish() instead")
+    self.finish()
 
 Dtool_funcToMethod(stop, CInterval)
 del stop
 #####################################################################
 
 def setFinalT(self):
-        self.notify.error("using deprecated CInterval.setFinalT() interface")
-        self.finish()
+    self.notify.error("CInterval.setFinalT() is deprecated, use finish() instead")
+    self.finish()
 
 Dtool_funcToMethod(setFinalT, CInterval)
 del setFinalT
 #####################################################################
 
 def privPostEvent(self):
-        # Call after calling any of the priv* methods to do any required
-        # Python finishing steps.
-        t = self.getT()
-        if hasattr(self, "setTHooks"):
-            for func in self.setTHooks:
-                func(t)
+    # Call after calling any of the priv* methods to do any required
+    # Python finishing steps.
+    t = self.getT()
+    if hasattr(self, "setTHooks"):
+        for func in self.setTHooks:
+            func(t)
 
 Dtool_funcToMethod(privPostEvent, CInterval)
 del privPostEvent

+ 0 - 4
direct/src/extensions_native/EggGroupNode_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpandaegg")
-from libpandaegg import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #del func

+ 0 - 4
direct/src/extensions_native/EggPrimitive_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpandaegg")
-from libpandaegg import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #del func

+ 0 - 4
direct/src/extensions_native/HTTPChannel_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpandaexpress")
-from libpandaexpress import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #del func

+ 0 - 4
direct/src/extensions_native/Mat3_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)        
 #del func

+ 0 - 4
direct/src/extensions_native/NodePathCollection_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 #####################################################################
 
 # For iterating over children

+ 4 - 6
direct/src/extensions_native/NodePath_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)
 #del func
@@ -15,6 +11,7 @@ of the NodePath class
 ####################################################################
 def id(self):
         """Returns a unique id identifying the NodePath instance"""
+        print "Warning: NodePath.id() is deprecated.  Use hash(NodePath) or NodePath.get_key() instead."
         return self.getKey()
 
 Dtool_funcToMethod(id, NodePath)
@@ -28,7 +25,7 @@ del id
     # For iterating over children
 def getChildrenAsList(self):
         """Converts a node path's child NodePathCollection into a list"""
-        print "Warning: NodePath.getChildrenAsList() is deprecated.  Use getChildren() instead."
+        print "Warning: NodePath.getChildrenAsList() is deprecated.  Use get_children() instead."
         return list(self.getChildren())
 
 Dtool_funcToMethod(getChildrenAsList, NodePath)
@@ -99,6 +96,7 @@ del isolate
 
 def remove(self):
         """Remove a node path from the scene graph"""
+        print "Warning: NodePath.remove() is deprecated.  Use remove_node() instead."
         # Send message in case anyone needs to do something
         # before node is deleted
         messenger.send('preRemoveNodePath', [self])
@@ -148,7 +146,7 @@ del reverseLsNames
 #####################################################################
 def getAncestry(self):
         """Get a list of a node path's ancestors"""
-        print "NodePath.getAncestry() is deprecated.  Use getAncestors() instead."""
+        print "NodePath.getAncestry() is deprecated.  Use get_ancestors() instead."""
         ancestors = list(self.getAncestors())
         ancestors.reverse()
         return ancestors

+ 0 - 4
direct/src/extensions_native/OdeBody_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)
 #del func

+ 0 - 4
direct/src/extensions_native/OdeGeom_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)
 #del func

+ 0 - 4
direct/src/extensions_native/OdeJoint_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)
 #del func

+ 0 - 4
direct/src/extensions_native/OdeSpace_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
 ####################################################################
 #Dtool_funcToMethod(func, class)
 #del func

+ 0 - 4
direct/src/extensions_native/Ramfile_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpandaexpress")
-from libpandaexpress import *
-
 """
 Ramfile_extensions module: contains methods to extend functionality
 of the Ramfile class

+ 0 - 4
direct/src/extensions_native/StreamReader_extensions.py

@@ -1,7 +1,3 @@
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpandaexpress")
-from libpandaexpress import *
-
 """
 StreamReader_extensions module: contains methods to extend functionality
 of the StreamReader class

+ 0 - 5
direct/src/extensions_native/VBase3_extensions.py

@@ -2,11 +2,6 @@
 Methods to extend functionality of the VBase3 class
 """
 
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
-
 def pPrintValues(self):
     """
     Pretty print

+ 0 - 5
direct/src/extensions_native/VBase4_extensions.py

@@ -2,11 +2,6 @@
 Methods to extend functionality of the VBase4 class
 """
 
-from extension_native_helpers import *
-Dtool_PreloadDLL("libpanda")
-from libpanda import *
-
-
 def pPrintValues(self):
     """
     Pretty print

+ 43 - 18
direct/src/extensions_native/extension_native_helpers.py

@@ -1,7 +1,7 @@
 ###  Tools
 __all__ = ["Dtool_ObjectToDict", "Dtool_funcToMethod", "Dtool_PreloadDLL"]
 
-import imp,sys,os
+import imp, sys, os
 
 # The following code exists to work around a problem that exists
 # with Python 2.5 or greater.
@@ -15,6 +15,7 @@ dll_suffix = ''
 if sys.platform == "win32":
     # On Windows, dynamic libraries end in ".dll".
     dll_ext = '.dll'
+    module_ext = '.pyd'
 
     # We allow the caller to preload dll_suffix into the sys module.
     dll_suffix = getattr(sys, 'dll_suffix', None)
@@ -33,9 +34,11 @@ elif sys.platform == "darwin":
         from direct.extensions_native.extensions_darwin import dll_ext
     except ImportError:
         dll_ext = '.dylib'
+    module_ext = '.so'
 else:
     # On most other UNIX systems (including linux), .so is used.
     dll_ext = '.so'
+    module_ext = '.so'
 
 if sys.platform == "win32":
     # On Windows, we must furthermore ensure that the PATH is modified
@@ -51,47 +54,69 @@ if sys.platform == "win32":
             target = dir
     if target == None:
         message = "Cannot find %s" % (filename)
-        raise ImportError, message
+        raise ImportError(message)
 
     # And add that directory to the system path.
     path = os.environ["PATH"]
     if not path.startswith(target + ";"):
         os.environ["PATH"] = target + ";" + path
 
+def Dtool_FindModule(module):
+    # Finds a .pyd module on the Python path.
+    filename = module.replace('.', os.path.sep) + module_ext
+    for dir in sys.path:
+        lib = os.path.join(dir, filename)
+        if (os.path.exists(lib)):
+            return lib
+
+    return None
+
 def Dtool_PreloadDLL(module):
     if module in sys.modules:
         return
 
+    # First find it as a .pyd module on the Python path.
+    if Dtool_FindModule(module):
+        # OK, we should have no problem importing it as is.
+        return
+
+    # Nope, we'll need to search for a dynamic lib and preload it.
     # Search for the appropriate directory.
     target = None
-    filename = module + dll_suffix + dll_ext
+    filename = module.replace('.', os.path.sep) + dll_suffix + dll_ext
     for dir in sys.path + [sys.prefix]:
         lib = os.path.join(dir, filename)
         if (os.path.exists(lib)):
             target = dir
             break
-    if target == None:
+
+    if target is None:
         message = "DLL loader cannot find %s." % (module)
-        raise ImportError, message
+        raise ImportError(message)
 
     # Now import the file explicitly.
     pathname = os.path.join(target, filename)
-    imp.load_dynamic(module, pathname)
+    imp.load_dynamic(module, pathname)    
 
-Dtool_PreloadDLL("libpandaexpress")
-from libpandaexpress import *
+# Nowadays, we can compile libpandaexpress with libpanda into a
+# .pyd file called panda3d/core.pyd which can be imported without
+# any difficulty.  Let's see if this is the case.
+if Dtool_FindModule("panda3d.core"):
+    from panda3d.core import *
+else:
+    Dtool_PreloadDLL("libpandaexpress")
+    from libpandaexpress import *
 
-def Dtool_ObjectToDict(clas, name, obj):
-    clas.DtoolClassDict[name] = obj;
+def Dtool_ObjectToDict(cls, name, obj):
+    cls.DtoolClassDict[name] = obj;
 
-def Dtool_funcToMethod(func, clas, method_name=None):
+def Dtool_funcToMethod(func, cls, method_name=None):
     """Adds func to class so it is an accessible method; use method_name to specify the name to be used for calling the method.
     The new method is accessible to any instance immediately."""
-    func.im_class=clas
-    func.im_func=func
-    func.im_self=None
+    if sys.version_info < (3, 0):
+        func.im_class = cls
+    func.im_func = func
+    func.im_self = None
     if not method_name:
-            method_name = func.__name__
-    clas.DtoolClassDict[method_name] = func;
-
-
+        method_name = func.__name__
+    cls.DtoolClassDict[method_name] = func;

+ 29 - 6
direct/src/ffi/DoGenPyCode.py

@@ -224,7 +224,7 @@ def doErrorCheck():
         FFIConstants.CodeModuleNameList = codeLibs
 
 def generateNativeWrappers():
-    from direct.extensions_native.extension_native_helpers import Dtool_PreloadDLL
+    from direct.extensions_native.extension_native_helpers import Dtool_FindModule, Dtool_PreloadDLL
 
     # Empty out the output directories of unnecessary crud from
     # previous runs before we begin.
@@ -256,27 +256,50 @@ def generateNativeWrappers():
     for moduleName in FFIConstants.CodeModuleNameList:
         print('Importing code library: ' + moduleName)
         Dtool_PreloadDLL(moduleName)
-        exec('import %s as module' % moduleName)
+
+        __import__(moduleName)
+        module = sys.modules[moduleName]
+
+        # Make a suitable meta module name
+        metaModuleName = ""
+        nextCap = False
+        for ch in moduleName:
+            if ch == '.':
+                nextCap = True
+            elif nextCap:
+                metaModuleName += ch.upper()
+                nextCap = False
+            else:
+                metaModuleName += ch
+        metaModuleName += "Modules"
 
         # Wrap the import in a try..except so that we can continue if
         # the library isn't present.  This is particularly necessary
         # in the runtime (plugin) environment, where all libraries are
         # not necessarily downloaded.
-        pandaModules.write('try:\n  from %sModules import *\nexcept ImportError, err:\n  if "DLL loader cannot find" not in str(err):\n    raise\n' % (moduleName))
+        if sys.version_info >= (3, 0):
+            pandaModules.write('try:\n  from .%s import *\nexcept ImportError as err:\n  if "DLL loader cannot find" not in str(err):\n    raise\n' % (metaModuleName))
+        else:
+            pandaModules.write('try:\n  from %s import *\nexcept ImportError, err:\n  if "DLL loader cannot find" not in str(err):\n    raise\n' % (metaModuleName))
+
         # Not sure if this message is helpful or annoying.
         #pandaModules.write('  print("Failed to import %s")\n' % (moduleName))
         pandaModules.write('\n')
 
-        moduleModulesFilename = os.path.join(outputCodeDir, '%sModules.py' % (moduleName))
+        moduleModulesFilename = os.path.join(outputCodeDir, '%s.py' % (metaModuleName))
         moduleModules = open(moduleModulesFilename, 'w')
 
-        moduleModules.write('from extension_native_helpers import *\n')
+        if sys.version_info >= (3, 0):
+            moduleModules.write('from .extension_native_helpers import *\n')
+        else:
+            moduleModules.write('from extension_native_helpers import *\n')
         moduleModules.write('Dtool_PreloadDLL("%s")\n' % (moduleName))
+
         moduleModules.write('from %s import *\n\n' % (moduleName))
 
         # Now look for extensions
         for className, classDef in module.__dict__.items():
-            if type(classDef) == types.TypeType:
+            if isinstance(classDef, type):
                 extensionFilename = os.path.join(extensionsDir, '%s_extensions.py' % (className))
                 if os.path.exists(extensionFilename):
                     print('  Found extensions for class: %s' % (className))

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

@@ -12,7 +12,7 @@ class FFIEnvironment:
         self.manifests = []
     
     def addType(self, typeDescriptor, name):
-        if self.types.has_key(name):
+        if name in self.types:
             FFIConstants.notify.info('Redefining type named: ' + name)
         self.types[name] = typeDescriptor
     

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

@@ -238,7 +238,7 @@ class FFIInterrogateDatabase:
         self.environment = FFIEnvironment.FFIEnvironment()
 
     def isDefinedType(self, typeIndex):
-        return self.typeIndexMap.has_key(typeIndex)
+        return typeIndex in self.typeIndexMap
     
     def constructDescriptor(self, typeIndex):
         if interrogate_type_is_atomic(typeIndex):

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

@@ -337,7 +337,7 @@ class FFIMethodArgumentTree:
                 # methodSpec in this dictionary
                 self.tree[typeDesc] = [None, methodSpec]
             else:
-                if self.tree.has_key(typeDesc):
+                if typeDesc in self.tree:
                     # If there already is a tree here, jump into and pass the
                     # cdr of the arg list
                     subTree = self.tree[typeDesc][0]

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

@@ -108,7 +108,7 @@ def classNameFromCppName(cppName):
             firstChar = 0
         else:
             className = className + char
-    if classRenameDictionary.has_key(className):
+    if className in classRenameDictionary:
         className = classRenameDictionary[className]
 
     if (className == ''):

+ 52 - 52
direct/src/filter/CommonFilters.py

@@ -86,28 +86,28 @@ class CommonFilters:
             auxbits = 0
             needtex = {}
             needtex["color"] = True
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 needtex["aux"] = True
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 needtex["depth"] = True
                 needtex["ssao0"] = True
                 needtex["ssao1"] = True
                 needtex["ssao2"] = True
                 needtex["aux"] = True
                 auxbits |= AuxBitplaneAttrib.ABOAuxNormal
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 needtex["blur0"] = True
                 needtex["blur1"] = True
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 needtex["bloom0"] = True
                 needtex["bloom1"] = True
                 needtex["bloom2"] = True
                 needtex["bloom3"] = True
                 auxbits |= AuxBitplaneAttrib.ABOGlow
-            if (configuration.has_key("ViewGlow")):
+            if ("ViewGlow" in configuration):
                 auxbits |= AuxBitplaneAttrib.ABOGlow
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 needtex[configuration["VolumetricLighting"].source] = True
             for tex in needtex:
                 self.textures[tex] = Texture("scene-"+tex)
@@ -120,7 +120,7 @@ class CommonFilters:
                 self.cleanup()
                 return False
 
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 blur0=self.textures["blur0"]
                 blur1=self.textures["blur1"]
                 self.blur.append(self.manager.renderQuadInto(colortex=blur0,div=2))
@@ -130,7 +130,7 @@ class CommonFilters:
                 self.blur[1].setShaderInput("src", blur0)
                 self.blur[1].setShader(self.loadShader("filter-blury.sha"))
 
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 ssao0=self.textures["ssao0"]
                 ssao1=self.textures["ssao1"]
                 ssao2=self.textures["ssao2"]
@@ -146,7 +146,7 @@ class CommonFilters:
                 self.ssao[2].setShaderInput("src", ssao1)
                 self.ssao[2].setShader(self.loadShader("filter-blury.sha"))
 
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 bloomconf = configuration["Bloom"]
                 bloom0=self.textures["bloom0"]
                 bloom1=self.textures["bloom1"]
@@ -180,74 +180,74 @@ class CommonFilters:
             text += " uniform float4 texpad_txcolor,\n"
             text += " uniform float4 texpix_txcolor,\n"
             text += " out float4 l_texcoordC : TEXCOORD0,\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += " uniform float4 texpad_txaux,\n"
                 text += " uniform float4 texpix_txaux,\n"
                 text += " out float4 l_texcoordN : TEXCOORD1,\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += " uniform float4 texpad_txbloom3,\n"
                 text += " out float4 l_texcoordB : TEXCOORD2,\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " uniform float4 texpad_txblur1,\n"
                 text += " out float4 l_texcoordBS : TEXCOORD3,\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += " uniform float4 texpad_txssao2,\n"
                 text += " out float4 l_texcoordAO : TEXCOORD4,\n"
             text += " uniform float4x4 mat_modelproj)\n"
             text += "{\n"
             text += " l_position=mul(mat_modelproj, vtx_position);\n"
             text += " l_texcoordC=(vtx_position.xzxz * texpad_txcolor) + texpad_txcolor;\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += " l_texcoordN=(vtx_position.xzxz * texpad_txaux) + texpad_txaux;\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += " l_texcoordB=(vtx_position.xzxz * texpad_txbloom3) + texpad_txbloom3;\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " l_texcoordBS=(vtx_position.xzxz * texpad_txblur1) + texpad_txblur1;\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += " l_texcoordAO=(vtx_position.xzxz * texpad_txssao2) + texpad_txssao2;\n"
-            if (configuration.has_key("HalfPixelShift")):
+            if ("HalfPixelShift" in configuration):
                 text += " l_texcoordC+=texpix_txcolor*0.5;\n"
-                if (configuration.has_key("CartoonInk")):
+                if ("CartoonInk" in configuration):
                     text += " l_texcoordN+=texpix_txaux*0.5;\n"
             text += "}\n"
 
             text += "void fshader(\n"
             text += "float4 l_texcoordC : TEXCOORD0,\n"
             text += "uniform float4 texpix_txcolor,\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += "float4 l_texcoordN : TEXCOORD1,\n"
                 text += "uniform float4 texpix_txaux,\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += "float4 l_texcoordB : TEXCOORD2,\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += "float4 l_texcoordBS : TEXCOORD3,\n"
                 text += "uniform float4 k_blurval,\n"
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += "float4 l_texcoordAO : TEXCOORD4,\n"
             for key in self.textures:
                 text += "uniform sampler2D k_tx" + key + ",\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += "uniform float4 k_cartoonseparation,\n"
                 text += "uniform float4 k_cartooncolor,\n"
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 text += "uniform float4 k_casterpos,\n"
                 text += "uniform float4 k_vlparams,\n"
             text += "out float4 o_color : COLOR)\n"
             text += "{\n"
             text += " o_color = tex2D(k_txcolor, l_texcoordC.xy);\n"
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 text += CARTOON_BODY
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 text += "o_color *= tex2D(k_txssao2, l_texcoordAO.xy).r;\n"
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 text += " o_color = lerp(tex2D(k_txblur1, l_texcoordBS.xy), o_color, k_blurval.x);\n"
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 text += "o_color = saturate(o_color);\n";
                 text += "float4 bloom = 0.5*tex2D(k_txbloom3, l_texcoordB.xy);\n"
                 text += "o_color = 1-((1-bloom)*(1-o_color));\n"
-            if (configuration.has_key("ViewGlow")):
+            if ("ViewGlow" in configuration):
                 text += "o_color.r = o_color.a;\n"
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 text += "float decay = 1.0f;\n"
                 text += "float2 curcoord = l_texcoordC.xy;\n"
                 text += "float2 lightdir = curcoord - k_casterpos.xy;\n"
@@ -262,7 +262,7 @@ class CommonFilters:
                 text += "  decay *= k_vlparams.y;\n"
                 text += "}\n"
                 text += "o_color += float4(vlcolor * k_vlparams.z, 1);\n"
-            if (configuration.has_key("Inverted")):
+            if ("Inverted" in configuration):
                 text += "o_color = float4(1, 1, 1, 1) - o_color;\n"
             text += "}\n"
             
@@ -273,18 +273,18 @@ class CommonFilters:
             self.task = taskMgr.add(self.update, "common-filters-update")
         
         if (changed == "CartoonInk") or fullrebuild:
-            if (configuration.has_key("CartoonInk")):
+            if ("CartoonInk" in configuration):
                 c = configuration["CartoonInk"]
                 self.finalQuad.setShaderInput("cartoonseparation", Vec4(c.separation, 0, c.separation, 0))
                 self.finalQuad.setShaderInput("cartooncolor", c.color)
 
         if (changed == "BlurSharpen") or fullrebuild:
-            if (configuration.has_key("BlurSharpen")):
+            if ("BlurSharpen" in configuration):
                 blurval = configuration["BlurSharpen"]
                 self.finalQuad.setShaderInput("blurval", Vec4(blurval, blurval, blurval, blurval))
 
         if (changed == "Bloom") or fullrebuild:
-            if (configuration.has_key("Bloom")):
+            if ("Bloom" in configuration):
                 bloomconf = configuration["Bloom"]
                 intensity = bloomconf.intensity * 3.0
                 self.bloom[0].setShaderInput("blend", bloomconf.blendx, bloomconf.blendy, bloomconf.blendz, bloomconf.blendw * 2.0)
@@ -293,13 +293,13 @@ class CommonFilters:
                 self.bloom[3].setShaderInput("intensity", intensity, intensity, intensity, intensity)
         
         if (changed == "VolumetricLighting") or fullrebuild:
-            if (configuration.has_key("VolumetricLighting")):
+            if ("VolumetricLighting" in configuration):
                 config = configuration["VolumetricLighting"]
                 tcparam = config.density / float(config.numsamples)
                 self.finalQuad.setShaderInput("vlparams", tcparam, config.decay, config.exposure, 0.0)
         
         if (changed == "AmbientOcclusion") or fullrebuild:
-            if (configuration.has_key("AmbientOcclusion")):
+            if ("AmbientOcclusion" in configuration):
                 config = configuration["AmbientOcclusion"]
                 self.ssao[0].setShaderInput("params1", config.numsamples, -float(config.amount) / config.numsamples, config.radius, 0)
                 self.ssao[0].setShaderInput("params2", config.strength, config.falloff, 0, 0)
@@ -311,7 +311,7 @@ class CommonFilters:
         """Updates the shader inputs that need to be updated every frame.
         Normally, you shouldn't call this, it's being called in a task."""
 
-        if self.configuration.has_key("VolumetricLighting"):
+        if "VolumetricLighting" in self.configuration:
             caster = self.configuration["VolumetricLighting"].caster
             casterpos = Point2()
             self.manager.camera.node().getLens().project(caster.getPos(self.manager.camera), casterpos)
@@ -320,7 +320,7 @@ class CommonFilters:
             return task.cont
 
     def setCartoonInk(self, separation=1, color=(0, 0, 0, 1)):
-        fullrebuild = (self.configuration.has_key("CartoonInk") == False)
+        fullrebuild = (("CartoonInk" in self.configuration) == False)
         newconfig = FilterConfig()
         newconfig.separation = separation
         newconfig.color = color
@@ -328,7 +328,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "CartoonInk")
 
     def delCartoonInk(self):
-        if (self.configuration.has_key("CartoonInk")):
+        if ("CartoonInk" in self.configuration):
             del self.configuration["CartoonInk"]
             return self.reconfigure(True, "CartoonInk")
         return True
@@ -357,40 +357,40 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "Bloom")
 
     def delBloom(self):
-        if (self.configuration.has_key("Bloom")):
+        if ("Bloom" in self.configuration):
             del self.configuration["Bloom"]
             return self.reconfigure(True, "Bloom")
         return True
 
     def setHalfPixelShift(self):
-        fullrebuild = (self.configuration.has_key("HalfPixelShift") == False)
+        fullrebuild = (("HalfPixelShift" in self.configuration) == False)
         self.configuration["HalfPixelShift"] = 1
         return self.reconfigure(fullrebuild, "HalfPixelShift")
 
     def delHalfPixelShift(self):
-        if (self.configuration.has_key("HalfPixelShift")):
+        if ("HalfPixelShift" in self.configuration):
             del self.configuration["HalfPixelShift"]
             return self.reconfigure(True, "HalfPixelShift")
         return True
 
     def setViewGlow(self):
-        fullrebuild = (self.configuration.has_key("ViewGlow") == False)
+        fullrebuild = (("ViewGlow" in self.configuration) == False)
         self.configuration["ViewGlow"] = 1
         return self.reconfigure(fullrebuild, "ViewGlow")
 
     def delViewGlow(self):
-        if (self.configuration.has_key("ViewGlow")):
+        if ("ViewGlow" in self.configuration):
             del self.configuration["ViewGlow"]
             return self.reconfigure(True, "ViewGlow")
         return True
 
     def setInverted(self):
-        fullrebuild = (self.configuration.has_key("Inverted") == False)
+        fullrebuild = (("Inverted" in self.configuration) == False)
         self.configuration["Inverted"] = 1
         return self.reconfigure(fullrebuild, "Inverted")
 
     def delInverted(self):
-        if (self.configuration.has_key("Inverted")):
+        if ("Inverted" in self.configuration):
             del self.configuration["Inverted"]
             return self.reconfigure(True, "Inverted")
         return True
@@ -411,7 +411,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "VolumetricLighting")
 
     def delVolumetricLighting(self):
-        if (self.configuration.has_key("VolumetricLighting")):
+        if ("VolumetricLighting" in self.configuration):
             del self.configuration["VolumetricLighting"]
             return self.reconfigure(True, "VolumetricLighting")
         return True
@@ -419,18 +419,18 @@ class CommonFilters:
     def setBlurSharpen(self, amount=0.0):
         """Enables the blur/sharpen filter. If the 'amount' parameter is 1.0, it will not have effect.
         A value of 0.0 means fully blurred, and a value higher than 1.0 sharpens the image."""
-        fullrebuild = (self.configuration.has_key("BlurSharpen") == False)
+        fullrebuild = (("BlurSharpen" in self.configuration) == False)
         self.configuration["BlurSharpen"] = amount
         return self.reconfigure(fullrebuild, "BlurSharpen")
 
     def delBlurSharpen(self):
-        if (self.configuration.has_key("BlurSharpen")):
+        if ("BlurSharpen" in self.configuration):
             del self.configuration["BlurSharpen"]
             return self.reconfigure(True, "BlurSharpen")
         return True
 
     def setAmbientOcclusion(self, numsamples = 16, radius = 0.05, amount = 2.0, strength = 0.01, falloff = 0.000002):
-        fullrebuild = (self.configuration.has_key("AmbientOcclusion") == False)
+        fullrebuild = (("AmbientOcclusion" in self.configuration) == False)
         newconfig = FilterConfig()
         newconfig.numsamples = numsamples
         newconfig.radius = radius
@@ -441,7 +441,7 @@ class CommonFilters:
         return self.reconfigure(fullrebuild, "AmbientOcclusion")
 
     def delAmbientOcclusion(self):
-        if (self.configuration.has_key("AmbientOcclusion")):
+        if ("AmbientOcclusion" in self.configuration):
             del self.configuration["AmbientOcclusion"]
             return self.reconfigure(True, "AmbientOcclusion")
         return True

+ 6 - 7
direct/src/fsm/State.py

@@ -23,7 +23,6 @@ class State(DirectObject):
 
         @classmethod
         def replaceMethod(self, oldFunction, newFunction):
-            import new
             import types
             count = 0        
             for state in self.States:
@@ -34,16 +33,16 @@ class State(DirectObject):
                 if type(enterFunc) == types.MethodType:
                     if (enterFunc.im_func == oldFunction):
                         # print 'found: ', enterFunc, oldFunction
-                        state.setEnterFunc(new.instancemethod(newFunction,
-                                                              enterFunc.im_self,
-                                                              enterFunc.im_class))
+                        state.setEnterFunc(types.MethodType(newFunction,
+                                                            enterFunc.im_self,
+                                                            enterFunc.im_class))
                         count += 1
                 if type(exitFunc) == types.MethodType:
                     if (exitFunc.im_func == oldFunction):
                         # print 'found: ', exitFunc, oldFunction
-                        state.setExitFunc(new.instancemethod(newFunction,
-                                                             exitFunc.im_self,
-                                                             exitFunc.im_class))
+                        state.setExitFunc(types.MethodType(newFunction,
+                                                           exitFunc.im_self,
+                                                           exitFunc.im_class))
                         count += 1
             return count
 

+ 1 - 1
direct/src/fsm/StatePush.py

@@ -238,7 +238,7 @@ class FunctionCall(ReceivesMultipleStateChanges, PushesStateChanges):
     def _recvMultiStatePush(self, key, source):
         # one of the arguments changed
         # pick up the new value
-        if isinstance(key, types.StringType):
+        if isinstance(key, str):
             self._bakedKargs[key] = source.getState()
         else:
             self._bakedArgs[key] = source.getState()

+ 3 - 3
direct/src/gui/DirectDialog.py

@@ -15,7 +15,7 @@ def findDialog(uniqueName):
     useful for debugging, to get a pointer to the current onscreen
     panel of a particular type.
     """
-    if DirectDialog.AllDialogs.has_key(uniqueName):
+    if uniqueName in DirectDialog.AllDialogs:
         return DirectDialog.AllDialogs[uniqueName]
     return None
 
@@ -27,7 +27,7 @@ def cleanupDialog(uniqueName):
     that opening panel A should automatically close panel B, for
     instance.
     """
-    if DirectDialog.AllDialogs.has_key(uniqueName):
+    if uniqueName in DirectDialog.AllDialogs:
         # calling cleanup() will remove it out of the AllDialogs dict
         # This way it will get removed from the dict even it we did
         # not clean it up using this interface (ie somebody called
@@ -330,7 +330,7 @@ class DirectDialog(DirectFrame):
     def cleanup(self):
         # Remove this panel out of the AllDialogs list
         uniqueName = self['dialogName']
-        if DirectDialog.AllDialogs.has_key(uniqueName):
+        if uniqueName in DirectDialog.AllDialogs:
             del DirectDialog.AllDialogs[uniqueName]
         self.destroy()
 

+ 5 - 5
direct/src/gui/DirectGuiBase.py

@@ -439,7 +439,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         Get current configuration setting for this option
         """
         # Return the value of an option, for example myWidget['font'].
-        if self._optionInfo.has_key(option):
+        if option in self._optionInfo:
             return self._optionInfo[option][DGG._OPT_VALUE]
         else:
             index = string.find(option, '_')
@@ -448,7 +448,7 @@ class DirectGuiBase(DirectObject.DirectObject):
                 componentOption = option[(index + 1):]
 
                 # Expand component alias
-                if self.__componentAliases.has_key(component):
+                if component in self.__componentAliases:
                     component, subComponent = self.__componentAliases[
                         component]
                     if subComponent is not None:
@@ -457,7 +457,7 @@ class DirectGuiBase(DirectObject.DirectObject):
                     # Expand option string to write on error
                     option = component + '_' + componentOption
 
-                if self.__componentInfo.has_key(component):
+                if component in self.__componentInfo:
                     # Call cget on the component.
                     componentCget = self.__componentInfo[component][3]
                     return componentCget(componentOption)
@@ -582,7 +582,7 @@ class DirectGuiBase(DirectObject.DirectObject):
 
         # Expand component alias
         # Example entry which is an alias for entryField_entry
-        if self.__componentAliases.has_key(component):
+        if component in self.__componentAliases:
             # component = entryField, subComponent = entry
             component, subComponent = self.__componentAliases[component]
             if subComponent is not None:
@@ -608,7 +608,7 @@ class DirectGuiBase(DirectObject.DirectObject):
         return names
 
     def hascomponent(self, component):
-        return self.__componentInfo.has_key(component)
+        return component in self.__componentInfo
 
     def destroycomponent(self, name):
         # Remove a megawidget component.

+ 1 - 1
direct/src/gui/DirectGuiTest.py

@@ -124,7 +124,7 @@ if __name__ == "__main__":
                               command = printDialogValue)
 
     customDialog = DirectDialog(text = 'Pick a number',
-                                buttonTextList = map(str, range(10)),
+                                buttonTextList = [str(i) for i in range(10)],
                                 buttonValueList = range(10),
                                 command = printDialogValue)
 

+ 3 - 3
direct/src/gui/DirectScrolledList.py

@@ -22,10 +22,10 @@ class DirectScrolledListItem(DirectButton):
     def __init__(self, parent=None, **kw):
         assert self.notify.debugStateCall(self)
         self.parent = parent
-        if kw.has_key("command"):
+        if "command" in kw:
             self.nextCommand = kw.get("command")
             del kw["command"]
-        if kw.has_key("extraArgs"):
+        if "extraArgs" in kw:
             self.nextCommandExtraArgs = kw.get("extraArgs")
             del kw["extraArgs"]
         optiondefs = (
@@ -59,7 +59,7 @@ class DirectScrolledList(DirectFrame):
 
         # if 'items' is a list of strings, make a copy for our use
         # so we can modify it without mangling the user's list
-        if kw.has_key('items'):
+        if 'items' in kw:
             for item in kw['items']:
                 if type(item) != type(''):
                     break

+ 1 - 1
direct/src/gui/DirectWaitBar.py

@@ -35,7 +35,7 @@ class DirectWaitBar(DirectFrame):
             ('barRelief',      DGG.FLAT,           self.setBarRelief),
             ('sortOrder',      NO_FADE_SORT_INDEX, None),
             )
-        if kw.has_key('text'):
+        if 'text' in kw:
             textoptiondefs = (
                 ('text_pos',    (0, -0.025),          None),
                 ('text_scale',  0.1,                 None)

+ 1 - 1
direct/src/http/WebRequest.py

@@ -262,7 +262,7 @@ class WebRequestDispatcher(object):
 
     def enableLandingPage(self, enable):
         if enable:
-            if not self.__dict__.has_key("landingPage"):
+            if "landingPage" not in self.__dict__:
                 self.landingPage = LandingPage()
                 self.registerGETHandler("/", self._main, returnsResponse = True, autoSkin = True)
                 self.registerGETHandler("/services", self._services, returnsResponse = True, autoSkin = True)

+ 3 - 3
direct/src/http/webAIInspector.py

@@ -292,7 +292,7 @@ def inspectObject(anObject):
 
 def inspectorFor(anObject):
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
-    if _InspectorMap.has_key(typeName):
+    if typeName in _InspectorMap:
         inspectorName = _InspectorMap[typeName]
     else:
         print "Can't find an inspector for " + typeName
@@ -355,7 +355,7 @@ class Inspector:
             #    self._partsList.append(each)  
 
     def initializePartNames(self):
-        self._partNames = ['up'] + map(lambda each: str(each), self._partsList)
+        self._partNames = ['up'] + [str(each) for each in self._partsList]
 
     def title(self):
         "Subclasses may override."
@@ -458,7 +458,7 @@ class DictionaryInspector(Inspector):
         if partNumber == 0:
             return self.object
         key = self.privatePartNumber(partNumber)
-        if self.object.has_key(key):
+        if key in self.object:
             return self.object[key]
         else:
             return getattr(self.object, key)

+ 3 - 4
direct/src/interval/FunctionInterval.py

@@ -28,7 +28,6 @@ class FunctionInterval(Interval.Interval):
 
         @classmethod
         def replaceMethod(self, oldFunction, newFunction):
-            import new
             import types
             count = 0        
             for ival in self.FunctionIntervals:
@@ -37,9 +36,9 @@ class FunctionInterval(Interval.Interval):
                 if type(ival.function) == types.MethodType:
                     if (ival.function.im_func == oldFunction):
                         # print 'found: ', ival.function, oldFunction
-                        ival.function = new.instancemethod(newFunction,
-                                                           ival.function.im_self,
-                                                           ival.function.im_class)
+                        ival.function = types.MethodType(newFunction,
+                                                         ival.function.im_self,
+                                                         ival.function.im_class)
                         count += 1
             return count
 

+ 4 - 4
direct/src/interval/MetaInterval.py

@@ -38,7 +38,7 @@ class MetaInterval(CMetaInterval):
         #else:
 
         # Look for the name in the keyword params.
-        if kw.has_key('name'):
+        if 'name' in kw:
             name = kw['name']
             del kw['name']
 
@@ -52,10 +52,10 @@ class MetaInterval(CMetaInterval):
         
         autoPause = 0
         autoFinish = 0
-        if kw.has_key('autoPause'):
+        if 'autoPause' in kw:
             autoPause = kw['autoPause']
             del kw['autoPause']
-        if kw.has_key('autoFinish'):
+        if 'autoFinish' in kw:
             autoFinish = kw['autoFinish']
             del kw['autoFinish']
 
@@ -63,7 +63,7 @@ class MetaInterval(CMetaInterval):
         # appear to have for the purposes of computing the start time
         # for subsequent intervals in a sequence or track.
         self.phonyDuration = -1
-        if kw.has_key('duration'):
+        if 'duration' in kw:
             self.phonyDuration = kw['duration']
             del kw['duration']
 

+ 3 - 3
direct/src/leveleditor/ObjectPropertyUI.py

@@ -91,7 +91,7 @@ class ObjectPropUI(wx.Panel):
             value = self.getValue()
             frame = self.parent.editor.ui.animUI.curFrame
             
-            if self.parent.editor.animMgr.keyFramesInfo.has_key((objUID,propertyName)):
+            if (objUID, propertyName) in self.parent.editor.animMgr.keyFramesInfo:
                 for i in range(len(self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)])):
                     if self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i][AG.FRAME] == frame:
                         del self.parent.editor.animMgr.keyFramesInfo[(objUID,propertyName)][i]
@@ -239,8 +239,8 @@ class ObjectPropUITime(wx.Panel):
 
         hSizer = wx.BoxSizer(wx.HORIZONTAL)
         self.uiAmPm = wx.Choice(self.uiPane, -1, choices=['AM', 'PM'])
-        self.uiHour = wx.Choice(self.uiPane, -1, choices=map(lambda x : str(x), range(1, 13)))
-        self.uiMin = wx.Choice(self.uiPane, -1, choices=map(lambda x : str(x), range(0, 60, 15)))
+        self.uiHour = wx.Choice(self.uiPane, -1, choices=[str(x) for x in range(1, 13)])
+        self.uiMin = wx.Choice(self.uiPane, -1, choices=[str(x) for x in range(0, 60, 15)])
 
         hSizer.Add(self.uiAmPm)
         hSizer.Add(self.uiHour)

+ 7 - 7
direct/src/p3d/DeploymentTools.py

@@ -39,9 +39,9 @@ def archiveFilter(info):
     # Somewhat hacky, but it's the only way
     # permissions can work on a Windows box.
     if info.type != tarfile.DIRTYPE and '.' in info.name.rsplit('/', 1)[-1]:
-        info.mode = 0644
+        info.mode = 0o644
     else:
-        info.mode = 0755
+        info.mode = 0o755
 
     return info
 
@@ -53,8 +53,8 @@ class TarInfoRoot(tarfile.TarInfo):
     gid = property(lambda self: 0, lambda self, x: None)
     uname = property(lambda self: "root", lambda self, x: None)
     gname = property(lambda self: "root", lambda self, x: None)
-    mode = property(lambda self: 0644 if self.type != tarfile.DIRTYPE and \
-                    '.' in self.name.rsplit('/', 1)[-1] else 0755,
+    mode = property(lambda self: 0o644 if self.type != tarfile.DIRTYPE and \
+                    '.' in self.name.rsplit('/', 1)[-1] else 0o755,
                     lambda self, x: None)
 
 # On OSX, the root group is named "wheel".
@@ -186,7 +186,7 @@ class Standalone:
         ohandle.close()
         phandle.close()
 
-        os.chmod(output.toOsSpecific(), 0755)
+        os.chmod(output.toOsSpecific(), 0o755)
 
     def getExtraFiles(self, platform):
         """ Returns a list of extra files that will need to be included
@@ -550,7 +550,7 @@ class Installer:
                 mf = Multifile()
                 # Make sure that it isn't mounted before altering it, just to be safe
                 vfs.unmount(archive)
-                os.chmod(archive.toOsSpecific(), 0644)
+                os.chmod(archive.toOsSpecific(), 0o644)
                 if not mf.openReadWrite(archive):
                     Installer.notify.warning("Failed to open archive %s" % (archive))
                     continue
@@ -575,7 +575,7 @@ class Installer:
                 #    archive.unlink()
                 #else:
                 mf.close()
-                try: os.chmod(archive.toOsSpecific(), 0444)
+                try: os.chmod(archive.toOsSpecific(), 0o444)
                 except: pass
 
         # Write out our own contents.xml file.

+ 2 - 2
direct/src/p3d/FileSpec.py

@@ -205,9 +205,9 @@ class FileSpec:
         # On Windows, we have to change the file to read-write before
         # we can successfully update its timestamp.
         try:
-            os.chmod(pathname.toOsSpecific(), 0755)
+            os.chmod(pathname.toOsSpecific(), 0o755)
             os.utime(pathname.toOsSpecific(), (st.st_atime, self.timestamp))
-            os.chmod(pathname.toOsSpecific(), 0555)
+            os.chmod(pathname.toOsSpecific(), 0o555)
         except OSError:
             pass
 

+ 6 - 6
direct/src/p3d/PackageInfo.py

@@ -175,7 +175,7 @@ class PackageInfo:
 
         # Return the size of plan A, assuming it will work.
         plan = self.installPlans[0]
-        size = sum(map(lambda step: step.getEffort(), plan))
+        size = sum([step.getEffort() for step in plan])
         
         return size
 
@@ -313,7 +313,7 @@ class PackageInfo:
 
             filename = Filename(self.getPackageDir(), self.descFileBasename)
             # Now that we've written the desc file, make it read-only.
-            os.chmod(filename.toOsSpecific(), 0444)
+            os.chmod(filename.toOsSpecific(), 0o444)
 
         if not self.__readDescFile():
             # Weird, it passed the hash check, but we still can't read
@@ -688,7 +688,7 @@ class PackageInfo:
         installPlans = self.installPlans
         self.installPlans = None
         for plan in installPlans:
-            self.totalPlanSize = sum(map(lambda step: step.getEffort(), plan))
+            self.totalPlanSize = sum([step.getEffort() for step in plan])
             self.totalPlanCompleted = 0
             self.downloadProgress = 0
 
@@ -832,7 +832,7 @@ class PackageInfo:
             if bytesStarted:
                 self.notify.info("Resuming %s after %s bytes already downloaded" % (url, bytesStarted))
                 # Make sure the file is writable.
-                os.chmod(targetPathname.toOsSpecific(), 0644)
+                os.chmod(targetPathname.toOsSpecific(), 0o644)
                 channel.beginGetSubdocument(request, bytesStarted, 0)
             else:
                 # No partial download possible; get the whole file.
@@ -980,7 +980,7 @@ class PackageInfo:
             yield self.stepFailed; return
 
         # Now that we've verified the archive, make it read-only.
-        os.chmod(targetPathname.toOsSpecific(), 0444)
+        os.chmod(targetPathname.toOsSpecific(), 0o444)
 
         # Now we can safely remove the compressed archive.
         sourcePathname.unlink()
@@ -1032,7 +1032,7 @@ class PackageInfo:
                 continue
 
             # Make sure it's executable, and not writable.
-            os.chmod(targetPathname.toOsSpecific(), 0555)
+            os.chmod(targetPathname.toOsSpecific(), 0o555)
 
             step.bytesDone += file.size
             self.__updateStepProgress(step)

+ 5 - 6
direct/src/p3d/Packager.py

@@ -10,7 +10,6 @@ import sys
 import os
 import glob
 import marshal
-import new
 import string
 import types
 import getpass
@@ -427,7 +426,7 @@ class Packager:
                 self.compressionLevel = 6
 
                 # Every p3dapp requires panda3d.
-                if 'panda3d' not in map(lambda p: p.packageName, self.requires):
+                if 'panda3d' not in [p.packageName for p in self.requires]:
                     assert not self.packager.currentPackage
                     self.packager.currentPackage = self
                     self.packager.do_require('panda3d')
@@ -726,7 +725,7 @@ class Packager:
             if self.p3dApplication:
                 # No patches for an application; just move it into place.
                 # Make the application file executable.
-                os.chmod(self.packageFullpath.toOsSpecific(), 0755)
+                os.chmod(self.packageFullpath.toOsSpecific(), 0o755)
             else:
                 self.readDescFile()
                 self.packageSeq += 1
@@ -2206,7 +2205,7 @@ class Packager:
         # returned, so they will persist beyond the lifespan of the
         # config variable.
         cvar = ConfigVariableSearchPath('pdef-path')
-        self.installSearch = map(Filename, cvar.getDirectories())
+        self.installSearch = list(map(Filename, cvar.getDirectories()))
 
         # The system PATH, for searching dll's and exe's.
         self.executablePath = DSearchPath()
@@ -2938,7 +2937,7 @@ class Packager:
             tuples.append((version, file))
         tuples.sort(reverse = True)
 
-        return map(lambda t: t[1], tuples)
+        return [t[1] for t in tuples]
 
     def __sortPackageInfos(self, packages):
         """ Given a list of PackageInfos retrieved from a Host, sorts
@@ -2951,7 +2950,7 @@ class Packager:
             tuples.append((version, file))
         tuples.sort(reverse = True)
 
-        return map(lambda t: t[1], tuples)
+        return [t[1] for t in tuples]
 
     def __makeVersionTuple(self, version):
         """ Converts a version string into a tuple for sorting, by

+ 1 - 1
direct/src/p3d/packp3d.py

@@ -204,7 +204,7 @@ def makePackedApp(args):
         # Pre-require panda3d, to give a less-confusing error message
         # if one of our requirements pulls in a wrong version of
         # panda3d.
-        if 'panda3d' not in map(lambda t: t[0], requires):
+        if 'panda3d' not in [t[0] for t in requires]:
             packager.do_require('panda3d')
         
         for name, version, host in requires:

+ 2 - 0
direct/src/p3d/panda3d.pdef

@@ -87,6 +87,8 @@ class panda3d(package):
                   'direct.tkpanels', 'direct.tkwidgets',
                   'tkCommonDialog', 'tkMessageBox', 'tkSimpleDialog')
 
+    excludeModule('MySQLdb', '_mysql')
+
     # Most of the core Panda3D DLL's will be included implicitly due to
     # being referenced by the above Python code.  Here we name a few more
     # that are also needed, but aren't referenced by any code.  Again,

+ 1 - 1
direct/src/particles/ParticleEffect.py

@@ -202,7 +202,7 @@ class ParticleEffect(NodePath):
         data = vfs.readFile(filename, 1)
         data = data.replace('\r', '')
         try:
-            exec data
+            exec(data)
         except:
             self.notify.warning('loadConfig: failed to load particle file: '+ repr(filename))
             raise

+ 26 - 26
direct/src/particles/Particles.py

@@ -365,31 +365,31 @@ class Particles(ParticleSystem):
                     typ = type(fun).__name__
                     if typ == 'ColorInterpolationFunctionConstant':
                         c_a = fun.getColorA()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addConstant('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),'+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addConstant('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),'+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionLinear':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addLinear('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),'+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addLinear('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),'+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionStepwave':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
                         w_a = fun.getWidthA()
                         w_b = fun.getWidthB()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addStepwave('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),' + \
-                                   repr(w_a)+','+`w_b`+','+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addStepwave('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),' + \
+                                   repr(w_a)+','+repr(w_b)+','+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionSinusoid':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
                         per = fun.getPeriod()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addSinusoid('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),' + \
-                                   repr(per)+','+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addSinusoid('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),' + \
+                                   repr(per)+','+repr(mod)+')\n')
 
         elif (self.rendererType == "SparkleParticleRenderer"):
             file.write('# Sparkle parameters\n')
@@ -468,31 +468,31 @@ class Particles(ParticleSystem):
                     typ = type(fun).__name__
                     if typ == 'ColorInterpolationFunctionConstant':
                         c_a = fun.getColorA()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addConstant('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),'+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addConstant('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),'+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionLinear':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addLinear('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),'+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addLinear('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),'+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionStepwave':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
                         w_a = fun.getWidthA()
                         w_b = fun.getWidthB()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addStepwave('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),' + \
-                                   repr(w_a)+','+`w_b`+','+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addStepwave('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),' + \
+                                   repr(w_a)+','+repr(w_b)+','+repr(mod)+')\n')
                     elif typ == 'ColorInterpolationFunctionSinusoid':
                         c_a = fun.getColorA()
                         c_b = fun.getColorB()
                         per = fun.getPeriod()
-                        file.write(targ+'.renderer.getColorInterpolationManager().addSinusoid('+repr(t_b)+','+`t_e`+','+ \
-                                   'Vec4('+repr(c_a[0])+','+`c_a[1]`+','+`c_a[2]`+','+`c_a[3]`+'),' + \
-                                   'Vec4('+repr(c_b[0])+','+`c_b[1]`+','+`c_b[2]`+','+`c_b[3]`+'),' + \
-                                   repr(per)+','+`mod`+')\n')
+                        file.write(targ+'.renderer.getColorInterpolationManager().addSinusoid('+repr(t_b)+','+repr(t_e)+','+ \
+                                   'Vec4('+repr(c_a[0])+','+repr(c_a[1])+','+repr(c_a[2])+','+repr(c_a[3])+'),' + \
+                                   'Vec4('+repr(c_b[0])+','+repr(c_b[1])+','+repr(c_b[2])+','+repr(c_b[3])+'),' + \
+                                   repr(per)+','+repr(mod)+')\n')
 
         file.write('# Emitter parameters\n')
         emissionType = self.emitter.getEmissionType()

+ 2 - 2
direct/src/plugin/p3dPythonRun.cxx

@@ -20,7 +20,7 @@
 #include "nativeWindowHandle.h"
 
 #ifndef CPPPARSER
-#include "py_panda.h"  
+#include "py_panda.h"
 IMPORT_THIS struct Dtool_PyTypedObject Dtool_WindowHandle;
 #endif
 
@@ -81,9 +81,9 @@ P3DPythonRun(const char *program_name, const char *archive_file,
 
   // Initialize Python.  It appears to be important to do this before
   // we open the pipe streams and spawn the thread, below.
-  PyEval_InitThreads();
   Py_SetProgramName((char *)_program_name.c_str());
   Py_Initialize();
+  PyEval_InitThreads();
   PySys_SetArgv(_py_argc, _py_argv);
 
   // Open the error output before we do too much more.

+ 1 - 1
direct/src/plugin_installer/make_installer.py

@@ -441,7 +441,7 @@ def makeInstaller():
         if not os.path.exists(dst_panda3dapp): os.makedirs(os.path.dirname(dst_panda3dapp))
         shutil.copytree(pluginFiles[npapi], dst_npapi)
         shutil.copyfile(pluginFiles[panda3d], dst_panda3d)
-        os.chmod(dst_panda3d, 0755)
+        os.chmod(dst_panda3d, 0o755)
         shutil.copytree(pluginFiles[panda3dapp], dst_panda3dapp)
         
         tmpresdir = tempfile.mktemp('', 'p3d-resources')

+ 1 - 1
direct/src/plugin_standalone/make_osx_bundle.py

@@ -73,7 +73,7 @@ def makeBundle(startDir):
     shutil.copyfile(icons.toOsSpecific(), iconFilename.toOsSpecific())
     print panda3d_mac, exeFilename
     shutil.copyfile(panda3d_mac.toOsSpecific(), exeFilename.toOsSpecific())
-    os.chmod(exeFilename.toOsSpecific(), 0755)
+    os.chmod(exeFilename.toOsSpecific(), 0o755)
 
     # All done!
     bundleFilename.touch()

+ 1 - 1
direct/src/pyinst/finder.py

@@ -96,7 +96,7 @@ def identify(name, xtrapath=None):
     else:
         if xtrapath is None:
             xtra = []
-        elif _pcache.has_key(id(xtrapath)):
+        elif id(xtrapath) in _pcache:
             xtra = _pcache[id(xtrapath)]
         else:
             xtra = expand(xtrapath)

+ 1 - 1
direct/src/pyinst/imputil.py

@@ -223,7 +223,7 @@ class Importer:
 
     # execute the code within the module's namespace
     if not is_module:
-      exec result[1] in module.__dict__
+      exec(result[1], module.__dict__)
 
     # insert the module into its parent
     if parent:

+ 6 - 6
direct/src/pyinst/modulefinder.py

@@ -218,7 +218,7 @@ class ModuleFinder:
         else:
             self.msgout(3, "import_module ->", m)
             return m
-        if self.badmodules.has_key(fqname):
+        if fqname in self.badmodules:
             self.msgout(3, "import_module -> None")
             self.badmodules[fqname][parent.__name__] = None
             return None
@@ -275,24 +275,24 @@ class ModuleFinder:
                 i = i+2
             if op == IMPORT_NAME:
                 name = lastname = co.co_names[oparg]
-                if not self.badmodules.has_key(lastname):
+                if lastname not in self.badmodules:
                     try:
                         self.import_hook(name, m)
                     except ImportError, msg:
                         self.msg(2, "ImportError:", str(msg))
-                        if not self.badmodules.has_key(name):
+                        if name not in self.badmodules:
                             self.badmodules[name] = {}
                         self.badmodules[name][m.__name__] = None
             elif op == IMPORT_FROM:
                 name = co.co_names[oparg]
                 assert lastname is not None
-                if not self.badmodules.has_key(lastname):
+                if lastname not in self.badmodules:
                     try:
                         self.import_hook(lastname, m, [name])
                     except ImportError, msg:
                         self.msg(2, "ImportError:", str(msg))
                         fullname = lastname + "." + name
-                        if not self.badmodules.has_key(fullname):
+                        if fullname not in self.badmodules:
                             self.badmodules[fullname] = {}
                         self.badmodules[fullname][m.__name__] = None
             else:
@@ -316,7 +316,7 @@ class ModuleFinder:
         return m
 
     def add_module(self, fqname):
-        if self.modules.has_key(fqname):
+        if fqname in self.modules:
             return self.modules[fqname]
         self.modules[fqname] = m = Module(fqname)
         return m

+ 1 - 1
direct/src/pyinst/resource.py

@@ -18,7 +18,7 @@ def makeresource(name, xtrapath=None):
        when the module archive.py was desired."""
     typ, nm, fullname = finder.identify(name, xtrapath)
     fullname = os.path.normpath(fullname)
-    if _cache.has_key(fullname):
+    if fullname in _cache:
         return _cache[fullname]
     elif typ in (finder.SCRIPT, finder.GSCRIPT):
         rsrc = scriptresource(nm, fullname)

+ 3 - 3
direct/src/showbase/Audio3DManager.py

@@ -139,7 +139,7 @@ class Audio3DManager:
         """
         Get the velocity of the sound.
         """
-        if (self.vel_dict.has_key(sound)):
+        if (sound in self.vel_dict):
             vel = self.vel_dict[sound]
             if (vel!=None):
                 return vel
@@ -196,7 +196,7 @@ class Audio3DManager:
                     # the object any more
                     del self.sound_dict[known_object]
 
-        if not self.sound_dict.has_key(object):
+        if object not in self.sound_dict:
             self.sound_dict[object] = []
 
         self.sound_dict[object].append(sound)
@@ -222,7 +222,7 @@ class Audio3DManager:
         """
         returns a list of sounds attached to an object
         """
-        if not self.sound_dict.has_key(object):
+        if object not in self.sound_dict:
             return []
         sound_list = []
         sound_list.extend(self.sound_dict[object])

+ 10 - 10
direct/src/showbase/ElementTree.py

@@ -794,7 +794,7 @@ def _encode_entity(text, pattern=_escape):
 # the following functions assume an ascii-compatible encoding
 # (or "utf-16")
 
-def _escape_cdata(text, encoding=None, replace=string.replace):
+def _escape_cdata(text, encoding=None):
     # escape character data
     try:
         if encoding:
@@ -802,14 +802,14 @@ def _escape_cdata(text, encoding=None, replace=string.replace):
                 text = _encode(text, encoding)
             except UnicodeError:
                 return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
+        text = text.replace("&", "&amp;")
+        text = text.replace("<", "&lt;")
+        text = text.replace( ">", "&gt;")
         return text
     except (TypeError, AttributeError):
         _raise_serialization_error(text)
 
-def _escape_attrib(text, encoding=None, replace=string.replace):
+def _escape_attrib(text, encoding=None):
     # escape attribute value
     try:
         if encoding:
@@ -817,11 +817,11 @@ def _escape_attrib(text, encoding=None, replace=string.replace):
                 text = _encode(text, encoding)
             except UnicodeError:
                 return _encode_entity(text)
-        text = replace(text, "&", "&amp;")
-        text = replace(text, "'", "&apos;") # FIXME: overkill
-        text = replace(text, "\"", "&quot;")
-        text = replace(text, "<", "&lt;")
-        text = replace(text, ">", "&gt;")
+        text = text.replace("&", "&amp;")
+        text = text.replace("'", "&apos;") # FIXME: overkill
+        text = text.replace("\"", "&quot;")
+        text = text.replace("<", "&lt;")
+        text = text.replace(">", "&gt;")
         return text
     except (TypeError, AttributeError):
         _raise_serialization_error(text)

+ 0 - 1
direct/src/showbase/ExceptionVarDump.py

@@ -1,7 +1,6 @@
 from pandac.PandaModules import getConfigShowbase
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.showbase.PythonUtil import fastRepr
-from exceptions import Exception
 import sys
 import types
 import traceback

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

@@ -20,7 +20,7 @@ class Factory:
         return self._type2ctor[type](*args, **kwArgs)
 
     def _registerType(self, type, ctor):
-        if self._type2ctor.has_key(type):
+        if type in self._type2ctor:
             self.notify.debug('replacing %s ctor %s with %s' %
                               (type, self._type2ctor[type], ctor))
         self._type2ctor[type] = ctor

+ 18 - 19
direct/src/showbase/Finder.py

@@ -5,7 +5,6 @@ __all__ = ['findClass', 'rebindClass', 'copyFuncs', 'replaceMessengerFunc', 'rep
 import time
 import types
 import os
-import new
 import sys
 
 def findClass(className):
@@ -107,24 +106,24 @@ def copyFuncs(fromClass, toClass):
                 #   SystemError: cellobject.c:22: bad argument to internal function
                 # Give the new function code the same filename as the old function
                 # Perhaps there is a cleaner way to do this? This was my best idea.
-                newCode = new.code(newFunc.func_code.co_argcount,
-                                   newFunc.func_code.co_nlocals,
-                                   newFunc.func_code.co_stacksize,
-                                   newFunc.func_code.co_flags,
-                                   newFunc.func_code.co_code,
-                                   newFunc.func_code.co_consts,
-                                   newFunc.func_code.co_names,
-                                   newFunc.func_code.co_varnames,
-                                   # Use the oldFunc's filename here. Tricky!
-                                   oldFunc.func_code.co_filename,
-                                   newFunc.func_code.co_name,
-                                   newFunc.func_code.co_firstlineno,
-                                   newFunc.func_code.co_lnotab)
-                newFunc = new.function(newCode,
-                                       newFunc.func_globals,
-                                       newFunc.func_name,
-                                       newFunc.func_defaults,
-                                       newFunc.func_closure)
+                newCode = types.CodeType(newFunc.func_code.co_argcount,
+                                         newFunc.func_code.co_nlocals,
+                                         newFunc.func_code.co_stacksize,
+                                         newFunc.func_code.co_flags,
+                                         newFunc.func_code.co_code,
+                                         newFunc.func_code.co_consts,
+                                         newFunc.func_code.co_names,
+                                         newFunc.func_code.co_varnames,
+                                         # Use the oldFunc's filename here. Tricky!
+                                         oldFunc.func_code.co_filename,
+                                         newFunc.func_code.co_name,
+                                         newFunc.func_code.co_firstlineno,
+                                         newFunc.func_code.co_lnotab)
+                newFunc = types.FunctionType(newCode,
+                                             newFunc.func_globals,
+                                             newFunc.func_name,
+                                             newFunc.func_defaults,
+                                             newFunc.func_closure)
                 """
                 replaceFuncList.append((oldFunc, funcName, newFunc))
             else:

+ 1 - 2
direct/src/showbase/Messenger.py

@@ -506,7 +506,6 @@ class Messenger:
         This is only used by Finder.py - the module that lets
         you redefine functions with Control-c-Control-v
         """
-        import new
         retFlag = 0
         for entry in self.__callbacks.items():
             event, objectDict = entry
@@ -522,7 +521,7 @@ class Messenger:
                 #       'oldMethod: ' + repr(oldMethod) + '\n' +
                 #       'newFunction: ' + repr(newFunction) + '\n')
                 if (function == oldMethod):
-                    newMethod = new.instancemethod(
+                    newMethod = types.MethodType(
                         newFunction, method.im_self, method.im_class)
                     params[0] = newMethod
                     # Found it retrun true

+ 32 - 50
direct/src/showbase/PythonUtil.py

@@ -1,7 +1,7 @@
 
 """Undocumented Module"""
 
-__all__ = ['enumerate', 'unique', 'indent', 'nonRepeatingRandomList',
+__all__ = ['unique', 'indent', 'nonRepeatingRandomList',
 'writeFsmTree', 'StackTrace', 'traceFunctionCall', 'traceParentCall',
 'printThisCall', 'tron', 'trace', 'troff', 'getClassLineage', 'pdir',
 '_pdir', '_is_variadic', '_has_keywordargs', '_varnames', '_getcode',
@@ -45,7 +45,6 @@ import os
 import sys
 import random
 import time
-import new
 import gc
 #if __debug__:
 import traceback
@@ -68,24 +67,6 @@ from libpandaexpress import ConfigVariableBool
 
 ScalarTypes = (types.FloatType, types.IntType, types.LongType)
 
-import __builtin__
-if not hasattr(__builtin__, 'enumerate'):
-    def enumerate(L):
-        """Returns (0, L[0]), (1, L[1]), etc., allowing this syntax:
-        for i, item in enumerate(L):
-           ...
-
-        enumerate is a built-in feature in Python 2.3, which implements it
-        using an iterator. For now, we can use this quick & dirty
-        implementation that returns a list of tuples that is completely
-        constructed every time enumerate() is called.
-        """
-        return zip(xrange(len(L)), L)
-
-    __builtin__.enumerate = enumerate
-else:
-    enumerate = __builtin__.enumerate
-
 """
 # with one integer positional arg, this uses about 4/5 of the memory of the Functor class below
 def Functor(function, *args, **kArgs):
@@ -187,7 +168,7 @@ class Queue:
     def __len__(self):
         return len(self.__list)
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     q = Queue()
     assert q.isEmpty()
     q.clear()
@@ -634,7 +615,7 @@ class Signature:
                 l.append('*' + specials['positional'])
             if 'keyword' in specials:
                 l.append('**' + specials['keyword'])
-            return "%s(%s)" % (self.name, string.join(l, ', '))
+            return "%s(%s)" % (self.name, ', '.join(l))
         else:
             return "%s(?)" % self.name
 
@@ -927,7 +908,7 @@ def binaryRepr(number, max_length = 32):
     digits = map (operator.mod, shifts, max_length * [2])
     if not digits.count (1): return 0
     digits = digits [digits.index (1):]
-    return string.join (map (repr, digits), '')
+    return ''.join([repr(digit) for digit in digits])
 
 class StdoutCapture:
     # redirects stdout to a string
@@ -1213,7 +1194,7 @@ def extractProfile(*args, **kArgs):
 def getSetterName(valueName, prefix='set'):
     # getSetterName('color') -> 'setColor'
     # getSetterName('color', 'get') -> 'getColor'
-    return '%s%s%s' % (prefix, string.upper(valueName[0]), valueName[1:])
+    return '%s%s%s' % (prefix, valueName[0].upper(), valueName[1:])
 def getSetter(targetObj, valueName, prefix='set'):
     # getSetter(smiley, 'pos') -> smiley.setPos
     return getattr(targetObj, getSetterName(valueName, prefix))
@@ -1221,16 +1202,15 @@ def getSetter(targetObj, valueName, prefix='set'):
 def mostDerivedLast(classList):
     """pass in list of classes. sorts list in-place, with derived classes
     appearing after their bases"""
-    def compare(a, b):
-        if issubclass(a, b):
-            result=1
-        elif issubclass(b, a):
-            result=-1
-        else:
-            result=0
-        #print a, b, result
-        return result
-    classList.sort(compare)
+
+    class ClassSortKey(object):
+        __slots__ = 'classobj',
+        def __init__(self, classobj):
+            self.classobj = classobj
+        def __lt__(self, other):
+            return issubclass(other.classobj, self.classobj)
+
+    classList.sort(key=ClassSortKey)
 
 """
 ParamObj/ParamSet
@@ -1447,6 +1427,8 @@ class ParamObj:
                 # we've already compiled the defaults for this class
                 return
             bases = list(cls.__bases__)
+            if object in bases:
+                bases.remove(object)
             # bring less-derived classes to the front
             mostDerivedLast(bases)
             cls._Params = {}
@@ -1527,7 +1509,7 @@ class ParamObj:
                 # then the applier, or b) call the setter and queue the
                 # applier, depending on whether our params are locked
                 """
-                setattr(self, setterName, new.instancemethod(
+                setattr(self, setterName, types.MethodType(
                     Functor(setterStub, param, setterFunc), self, self.__class__))
                     """
                 def setterStub(self, value, param=param, origSetterName=origSetterName):
@@ -1632,7 +1614,7 @@ class ParamObj:
             argStr += '%s=%s,' % (param, repr(value))
         return '%s(%s)' % (self.__class__.__name__, argStr)
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     class ParamObjTest(ParamObj):
         class ParamSet(ParamObj.ParamSet):
             Params = {
@@ -1829,7 +1811,7 @@ class POD:
             argStr += '%s=%s,' % (name, repr(getSetter(self, name, 'get')()))
         return '%s(%s)' % (self.__class__.__name__, argStr)
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     class PODtest(POD):
         DataSet = {
             'foo': dict,
@@ -2159,7 +2141,7 @@ def pivotScalar(scalar, pivot):
     # reflect scalar about pivot; see tests below
     return pivot + (pivot - scalar)
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     assert pivotScalar(1, 0) == -1
     assert pivotScalar(-1, 0) == 1
     assert pivotScalar(3, 5) == 7
@@ -2752,7 +2734,7 @@ def tagRepr(obj, tag):
             return s
         oldRepr = Functor(stringer, repr(obj))
         stringer = None
-    obj.__repr__ = new.instancemethod(Functor(reprWithTag, oldRepr, tag), obj, obj.__class__)
+    obj.__repr__ = types.MethodType(Functor(reprWithTag, oldRepr, tag), obj, obj.__class__)
     reprWithTag = None
     return obj
 
@@ -2779,7 +2761,7 @@ def appendStr(obj, st):
             return s
         oldStr = Functor(stringer, str(obj))
         stringer = None
-    obj.__str__ = new.instancemethod(Functor(appendedStr, oldStr, st), obj, obj.__class__)
+    obj.__str__ = types.MethodType(Functor(appendedStr, oldStr, st), obj, obj.__class__)
     appendedStr = None
     return obj
 
@@ -3616,9 +3598,9 @@ def recordCreationStackStr(cls):
         self._creationStackTraceStrLst = StackTrace(start=1).compact().split(',')
         return self.__moved_init__(*args, **kArgs)
     def getCreationStackTraceCompactStr(self):
-        return string.join(self._creationStackTraceStrLst, ',')
+        return ','.join(self._creationStackTraceStrLst)
     def printCreationStackTrace(self):
-        print string.join(self._creationStackTraceStrLst, ',')
+        print ','.join(self._creationStackTraceStrLst)
     cls.__init__ = __recordCreationStackStr_init__
     cls.getCreationStackTraceCompactStr = getCreationStackTraceCompactStr
     cls.printCreationStackTrace = printCreationStackTrace
@@ -3770,7 +3752,7 @@ def flywheel(*args, **kArgs):
         pass
     return flywheel
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     f = flywheel(['a','b','c','d'], countList=[11,20,3,4])
     obj2count = {}
     for obj in f:
@@ -3964,7 +3946,7 @@ def formatTimeCompact(seconds):
     result += '%ss' % seconds
     return result
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     ftc = formatTimeCompact
     assert ftc(0) == '0s'
     assert ftc(1) == '1s'
@@ -4000,7 +3982,7 @@ def formatTimeExact(seconds):
         result += '%ss' % seconds
     return result
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     fte = formatTimeExact
     assert fte(0) == '0s'
     assert fte(1) == '1s'
@@ -4039,7 +4021,7 @@ class AlphabetCounter:
                 break
         return result
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     def testAlphabetCounter():
         tempList = []
         ac = AlphabetCounter()
@@ -4215,7 +4197,7 @@ def unescapeHtmlString(s):
         result += char
     return result
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     assert unescapeHtmlString('asdf') == 'asdf'
     assert unescapeHtmlString('as+df') == 'as df'
     assert unescapeHtmlString('as%32df') == 'as2df'
@@ -4272,7 +4254,7 @@ class HTMLStringToElements(HTMLParser):
 def str2elements(str):
     return HTMLStringToElements(str).getElements()
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     s = ScratchPad()
     assert len(str2elements('')) == 0
     s.br = str2elements('<br>')
@@ -4312,7 +4294,7 @@ def repeatableRepr(obj):
         return repeatableRepr(l)
     return repr(obj)
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     assert repeatableRepr({1: 'a', 2: 'b'}) == repeatableRepr({2: 'b', 1: 'a'})
     assert repeatableRepr(set([1,2,3])) == repeatableRepr(set([3,2,1]))
 
@@ -4369,7 +4351,7 @@ class PriorityCallbacks:
         for priority, callback in self._callbacks:
             callback()
 
-if __debug__:
+if __debug__ and __name__ == '__main__':
     l = []
     def a(l=l):
         l.append('a')

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

@@ -312,7 +312,7 @@ class ShowBase(DirectObject.DirectObject):
                 TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
 
         # Make sure we're not making more than one ShowBase.
-        if hasattr(__builtin__, 'base'):
+        if 'base' in __builtin__.__dict__:
             raise StandardError, "Attempt to spawn multiple ShowBase instances!"
         
         __builtin__.base = self

+ 1 - 2
direct/src/showbase/VFSImporter.py

@@ -1,6 +1,5 @@
 from libpandaexpress import Filename, VirtualFileSystem, VirtualFileMountSystem, OFileStream, copyStream
 import sys
-import new
 import os
 import marshal
 import imp
@@ -457,7 +456,7 @@ class VFSSharedLoader:
         # Also set this special symbol, which records that this is a
         # shared package, and also lists the paths we have already
         # loaded.
-        mod._vfs_shared_path = vfs_shared_path + map(lambda l: l.dir_path, self.loaders)
+        mod._vfs_shared_path = vfs_shared_path + [l.dir_path for l in self.loaders]
 
         return mod
 

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

@@ -18,7 +18,7 @@ def newimport(*args, **kw):
     fPrint = 0
     name = args[0]
     # Only print the name if we have not imported this before
-    if not sys.modules.has_key(name):
+    if name not in sys.modules:
         print (" "*indentLevel + "import " + args[0])
         fPrint = 1
     indentLevel += 1

+ 1 - 1
direct/src/showutil/FreezeTool.py

@@ -657,7 +657,7 @@ class Freezer:
         __path__. """
 
         str = 'import %s' % (moduleName)
-        exec str
+        exec(str)
 
         module = sys.modules[moduleName]
         for path in module.__path__:

+ 1 - 1
direct/src/showutil/TexMemWatcher.py

@@ -627,7 +627,7 @@ class TexMemWatcher(DirectObject):
             self.repack()
 
         else:
-            overflowCount = sum(map(lambda tp: tp.overflowed, self.texPlacements.keys()))
+            overflowCount = sum([tp.overflowed for tp in self.texPlacements.keys()])
             if totalSize <= self.limit and overflowCount:
                 # Shouldn't be overflowing any more.  Better repack.
                 self.repack()

+ 3 - 4
direct/src/task/Task.py

@@ -560,10 +560,9 @@ class TaskManager:
         else:
             function = method
         if (function == oldMethod):
-            import new
-            newMethod = new.instancemethod(newFunction,
-                                           method.im_self,
-                                           method.im_class)
+            newMethod = types.MethodType(newFunction,
+                                         method.im_self,
+                                         method.im_class)
             task.setFunction(newMethod)
             # Found a match
             return 1

+ 2 - 3
direct/src/tkpanels/DirectSessionPanel.py

@@ -216,8 +216,7 @@ class DirectSessionPanel(AppShell):
         Label(drFrame, text = 'Display Region',
               font=('MSSansSerif', 14, 'bold')).pack(expand = 0)
 
-        nameList = map(lambda x: 'Display Region ' + repr(x),
-                       range(len(base.direct.drList)))
+        nameList = ['Display Region ' + repr(x) for x in range(len(base.direct.drList))]
         self.drMenu = Pmw.ComboBox(
             drFrame, labelpos = W, label_text = 'Display Region:',
             entry_width = 20,
@@ -726,7 +725,7 @@ class DirectSessionPanel(AppShell):
         else:
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             names.append(dictName)
             listbox = menu.component('scrolledlist')

+ 1 - 1
direct/src/tkpanels/FSMInspector.py

@@ -71,7 +71,7 @@ class FSMInspector(AppShell):
                                      'Set state label size', tearoff = 1)
         for size in (8, 10, 12, 14, 18, 24):
             menuBar.addmenuitem('Font Size', 'command',
-                'Set font to: ' + repr(size) + ' Pts', label = `size` + ' Pts',
+                'Set font to: ' + repr(size) + ' Pts', label = repr(size) + ' Pts',
                 command = lambda s = self, sz = size: s.setFontSize(sz))
         menuBar.addcascademenu('States', 'Marker Size',
                                      'Set state marker size', tearoff = 1)

+ 3 - 3
direct/src/tkpanels/Inspector.py

@@ -24,7 +24,7 @@ def inspect(anObject):
 
 def inspectorFor(anObject):
     typeName = string.capitalize(type(anObject).__name__) + 'Type'
-    if _InspectorMap.has_key(typeName):
+    if typeName in _InspectorMap:
         inspectorName = _InspectorMap[typeName]
     else:
         print "Can't find an inspector for " + typeName
@@ -92,7 +92,7 @@ class Inspector:
             #    self._partsList.append(each)  
 
     def initializePartNames(self):
-        self._partNames = ['up'] + map(lambda each: str(each), self._partsList)
+        self._partNames = ['up'] + [str(each) for each in self._partsList]
 
     def title(self):
         "Subclasses may override."
@@ -195,7 +195,7 @@ class DictionaryInspector(Inspector):
         if partNumber == 0:
             return self.object
         key = self.privatePartNumber(partNumber)
-        if self.object.has_key(key):
+        if key in self.object:
             return self.object[key]
         else:
             return getattr(self.object, key)

+ 1 - 1
direct/src/tkpanels/MopathRecorder.py

@@ -1248,7 +1248,7 @@ class MopathRecorder(AppShell, DirectObject):
         else:
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             names.append(dictName)
             listbox = menu.component('scrolledlist')

+ 2 - 2
direct/src/tkpanels/ParticlePanel.py

@@ -1132,7 +1132,7 @@ class ParticlePanel(AppShell):
         self.particlesLabelMenu.add_separator()
         # Add in a checkbutton for each effect (to toggle on/off)
         particles = self.particleEffect.getParticlesList()
-        names = map(lambda x: x.getName(), particles)
+        names = [x.getName() for x in particles]
         names.sort()
         for name in names:
             particle = self.particleEffect.getParticlesNamed(name)
@@ -1157,7 +1157,7 @@ class ParticlePanel(AppShell):
         self.forceGroupLabelMenu.add_separator()
         # Add in a checkbutton for each effect (to toggle on/off)
         forceGroupList = self.particleEffect.getForceGroupList()
-        names = map(lambda x: x.getName(), forceGroupList)
+        names = [x.getName() for x in forceGroupList]
         names.sort()
         for name in names:
             force = self.particleEffect.getForceGroupNamed(name)

+ 1 - 1
direct/src/tkpanels/Placer.py

@@ -510,7 +510,7 @@ class Placer(AppShell):
         else:
             # Generate a unique name for the dict
             dictName = name + '-' + repr(nodePath.id())
-        if not dict.has_key(dictName):
+        if dictName not in dict:
             # Update combo box to include new item
             names.append(dictName)
             listbox = menu.component('scrolledlist')

+ 1 - 2
direct/src/tkwidgets/EntryScale.py

@@ -293,8 +293,7 @@ class EntryScaleGroup(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
         #define the megawidget options
         INITOPT = Pmw.INITOPT

+ 1 - 2
direct/src/tkwidgets/Floater.py

@@ -218,8 +218,7 @@ class FloaterGroup(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
         #define the megawidget options
         INITOPT = Pmw.INITOPT

+ 1 - 1
direct/src/tkwidgets/Slider.py

@@ -262,7 +262,7 @@ class SliderWidget(Pmw.MegaWidget):
         self.initialiseoptions(SliderWidget)
 
         # Adjust relief
-        if not kw.has_key('relief'):
+        if 'relief' not in kw:
             if self['style'] == VALUATOR_FULL:
                 self['relief'] = FLAT
 

+ 3 - 3
direct/src/tkwidgets/Tree.py

@@ -227,7 +227,7 @@ class TreeNode:
         self.kidKeys = []
         for item in sublist:
             key = item.GetKey()
-            if fUseCachedChildren and self.children.has_key(key):
+            if fUseCachedChildren and key in self.children:
                 child = self.children[key]
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
@@ -291,7 +291,7 @@ class TreeNode:
             sublist.sort(compareText)
         for item in sublist:
             key = item.GetKey()
-            if fUseCachedChildren and self.children.has_key(key):
+            if fUseCachedChildren and key in self.children:
                 child = self.children[key]
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)
@@ -452,7 +452,7 @@ class TreeNode:
             key = item.GetKey()
 
             # Use existing child or create new TreeNode if none exists
-            if self.children.has_key(key):
+            if key in self.children:
                 child = self.children[key]
             else:
                 child = TreeNode(self.canvas, self, item, self.menuList)

+ 3 - 5
direct/src/tkwidgets/Valuator.py

@@ -89,7 +89,7 @@ class Valuator(Pmw.MegaWidget):
         self.packValuator()
 
         # Set reset value if none specified
-        if not kw.has_key('resetValue'):
+        if 'resetValue' not in kw:
             self['resetValue'] = self['value']
 
         if self['fAdjustable']:
@@ -351,8 +351,7 @@ class ValuatorGroup(Pmw.MegaWidget):
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
         #define the megawidget options
         INITOPT = Pmw.INITOPT
@@ -486,8 +485,7 @@ class ValuatorGroupPanel(Pmw.MegaToplevel):
         DEFAULT_DIM = 1
         # Default value depends on *actual* group size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
         #define the megawidget options
         INITOPT = Pmw.INITOPT

+ 1 - 2
direct/src/tkwidgets/VectorWidgets.py

@@ -19,8 +19,7 @@ class VectorEntry(Pmw.MegaWidget):
         DEFAULT_DIM = 3
         # Default value depends on *actual* vector size, test for user input
         DEFAULT_VALUE = [0.0] * kw.get('dim', DEFAULT_DIM)
-        DEFAULT_LABELS = map(lambda x: 'v[%d]' % x,
-                             range(kw.get('dim', DEFAULT_DIM)))
+        DEFAULT_LABELS = ['v[%d]' % x for x in range(kw.get('dim', DEFAULT_DIM))]
 
         # Process options
         INITOPT = Pmw.INITOPT

+ 12 - 12
direct/src/wxwidgets/WxPandaShell.py

@@ -126,26 +126,26 @@ class WxPandaShell(WxAppShell):
             base.startDirect(fWantTk = 0, fWantWx = 0)
 
             base.direct.disableMouseEvents()
-            newMouseEvents = map(lambda x: "_le_per_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.mouseEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.mouseEvents)
+            newMouseEvents = ["_le_per_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.mouseEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.mouseEvents]
             base.direct.mouseEvents = newMouseEvents
             base.direct.enableMouseEvents()
 
             base.direct.disableKeyEvents()
-            keyEvents = map(lambda x: "_le_per_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.keyEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.keyEvents)
+            keyEvents = ["_le_per_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.keyEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.keyEvents]
             base.direct.keyEvents = keyEvents
             base.direct.enableKeyEvents()
 
             base.direct.disableModifierEvents()
-            modifierEvents = map(lambda x: "_le_per_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_fro_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_lef_%s"%x, base.direct.modifierEvents) +\
-                             map(lambda x: "_le_top_%s"%x, base.direct.modifierEvents)
+            modifierEvents = ["_le_per_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_fro_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_lef_%s"%x for x in base.direct.modifierEvents] +\
+                             ["_le_top_%s"%x for x in base.direct.modifierEvents]
             base.direct.modifierEvents = modifierEvents
             base.direct.enableModifierEvents()
 

+ 0 - 3
dtool/Config.Android.pp

@@ -245,9 +245,6 @@
 // assertion failures on execution.
 #define SIMPLE_STRUCT_POINTERS
 
-// Do we have a gettimeofday() function?
-#define HAVE_GETTIMEOFDAY 1
-
 // Does gettimeofday() take only one parameter?
 #define GETTIMEOFDAY_ONE_PARAM
 

+ 0 - 3
dtool/Config.FreeBSD.pp

@@ -168,9 +168,6 @@
 // assertion failures on execution.
 #define SIMPLE_STRUCT_POINTERS
 
-// Do we have a gettimeofday() function?
-#define HAVE_GETTIMEOFDAY 1
-
 // Does gettimeofday() take only one parameter?
 #define GETTIMEOFDAY_ONE_PARAM
 

+ 0 - 3
dtool/Config.Irix.pp

@@ -41,9 +41,6 @@
 // assertion failures on execution.
 #define SIMPLE_STRUCT_POINTERS
 
-// Do we have a gettimeofday() function?
-#define HAVE_GETTIMEOFDAY 1
-
 // Does gettimeofday() take only one parameter?
 #define GETTIMEOFDAY_ONE_PARAM
 

+ 0 - 3
dtool/Config.Linux.pp

@@ -210,9 +210,6 @@
 // assertion failures on execution.
 #define SIMPLE_STRUCT_POINTERS
 
-// Do we have a gettimeofday() function?
-#define HAVE_GETTIMEOFDAY 1
-
 // Does gettimeofday() take only one parameter?
 #define GETTIMEOFDAY_ONE_PARAM
 

+ 0 - 3
dtool/Config.OSX.pp

@@ -169,9 +169,6 @@
 // assertion failures on execution.
 #define SIMPLE_STRUCT_POINTERS
 
-// Do we have a gettimeofday() function?
-#define HAVE_GETTIMEOFDAY 1
-
 // Does gettimeofday() take only one parameter?
 #define GETTIMEOFDAY_ONE_PARAM
 

Some files were not shown because too many files changed in this diff