Browse Source

formatting

Dave Schuyler 20 years ago
parent
commit
fc7fc09140
33 changed files with 211 additions and 211 deletions
  1. 29 29
      direct/src/directtools/DirectSelection.py
  2. 35 35
      direct/src/directtools/DirectSession.py
  3. 3 3
      direct/src/directtools/DirectUtil.py
  4. 1 1
      direct/src/directutil/DistributedLargeBlobSender.py
  5. 1 1
      direct/src/directutil/DistributedLargeBlobSenderAI.py
  6. 1 1
      direct/src/directutil/Mopath.py
  7. 8 8
      direct/src/directutil/Verify.py
  8. 2 2
      direct/src/directutil/WeightedChoice.py
  9. 9 9
      direct/src/distributed/AsyncRequest.py
  10. 5 5
      direct/src/distributed/CRCache.py
  11. 7 7
      direct/src/distributed/CartesianGridBase.py
  12. 6 6
      direct/src/distributed/ClientRepository.py
  13. 3 3
      direct/src/distributed/ClientRepositoryBase.py
  14. 3 3
      direct/src/distributed/ConnectionRepository.py
  15. 13 13
      direct/src/distributed/DistributedCartesianGrid.py
  16. 2 2
      direct/src/distributed/DistributedCartesianGridAI.py
  17. 7 7
      direct/src/distributed/DistributedNode.py
  18. 8 8
      direct/src/distributed/DistributedNodeAI.py
  19. 4 4
      direct/src/distributed/DistributedNodeUD.py
  20. 2 2
      direct/src/distributed/DistributedObject.py
  21. 4 4
      direct/src/distributed/DistributedObjectAI.py
  22. 2 2
      direct/src/distributed/DistributedObjectBase.py
  23. 1 1
      direct/src/distributed/DistributedObjectGlobal.py
  24. 2 2
      direct/src/distributed/DistributedObjectGlobalAI.py
  25. 3 3
      direct/src/distributed/DistributedObjectOV.py
  26. 4 4
      direct/src/distributed/DistributedObjectUD.py
  27. 14 14
      direct/src/distributed/DistributedSmoothNodeAI.py
  28. 17 17
      direct/src/distributed/DoCollectionManager.py
  29. 1 1
      direct/src/distributed/DoInterestManager.py
  30. 7 7
      direct/src/distributed/GridParent.py
  31. 1 1
      direct/src/distributed/SampleObject.py
  32. 3 3
      direct/src/distributed/ServerRepository.py
  33. 3 3
      direct/src/extensions/CInterval-extensions.py

+ 29 - 29
direct/src/directtools/DirectSelection.py

@@ -21,7 +21,7 @@ class DirectNodePath(NodePath):
         self.mCoa2Dnp = Mat4(Mat4.identMat())
         self.mCoa2Dnp = Mat4(Mat4.identMat())
         if direct.coaMode == COA_CENTER:
         if direct.coaMode == COA_CENTER:
             self.mCoa2Dnp.setRow(3, Vec4(center[0], center[1], center[2], 1))
             self.mCoa2Dnp.setRow(3, Vec4(center[0], center[1], center[2], 1))
-            
+
         # Transform from nodePath to widget
         # Transform from nodePath to widget
         self.tDnp2Widget = TransformState.makeIdentity()
         self.tDnp2Widget = TransformState.makeIdentity()
 
 
@@ -80,7 +80,7 @@ class SelectedNodePaths(DirectObject):
                 if nodePath.hasNetTag(tag):
                 if nodePath.hasNetTag(tag):
                     nodePath = nodePath.findNetTag(tag)
                     nodePath = nodePath.findNetTag(tag)
                     break
                     break
-        
+
         # Get this pointer
         # Get this pointer
         id = nodePath.id()
         id = nodePath.id()
         # First see if its already in the selected dictionary
         # First see if its already in the selected dictionary
@@ -136,7 +136,7 @@ class SelectedNodePaths(DirectObject):
         """
         """
         return self.selectedDict.values()[:]
         return self.selectedDict.values()[:]
 
 
-    def __getitem__(self,index):
+    def __getitem__(self, index):
         return self.getSelectedAsList()[index]
         return self.getSelectedAsList()[index]
 
 
     def getSelectedDict(self, id):
     def getSelectedDict(self, id):
@@ -209,7 +209,7 @@ class SelectedNodePaths(DirectObject):
         if selected:
         if selected:
             selected.remove()
             selected.remove()
         __builtins__["last"] = self.last = None
         __builtins__["last"] = self.last = None
-        
+
     def removeAll(self):
     def removeAll(self):
         # Remove all selected nodePaths from the Scene Graph
         # Remove all selected nodePaths from the Scene Graph
         self.forEachSelectedNodePathDo(NodePath.remove)
         self.forEachSelectedNodePathDo(NodePath.remove)
@@ -266,14 +266,14 @@ class DirectBoundingBox:
         # Get bounds
         # Get bounds
         self.min = Point3(0)
         self.min = Point3(0)
         self.max = Point3(0)
         self.max = Point3(0)
-        self.nodePath.calcTightBounds(self.min,self.max)
+        self.nodePath.calcTightBounds(self.min, self.max)
         # Calc center and radius
         # Calc center and radius
         self.center = Point3((self.min + self.max)/2.0)
         self.center = Point3((self.min + self.max)/2.0)
         self.radius = Vec3(self.max - self.min).length()
         self.radius = Vec3(self.max - self.min).length()
         # Restore transform
         # Restore transform
         self.nodePath.setMat(tMat)
         self.nodePath.setMat(tMat)
         del tMat
         del tMat
-        
+
     def computeBounds(self):
     def computeBounds(self):
         self.bounds = self.getBounds()
         self.bounds = self.getBounds()
         if self.bounds.isEmpty() or self.bounds.isInfinite():
         if self.bounds.isEmpty() or self.bounds.isInfinite():
@@ -284,7 +284,7 @@ class DirectBoundingBox:
             self.radius = self.bounds.getRadius()
             self.radius = self.bounds.getRadius()
         self.min = Point3(self.center - Point3(self.radius))
         self.min = Point3(self.center - Point3(self.radius))
         self.max = Point3(self.center + Point3(self.radius))
         self.max = Point3(self.center + Point3(self.radius))
-        
+
     def createBBoxLines(self, bboxColor=None):
     def createBBoxLines(self, bboxColor=None):
         # Create a line segments object for the bbox
         # Create a line segments object for the bbox
         lines = LineNodePath(hidden)
         lines = LineNodePath(hidden)
@@ -301,7 +301,7 @@ class DirectBoundingBox:
         maxX = self.max[0]
         maxX = self.max[0]
         maxY = self.max[1]
         maxY = self.max[1]
         maxZ = self.max[2]
         maxZ = self.max[2]
-        
+
         # Bottom face
         # Bottom face
         lines.moveTo(minX, minY, minZ)
         lines.moveTo(minX, minY, minZ)
         lines.drawTo(maxX, minY, minZ)
         lines.drawTo(maxX, minY, minZ)
@@ -326,29 +326,29 @@ class DirectBoundingBox:
 
 
         # Create and return bbox lines
         # Create and return bbox lines
         lines.create()
         lines.create()
-        
+
         # Make sure bbox is never lit or drawn in wireframe
         # Make sure bbox is never lit or drawn in wireframe
         useDirectRenderStyle(lines)
         useDirectRenderStyle(lines)
-        
+
         return lines
         return lines
 
 
-    def setBoxColorScale(self,r,g,b,a):
+    def setBoxColorScale(self, r, g, b, a):
         if (self.lines):
         if (self.lines):
             self.lines.reset()
             self.lines.reset()
             self.lines = None
             self.lines = None
-        self.lines = self.createBBoxLines((r,g,b,a))
+        self.lines = self.createBBoxLines((r, g, b, a))
         self.show()
         self.show()
 
 
     def updateBBoxLines(self):
     def updateBBoxLines(self):
         ls = self.lines.lineSegs
         ls = self.lines.lineSegs
-        
+
         minX = self.min[0]
         minX = self.min[0]
         minY = self.min[1]
         minY = self.min[1]
         minZ = self.min[2]
         minZ = self.min[2]
         maxX = self.max[0]
         maxX = self.max[0]
         maxY = self.max[1]
         maxY = self.max[1]
         maxZ = self.max[2]
         maxZ = self.max[2]
-        
+
         # Bottom face
         # Bottom face
         ls.setVertex(0, minX, minY, minZ)
         ls.setVertex(0, minX, minY, minZ)
         ls.setVertex(1, maxX, minY, minZ)
         ls.setVertex(1, maxX, minY, minZ)
@@ -384,7 +384,7 @@ class DirectBoundingBox:
 
 
     def hide(self):
     def hide(self):
         self.lines.reparentTo(hidden)
         self.lines.reparentTo(hidden)
-        
+
     def getCenter(self):
     def getCenter(self):
         return self.center
         return self.center
 
 
@@ -401,7 +401,7 @@ class DirectBoundingBox:
         return '%.2f %.2f %.2f' % (vec[0], vec[1], vec[2])
         return '%.2f %.2f %.2f' % (vec[0], vec[1], vec[2])
 
 
     def __repr__(self):
     def __repr__(self):
-        return (`self.__class__` + 
+        return (`self.__class__` +
                 '\nNodePath:\t%s\n' % self.nodePath.getName() +
                 '\nNodePath:\t%s\n' % self.nodePath.getName() +
                 'Min:\t\t%s\n' % self.vecAsString(self.min) +
                 'Min:\t\t%s\n' % self.vecAsString(self.min) +
                 'Max:\t\t%s\n' % self.vecAsString(self.max) +
                 'Max:\t\t%s\n' % self.vecAsString(self.max) +
@@ -528,7 +528,7 @@ class SelectionQueue(CollisionHandlerQueue):
         self.setCurrentIndex(-1)
         self.setCurrentIndex(-1)
         self.setCurrentEntry(None)
         self.setCurrentEntry(None)
         # Pick out the closest object that isn't a widget
         # Pick out the closest object that isn't a widget
-        for i in range(startIndex,self.getNumEntries()):
+        for i in range(startIndex, self.getNumEntries()):
             entry = self.getEntry(i)
             entry = self.getEntry(i)
             nodePath = entry.getIntoNodePath()
             nodePath = entry.getIntoNodePath()
             if (skipFlags & SKIP_HIDDEN) and nodePath.isHidden():
             if (skipFlags & SKIP_HIDDEN) and nodePath.isHidden():
@@ -557,7 +557,7 @@ class SelectionRay(SelectionQueue):
         # Initialize the superclass
         # Initialize the superclass
         SelectionQueue.__init__(self, parentNP)
         SelectionQueue.__init__(self, parentNP)
         self.addCollider(CollisionRay())
         self.addCollider(CollisionRay())
-    
+
     def pick(self, targetNodePath, xy = None):
     def pick(self, targetNodePath, xy = None):
         # Determine ray direction based upon the mouse coordinates
         # Determine ray direction based upon the mouse coordinates
         if xy:
         if xy:
@@ -604,9 +604,9 @@ class SelectionRay(SelectionQueue):
         self.collider.setDirection(dir)
         self.collider.setDirection(dir)
         self.ct.traverse(targetNodePath)
         self.ct.traverse(targetNodePath)
         self.sortEntries()
         self.sortEntries()
-        
+
     def pickGeom3D(self, targetNodePath = render,
     def pickGeom3D(self, targetNodePath = render,
-                   origin = Point3(0), dir = Vec3(0,0,-1),
+                   origin = Point3(0), dir = Vec3(0, 0, -1),
                    skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
                    skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
         self.collideWithGeom()
         self.collideWithGeom()
         self.pick3D(targetNodePath, origin, dir)
         self.pick3D(targetNodePath, origin, dir)
@@ -615,7 +615,7 @@ class SelectionRay(SelectionQueue):
 
 
     def pickBitMask3D(self, bitMask = BitMask32.allOff(),
     def pickBitMask3D(self, bitMask = BitMask32.allOff(),
                       targetNodePath = render,
                       targetNodePath = render,
-                      origin = Point3(0), dir = Vec3(0,0,-1),
+                      origin = Point3(0), dir = Vec3(0, 0, -1),
                       skipFlags = SKIP_ALL):
                       skipFlags = SKIP_ALL):
         self.collideWithBitMask(bitMask)
         self.collideWithBitMask(bitMask)
         self.pick3D(targetNodePath, origin, dir)
         self.pick3D(targetNodePath, origin, dir)
@@ -633,7 +633,7 @@ class SelectionSegment(SelectionQueue):
         self.numColliders = 0
         self.numColliders = 0
         for i in range(numSegments):
         for i in range(numSegments):
             self.addCollider(CollisionSegment())
             self.addCollider(CollisionSegment())
-    
+
     def addCollider(self, collider):
     def addCollider(self, collider):
         # Record new collision object
         # Record new collision object
         self.colliders.append(collider)
         self.colliders.append(collider)
@@ -676,30 +676,30 @@ class SelectionSphere(SelectionQueue):
         self.numColliders = 0
         self.numColliders = 0
         for i in range(numSpheres):
         for i in range(numSpheres):
             self.addCollider(CollisionSphere(Point3(0), 1))
             self.addCollider(CollisionSphere(Point3(0), 1))
-        
+
     def addCollider(self, collider):
     def addCollider(self, collider):
         # Record new collision object
         # Record new collision object
         self.colliders.append(collider)
         self.colliders.append(collider)
         # Add the collider to the collision Node
         # Add the collider to the collision Node
         self.collisionNode.addSolid(collider)
         self.collisionNode.addSolid(collider)
         self.numColliders += 1
         self.numColliders += 1
-    
+
     def setCenter(self, i, center):
     def setCenter(self, i, center):
         c = self.colliders[i]
         c = self.colliders[i]
         c.setCenter(center)
         c.setCenter(center)
-    
+
     def setRadius(self, i, radius):
     def setRadius(self, i, radius):
         c = self.colliders[i]
         c = self.colliders[i]
         c.setRadius(radius)
         c.setRadius(radius)
-    
+
     def setCenterRadius(self, i, center, radius):
     def setCenterRadius(self, i, center, radius):
         c = self.colliders[i]
         c = self.colliders[i]
         c.setCenter(center)
         c.setCenter(center)
         c.setRadius(radius)
         c.setRadius(radius)
-    
+
     def isEntryBackfacing(self, entry):
     def isEntryBackfacing(self, entry):
         # If dot product of collision point surface normal and
         # If dot product of collision point surface normal and
-        # ray from sphere origin to collision point is positive, 
+        # ray from sphere origin to collision point is positive,
         # center is on the backside of the polygon
         # center is on the backside of the polygon
         fromNodePath = entry.getFromNodePath()
         fromNodePath = entry.getFromNodePath()
         v = Vec3(entry.getSurfacePoint(fromNodePath) -
         v = Vec3(entry.getSurfacePoint(fromNodePath) -
@@ -722,7 +722,7 @@ class SelectionSphere(SelectionQueue):
                  skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
                  skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
         self.collideWithGeom()
         self.collideWithGeom()
         return self.pick(targetNodePath, skipFlags)
         return self.pick(targetNodePath, skipFlags)
-    
+
     def pickBitMask(self, bitMask = BitMask32.allOff(),
     def pickBitMask(self, bitMask = BitMask32.allOff(),
                     targetNodePath = render,
                     targetNodePath = render,
                     skipFlags = SKIP_HIDDEN | SKIP_CAMERA):
                     skipFlags = SKIP_HIDDEN | SKIP_CAMERA):

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

@@ -65,7 +65,7 @@ class DirectSession(DirectObject):
         self.activeParent = None
         self.activeParent = None
 
 
         self.selectedNPReadout = OnscreenText.OnscreenText(
         self.selectedNPReadout = OnscreenText.OnscreenText(
-            pos = (-1.0, -0.9), bg=Vec4(1,1,1,1),
+            pos = (-1.0, -0.9), bg=Vec4(1, 1, 1, 1),
             scale = 0.05, align = TextNode.ALeft,
             scale = 0.05, align = TextNode.ALeft,
             mayChange = 1, font = self.font)
             mayChange = 1, font = self.font)
         # Make sure readout is never lit or drawn in wireframe
         # Make sure readout is never lit or drawn in wireframe
@@ -73,7 +73,7 @@ class DirectSession(DirectObject):
         self.selectedNPReadout.reparentTo(hidden)
         self.selectedNPReadout.reparentTo(hidden)
 
 
         self.activeParentReadout = OnscreenText.OnscreenText(
         self.activeParentReadout = OnscreenText.OnscreenText(
-            pos = (-1.0, -0.975), bg=Vec4(1,1,1,1),
+            pos = (-1.0, -0.975), bg=Vec4(1, 1, 1, 1),
             scale = 0.05, align = TextNode.ALeft,
             scale = 0.05, align = TextNode.ALeft,
             mayChange = 1, font = self.font)
             mayChange = 1, font = self.font)
         # Make sure readout is never lit or drawn in wireframe
         # Make sure readout is never lit or drawn in wireframe
@@ -81,7 +81,7 @@ class DirectSession(DirectObject):
         self.activeParentReadout.reparentTo(hidden)
         self.activeParentReadout.reparentTo(hidden)
 
 
         self.directMessageReadout = OnscreenText.OnscreenText(
         self.directMessageReadout = OnscreenText.OnscreenText(
-            pos = (-1.0, 0.9), bg=Vec4(1,1,1,1),
+            pos = (-1.0, 0.9), bg=Vec4(1, 1, 1, 1),
             scale = 0.05, align = TextNode.ALeft,
             scale = 0.05, align = TextNode.ALeft,
             mayChange = 1, font = self.font)
             mayChange = 1, font = self.font)
         # Make sure readout is never lit or drawn in wireframe
         # Make sure readout is never lit or drawn in wireframe
@@ -112,8 +112,8 @@ class DirectSession(DirectObject):
                 fastrak = string.split(fastrak)
                 fastrak = string.split(fastrak)
                 for i in range(len(fastrak))[1:]:
                 for i in range(len(fastrak))[1:]:
                     self.fastrak.append(DirectFastrak.DirectFastrak(fastrak[0] + ':' + fastrak[i]))
                     self.fastrak.append(DirectFastrak.DirectFastrak(fastrak[0] + ':' + fastrak[i]))
-                
-            
+
+
         self.fControl = 0
         self.fControl = 0
         self.fAlt = 0
         self.fAlt = 0
         self.fShift = 0
         self.fShift = 0
@@ -127,7 +127,7 @@ class DirectSession(DirectObject):
         # Lists for managing undo/redo operations
         # Lists for managing undo/redo operations
         self.undoList = []
         self.undoList = []
         self.redoList = []
         self.redoList = []
-        
+
         # One run through the context task to init everything
         # One run through the context task to init everything
         self.drList.updateContext()
         self.drList.updateContext()
         for dr in self.drList:
         for dr in self.drList:
@@ -160,7 +160,7 @@ class DirectSession(DirectObject):
                               'shift', 'shift-up',
                               'shift', 'shift-up',
                               'alt', 'alt-up',
                               'alt', 'alt-up',
                               ]
                               ]
-        self.keyEvents = ['escape', 'delete', 'page_up', 'page_down', 
+        self.keyEvents = ['escape', 'delete', 'page_up', 'page_down',
                           '[', '{', ']', '}',
                           '[', '{', ']', '}',
                           'shift-a', 'b', 'control-f',
                           'shift-a', 'b', 'control-f',
                           'l', 'shift-l', 'o', 'p', 'r',
                           'l', 'shift-l', 'o', 'p', 'r',
@@ -197,7 +197,7 @@ class DirectSession(DirectObject):
         else:
         else:
             self.cluster = DummyClusterClient()
             self.cluster = DummyClusterClient()
         __builtins__['cluster'] = self.cluster
         __builtins__['cluster'] = self.cluster
-            
+
     def enable(self):
     def enable(self):
         # don't enable DIRECT if someone has posted DIRECTdisablePost
         # don't enable DIRECT if someone has posted DIRECTdisablePost
         if bboard.has(DirectSession.DIRECTdisablePost):
         if bboard.has(DirectSession.DIRECTdisablePost):
@@ -303,7 +303,7 @@ class DirectSession(DirectObject):
             base.cam.reparentTo(self.oobeCamera)
             base.cam.reparentTo(self.oobeCamera)
             # Position a target point to lerp the oobe camera to
             # Position a target point to lerp the oobe camera to
             direct.cameraControl.camManipRef.setPos(
             direct.cameraControl.camManipRef.setPos(
-                self.trueCamera, Vec3(-2,-20, 5))
+                self.trueCamera, Vec3(-2, -20, 5))
             direct.cameraControl.camManipRef.lookAt(self.trueCamera)
             direct.cameraControl.camManipRef.lookAt(self.trueCamera)
             t = self.oobeCamera.lerpPosHpr(
             t = self.oobeCamera.lerpPosHpr(
                 Point3(0), Vec3(0), 2.0,
                 Point3(0), Vec3(0), 2.0,
@@ -447,8 +447,8 @@ class DirectSession(DirectObject):
         if self.clusterMode == 'client':
         if self.clusterMode == 'client':
             if input in ('v','b','l','p', 'r', 'shift-r', 's', 't',
             if input in ('v','b','l','p', 'r', 'shift-r', 's', 't',
                          'shift-a', 'w'):
                          'shift-a', 'w'):
-                self.cluster('messenger.send("%s")' % input,0)
-        
+                self.cluster('messenger.send("%s")' % input, 0)
+
     def getModifiers(self, input, base):
     def getModifiers(self, input, base):
         modifiers = DIRECT_NO_MOD
         modifiers = DIRECT_NO_MOD
         modifierString = input[: input.find(base)]
         modifierString = input[: input.find(base)]
@@ -493,7 +493,7 @@ class DirectSession(DirectObject):
             self.cameraControl.updateCoa(coa)
             self.cameraControl.updateCoa(coa)
             # Adjust widgets size
             # Adjust widgets size
             # This uses the additional scaling factor used to grow and
             # This uses the additional scaling factor used to grow and
-            # shrink the widget            
+            # shrink the widget
             self.widget.setScalingFactor(dnp.getRadius())
             self.widget.setScalingFactor(dnp.getRadius())
             # Spawn task to have object handles follow the selected object
             # Spawn task to have object handles follow the selected object
             taskMgr.remove('followSelectedNodePath')
             taskMgr.remove('followSelectedNodePath')
@@ -506,9 +506,9 @@ class DirectSession(DirectObject):
     def followSelectedNodePathTask(self, state):
     def followSelectedNodePathTask(self, state):
         mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
         mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
         decomposeMatrix(mCoa2Render,
         decomposeMatrix(mCoa2Render,
-                        self.scale,self.hpr,self.pos,
+                        self.scale, self.hpr, self.pos,
                         CSDefault)
                         CSDefault)
-        self.widget.setPosHpr(self.pos,self.hpr)
+        self.widget.setPosHpr(self.pos, self.hpr)
         return Task.cont
         return Task.cont
 
 
     def deselect(self, nodePath):
     def deselect(self, nodePath):
@@ -540,7 +540,7 @@ class DirectSession(DirectObject):
             'Active Reparent Target:' + nodePath.getName())
             'Active Reparent Target:' + nodePath.getName())
         # Alert everyone else
         # Alert everyone else
         messenger.send('DIRECT_activeParent', [self.activeParent])
         messenger.send('DIRECT_activeParent', [self.activeParent])
-        
+
     def reparent(self, nodePath = None, fWrt = 0):
     def reparent(self, nodePath = None, fWrt = 0):
         if (nodePath and self.activeParent and
         if (nodePath and self.activeParent and
             self.isNotCycle(nodePath, self.activeParent)):
             self.isNotCycle(nodePath, self.activeParent)):
@@ -561,7 +561,7 @@ class DirectSession(DirectObject):
             return self.isNotCycle(nodePath, parent.getParent())
             return self.isNotCycle(nodePath, parent.getParent())
         else:
         else:
             return 1
             return 1
-        
+
     def flash(self, nodePath = 'None Given'):
     def flash(self, nodePath = 'None Given'):
         """ Highlight an object by setting it red for a few seconds """
         """ Highlight an object by setting it red for a few seconds """
         # Clean up any existing task
         # Clean up any existing task
@@ -577,7 +577,7 @@ class DirectSession(DirectObject):
                 flashColor.setW(1)
                 flashColor.setW(1)
             else:
             else:
                 doneColor = None
                 doneColor = None
-                flashColor = VBase4(1,0,0,1)
+                flashColor = VBase4(1, 0, 0, 1)
             # Temporarily set node path color
             # Temporarily set node path color
             nodePath.setColor(flashColor)
             nodePath.setColor(flashColor)
             # Clean up color in a few seconds
             # Clean up color in a few seconds
@@ -593,8 +593,8 @@ class DirectSession(DirectObject):
     def flashDummy(self, state):
     def flashDummy(self, state):
         # Real work is done in upon death function
         # Real work is done in upon death function
         return Task.done
         return Task.done
-        
-    def flashDone(self,state):
+
+    def flashDone(self, state):
         # Return node Path to original state
         # Return node Path to original state
         if state.nodePath.isEmpty():
         if state.nodePath.isEmpty():
             # Node path doesn't exist anymore, bail
             # Node path doesn't exist anymore, bail
@@ -714,7 +714,7 @@ class DirectSession(DirectObject):
             messenger.send('DIRECT_undoListEmpty')
             messenger.send('DIRECT_undoListEmpty')
         # Return last item
         # Return last item
         return undoGroup
         return undoGroup
-        
+
     def pushRedo(self, nodePathList):
     def pushRedo(self, nodePathList):
         # Assemble group of changes
         # Assemble group of changes
         redoGroup = []
         redoGroup = []
@@ -738,7 +738,7 @@ class DirectSession(DirectObject):
             messenger.send('DIRECT_redoListEmpty')
             messenger.send('DIRECT_redoListEmpty')
         # Return last item
         # Return last item
         return redoGroup
         return redoGroup
-        
+
     def undo(self):
     def undo(self):
         if self.undoList:
         if self.undoList:
             # Get last item off of redo list
             # Get last item off of redo list
@@ -843,7 +843,7 @@ class DisplayRegionContext(DirectObject):
         self.setOrientation()
         self.setOrientation()
         self.camUpdate()
         self.camUpdate()
 
 
-    def __getitem__(self,key):
+    def __getitem__(self, key):
         return self.__dict__[key]
         return self.__dict__[key]
 
 
     def setOrientation(self):
     def setOrientation(self):
@@ -869,19 +869,19 @@ class DisplayRegionContext(DirectObject):
         else:
         else:
             return self.camLens.getVfov()
             return self.camLens.getVfov()
 
 
-    def setHfov(self,hfov):
+    def setHfov(self, hfov):
         if self.isSideways:
         if self.isSideways:
             self.camLens.setFov(self.camLens.getHfov(), hfov)
             self.camLens.setFov(self.camLens.getHfov(), hfov)
         else:
         else:
             self.camLens.setFov(hfov, self.camLens.getVfov())
             self.camLens.setFov(hfov, self.camLens.getVfov())
 
 
-    def setVfov(self,vfov):
+    def setVfov(self, vfov):
         if self.isSideways:
         if self.isSideways:
             self.camLens.setFov(vfov, self.camLens.getVfov())
             self.camLens.setFov(vfov, self.camLens.getVfov())
         else:
         else:
             self.camLens.setFov(self.camLens.getHfov(), vfov)
             self.camLens.setFov(self.camLens.getHfov(), vfov)
 
 
-    def setFov(self,hfov,vfov):
+    def setFov(self, hfov, vfov):
         if self.isSideways:
         if self.isSideways:
             self.camLens.setFov(vfov, hfov)
             self.camLens.setFov(vfov, hfov)
         else:
         else:
@@ -893,14 +893,14 @@ class DisplayRegionContext(DirectObject):
             return prop.getXSize()
             return prop.getXSize()
         else:
         else:
             return 640
             return 640
-            
+
     def getHeight(self):
     def getHeight(self):
         prop = base.win.getProperties()
         prop = base.win.getProperties()
         if prop.hasSize():
         if prop.hasSize():
             return prop.getYSize()
             return prop.getYSize()
         else:
         else:
             return 480
             return 480
-            
+
     def camUpdate(self, lens = None):
     def camUpdate(self, lens = None):
         # Window Data
         # Window Data
         self.near = self.camLens.getNear()
         self.near = self.camLens.getNear()
@@ -961,12 +961,12 @@ class DisplayRegionList(DirectObject):
                 drc = DisplayRegionContext(cam)
                 drc = DisplayRegionContext(cam)
                 self.displayRegionList.append(drc)
                 self.displayRegionList.append(drc)
 
 
-        self.accept("DIRECT-mouse1",self.mouseUpdate)
-        self.accept("DIRECT-mouse2",self.mouseUpdate)
-        self.accept("DIRECT-mouse3",self.mouseUpdate)
-        self.accept("DIRECT-mouse1Up",self.mouseUpdate)
-        self.accept("DIRECT-mouse2Up",self.mouseUpdate)
-        self.accept("DIRECT-mouse3Up",self.mouseUpdate)
+        self.accept("DIRECT-mouse1", self.mouseUpdate)
+        self.accept("DIRECT-mouse2", self.mouseUpdate)
+        self.accept("DIRECT-mouse3", self.mouseUpdate)
+        self.accept("DIRECT-mouse1Up", self.mouseUpdate)
+        self.accept("DIRECT-mouse2Up", self.mouseUpdate)
+        self.accept("DIRECT-mouse3Up", self.mouseUpdate)
 
 
     def __getitem__(self, index):
     def __getitem__(self, index):
         return self.displayRegionList[index]
         return self.displayRegionList[index]
@@ -980,11 +980,11 @@ class DisplayRegionList(DirectObject):
     def setNearFar(self, near, far):
     def setNearFar(self, near, far):
         for dr in self.displayRegionList:
         for dr in self.displayRegionList:
             dr.camLens.setNearFar(near, far)
             dr.camLens.setNearFar(near, far)
-    
+
     def setNear(self, near):
     def setNear(self, near):
         for dr in self.displayRegionList:
         for dr in self.displayRegionList:
             dr.camLens.setNear(near)
             dr.camLens.setNear(near)
-    
+
     def setFar(self, far):
     def setFar(self, far):
         for dr in self.displayRegionList:
         for dr in self.displayRegionList:
             dr.camLens.setFar(far)
             dr.camLens.setFar(far)

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

@@ -28,7 +28,7 @@ def getTkColorString(color):
     return "#" + r + g + b
     return "#" + r + g + b
 
 
 ## Background Color ##
 ## Background Color ##
-def lerpBackgroundColor(r,g,b,duration):
+def lerpBackgroundColor(r, g, b, duration):
     """
     """
     Function to lerp background color to a new value
     Function to lerp background color to a new value
     """
     """
@@ -43,14 +43,14 @@ def lerpBackgroundColor(r,g,b,duration):
             r = sf * state.ec[0] + (1 - sf) * state.sc[0]
             r = sf * state.ec[0] + (1 - sf) * state.sc[0]
             g = sf * state.ec[1] + (1 - sf) * state.sc[1]
             g = sf * state.ec[1] + (1 - sf) * state.sc[1]
             b = sf * state.ec[2] + (1 - sf) * state.sc[2]
             b = sf * state.ec[2] + (1 - sf) * state.sc[2]
-            base.setBackgroundColor(r,g,b)
+            base.setBackgroundColor(r, g, b)
             return Task.cont
             return Task.cont
     taskMgr.remove('lerpBackgroundColor')
     taskMgr.remove('lerpBackgroundColor')
     t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
     t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
     t.time = 0.0
     t.time = 0.0
     t.duration = duration
     t.duration = duration
     t.sc = base.getBackgroundColor()
     t.sc = base.getBackgroundColor()
-    t.ec = VBase4(r,g,b,1)
+    t.ec = VBase4(r, g, b, 1)
 
 
 # Set direct drawing style for an object
 # Set direct drawing style for an object
 # Never light object or draw in wireframe
 # Never light object or draw in wireframe

+ 1 - 1
direct/src/directutil/DistributedLargeBlobSender.py

@@ -8,7 +8,7 @@ class DistributedLargeBlobSender(DistributedObject.DistributedObject):
     """DistributedLargeBlobSender: for sending large chunks of data through
     """DistributedLargeBlobSender: for sending large chunks of data through
     the DC system"""
     the DC system"""
     notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLargeBlobSender')
     notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLargeBlobSender')
-    
+
     def __init__(self, cr):
     def __init__(self, cr):
         DistributedObject.DistributedObject.__init__(self, cr)
         DistributedObject.DistributedObject.__init__(self, cr)
 
 

+ 1 - 1
direct/src/directutil/DistributedLargeBlobSenderAI.py

@@ -59,7 +59,7 @@ class DistributedLargeBlobSenderAI(DistributedObjectAI.DistributedObjectAI):
 
 
     def getMode(self):
     def getMode(self):
         return self.mode
         return self.mode
-        
+
     def getTargetAvId(self):
     def getTargetAvId(self):
         return self.targetAvId
         return self.targetAvId
 
 

+ 1 - 1
direct/src/directutil/Mopath.py

@@ -42,7 +42,7 @@ class Mopath(DirectObject):
             nodePath.removeNode()
             nodePath.removeNode()
         else:
         else:
             print 'Mopath: no data in file: %s' % filename
             print 'Mopath: no data in file: %s' % filename
-        
+
 
 
     def reset(self):
     def reset(self):
         self.maxT = 0.0
         self.maxT = 0.0

+ 8 - 8
direct/src/directutil/Verify.py

@@ -24,20 +24,20 @@ verify() will also throw an AssertionError, but you can ignore that if you
 like (I don't suggest trying to catch it, it's just doing it so that it can
 like (I don't suggest trying to catch it, it's just doing it so that it can
 replace assert more fully).
 replace assert more fully).
 
 
-Please do not use assert() for things that you want run on release builds.  
-That is a bad thing to do.  One of the main reasons that assert exists 
-is to stip out debug code from a release build.  The fact that it throws 
-an exception can get it mistaken for an error handler.  If your code 
-needs to handle an error or throw an exception, you should do that 
+Please do not use assert() for things that you want run on release builds.
+That is a bad thing to do.  One of the main reasons that assert exists
+is to stip out debug code from a release build.  The fact that it throws
+an exception can get it mistaken for an error handler.  If your code
+needs to handle an error or throw an exception, you should do that
 (and not just assert() for it).
 (and not just assert() for it).
 
 
 If you want to be a super keen software engineer then avoid using verify().
 If you want to be a super keen software engineer then avoid using verify().
-If you want to be, or already are, a super keen software engineer, but 
-you don't always have the time to write proper error handling, go ahead 
+If you want to be, or already are, a super keen software engineer, but
+you don't always have the time to write proper error handling, go ahead
 and use verify() -- that's what it's for.
 and use verify() -- that's what it's for.
 
 
 Please use assert (properly) and do proper error handling; and use verify()
 Please use assert (properly) and do proper error handling; and use verify()
-only when debugging (i.e. when it won't be checked-in) or where it helps 
+only when debugging (i.e. when it won't be checked-in) or where it helps
 you resist using assert for error handling.
 you resist using assert for error handling.
 """
 """
 
 

+ 2 - 2
direct/src/directutil/WeightedChoice.py

@@ -14,11 +14,11 @@ class WeightedChoice:
         self.total = t
         self.total = t
         self.listOfLists = listOfLists
         self.listOfLists = listOfLists
         self.weightIndex = weightIndex
         self.weightIndex = weightIndex
-   
+
     def choose(self, rng=random):
     def choose(self, rng=random):
         roll = rng.randrange(self.total)
         roll = rng.randrange(self.total)
         weight = self.weightIndex
         weight = self.weightIndex
         for i in self.listOfLists:
         for i in self.listOfLists:
             roll -= i[weight]
             roll -= i[weight]
             if roll <= 0:
             if roll <= 0:
-                return i                
+                return i

+ 9 - 9
direct/src/distributed/AsyncRequest.py

@@ -153,7 +153,7 @@ class AsyncRequest(DirectObject):
                 context=self.air.allocateContext()
                 context=self.air.allocateContext()
             self.air.contextToClassName[context]=dclassName
             self.air.contextToClassName[context]=dclassName
             self.acceptOnce(
             self.acceptOnce(
-                "doFieldResponse-%s"%(context,), 
+                "doFieldResponse-%s"%(context,),
                 self._checkCompletion, [key])
                 self._checkCompletion, [key])
             self.air.queryObjectField(dclassName, fieldName, doId, context)
             self.air.queryObjectField(dclassName, fieldName, doId, context)
 
 
@@ -173,7 +173,7 @@ class AsyncRequest(DirectObject):
             if context is None:
             if context is None:
                 context=self.air.allocateContext()
                 context=self.air.allocateContext()
             self.acceptOnce(
             self.acceptOnce(
-                "doRequestResponse-%s"%(context,), 
+                "doRequestResponse-%s"%(context,),
                 self._checkCompletion, [None])
                 self._checkCompletion, [None])
             self.air.queryObjectAll(doId, context)
             self.air.queryObjectAll(doId, context)
 
 
@@ -192,7 +192,7 @@ class AsyncRequest(DirectObject):
     #        if context is None:
     #        if context is None:
     #            context=self.air.allocateContext()
     #            context=self.air.allocateContext()
     #        self.accept(
     #        self.accept(
-    #            "doRequestResponse-%s"%(context,), 
+    #            "doRequestResponse-%s"%(context,),
     #            self._checkCompletion, [None])
     #            self._checkCompletion, [None])
     #        self.air.queryObject(doId, context)
     #        self.air.queryObject(doId, context)
 
 
@@ -201,11 +201,11 @@ class AsyncRequest(DirectObject):
         """
         """
         Create a new database object.  You can get the doId from within
         Create a new database object.  You can get the doId from within
         your self.finish() function.
         your self.finish() function.
-        
+
         This functions is different from createObjectId in that it does
         This functions is different from createObjectId in that it does
         generate the object when the response comes back.  The object is
         generate the object when the response comes back.  The object is
         added to the doId2do and so forth and treated as a full regular
         added to the doId2do and so forth and treated as a full regular
-        object (which it is).  This is useful on the AI where we really 
+        object (which it is).  This is useful on the AI where we really
         do want the object on the AI.
         do want the object on the AI.
         """
         """
         assert self.notify.debugCall()
         assert self.notify.debugCall()
@@ -234,7 +234,7 @@ class AsyncRequest(DirectObject):
         """
         """
         Create a new database object.  You can get the doId from within
         Create a new database object.  You can get the doId from within
         your self.finish() function.
         your self.finish() function.
-        
+
         This functions is different from createObject in that it does not
         This functions is different from createObject in that it does not
         generate the object when the response comes back.  It only tells you
         generate the object when the response comes back.  It only tells you
         the doId.  This is useful on the UD where we don't really want the
         the doId.  This is useful on the UD where we don't really want the
@@ -252,7 +252,7 @@ class AsyncRequest(DirectObject):
             self.air.getDatabaseGenerateResponseEvent(context),
             self.air.getDatabaseGenerateResponseEvent(context),
             self._checkCompletion, [name, None])
             self._checkCompletion, [name, None])
         self.air.requestDatabaseGenerate(className, context, values=values)
         self.air.requestDatabaseGenerate(className, context, values=values)
-    
+
     def _doCreateObject(self, name, className, values, doId):
     def _doCreateObject(self, name, className, values, doId):
         assert self.notify.debugCall()
         assert self.notify.debugCall()
         assert not self.__deleted
         assert not self.__deleted
@@ -264,8 +264,8 @@ class AsyncRequest(DirectObject):
 
 
     def finish(self):
     def finish(self):
         """
         """
-        This is the function that gets called when all of the needed objects 
-        are in (i.e. all the askForObject and createObject requests have 
+        This is the function that gets called when all of the needed objects
+        are in (i.e. all the askForObject and createObject requests have
         been satisfied).
         been satisfied).
         If the other requests timeout, finish will not be called.
         If the other requests timeout, finish will not be called.
         """
         """

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

@@ -39,11 +39,11 @@ class CRCache:
         else:
         else:
             # Call disable on the distObj
             # Call disable on the distObj
             distObj.disableAndAnnounce()
             distObj.disableAndAnnounce()
-            
+
             # Put the distObj in the fifo and the dict
             # Put the distObj in the fifo and the dict
             self.fifo.append(distObj)
             self.fifo.append(distObj)
             self.dict[doId] = distObj
             self.dict[doId] = distObj
-            
+
             if len(self.fifo) > self.maxCacheItems:
             if len(self.fifo) > self.maxCacheItems:
                 # if the cache is full, pop the oldest item
                 # if the cache is full, pop the oldest item
                 oldestDistObj = self.fifo.pop(0)
                 oldestDistObj = self.fifo.pop(0)
@@ -51,7 +51,7 @@ class CRCache:
                 del(self.dict[oldestDistObj.getDoId()])
                 del(self.dict[oldestDistObj.getDoId()])
                 # and delete it
                 # and delete it
                 oldestDistObj.deleteOrDelay()
                 oldestDistObj.deleteOrDelay()
-                
+
         # Make sure that the fifo and the dictionary are sane
         # Make sure that the fifo and the dictionary are sane
         assert len(self.dict) == len(self.fifo)
         assert len(self.dict) == len(self.fifo)
 
 
@@ -72,7 +72,7 @@ class CRCache:
 
 
     def contains(self, doId):
     def contains(self, doId):
         return self.dict.has_key(doId)
         return self.dict.has_key(doId)
-    
+
     def delete(self, doId):
     def delete(self, doId):
         assert self.checkCache()
         assert self.checkCache()
         assert self.dict.has_key(doId)
         assert self.dict.has_key(doId)
@@ -83,7 +83,7 @@ class CRCache:
         self.fifo.remove(distObj)
         self.fifo.remove(distObj)
         # and delete it
         # and delete it
         distObj.deleteOrDelay()
         distObj.deleteOrDelay()
-        
+
     def checkCache(self):
     def checkCache(self):
         # For debugging; this verifies that the cache is sensible and
         # For debugging; this verifies that the cache is sensible and
         # returns true if so.
         # returns true if so.

+ 7 - 7
direct/src/distributed/CartesianGridBase.py

@@ -3,7 +3,7 @@
 
 
 class CartesianGridBase:
 class CartesianGridBase:
     def isValidZone(self, zoneId):
     def isValidZone(self, zoneId):
-        def checkBounds(self=self,zoneId=zoneId):
+        def checkBounds(self=self, zoneId=zoneId):
             if ((zoneId < self.startingZone) or
             if ((zoneId < self.startingZone) or
                 (zoneId > self.startingZone + self.gridSize * self.gridSize - 1)):
                 (zoneId > self.startingZone + self.gridSize * self.gridSize - 1)):
                 return 0
                 return 0
@@ -17,7 +17,7 @@ class CartesianGridBase:
                 return checkBounds()
                 return checkBounds()
         else:
         else:
             return 0
             return 0
-    
+
     def getZoneFromXYZ(self, pos):
     def getZoneFromXYZ(self, pos):
         # NOTE: pos should be relative to our own grid origin
         # NOTE: pos should be relative to our own grid origin
         # Convert a 3d position to a zone
         # Convert a 3d position to a zone
@@ -38,7 +38,7 @@ class CartesianGridBase:
         # on it.
         # on it.
         sphereRadius = max(sphereRadius, gridRadius*cellWidth)
         sphereRadius = max(sphereRadius, gridRadius*cellWidth)
         return 2 * (sphereRadius // cellWidth)
         return 2 * (sphereRadius // cellWidth)
-        
+
     def getZoneCellOrigin(self, zoneId):
     def getZoneCellOrigin(self, zoneId):
         # It returns the origin of the zoneCell
         # It returns the origin of the zoneCell
         # Origin is the top-left corner of zoneCell
         # Origin is the top-left corner of zoneCell
@@ -49,8 +49,8 @@ class CartesianGridBase:
         x = col * self.cellWidth - dx
         x = col * self.cellWidth - dx
         y = row * self.cellWidth - dx
         y = row * self.cellWidth - dx
 
 
-        return (x,y,0)
-    
+        return (x, y, 0)
+
     def getZoneCellOriginCenter(self, zoneId):
     def getZoneCellOriginCenter(self, zoneId):
         # Variant of the getZoneCellOrigin. It
         # Variant of the getZoneCellOrigin. It
         # returns the center of the zoneCell
         # returns the center of the zoneCell
@@ -62,5 +62,5 @@ class CartesianGridBase:
         x = col * self.cellWidth - dx + center
         x = col * self.cellWidth - dx + center
         y = row * self.cellWidth - dx + center
         y = row * self.cellWidth - dx + center
 
 
-        return (x,y,0)
-    
+        return (x, y, 0)
+

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

@@ -31,7 +31,7 @@ class ClientRepository(ClientRepositoryBase):
         # When new clients join the zone of an object, they need to hear
         # When new clients join the zone of an object, they need to hear
         # about it, so we send out all of our information about objects in
         # about it, so we send out all of our information about objects in
         # that particular zone.
         # that particular zone.
-    
+
         assert self.DOIDnext < self.DOIDlast
         assert self.DOIDnext < self.DOIDlast
         zone = di.getUint32()
         zone = di.getUint32()
         for obj in self.doId2do.values():
         for obj in self.doId2do.values():
@@ -39,7 +39,7 @@ class ClientRepository(ClientRepositoryBase):
                 id = obj.doId
                 id = obj.doId
                 if (self.isLocalId(id)):
                 if (self.isLocalId(id)):
                     self.send(obj.dclass.clientFormatGenerate(obj, id, zone, []))
                     self.send(obj.dclass.clientFormatGenerate(obj, id, zone, []))
-                    
+
     def createWithRequired(self, className, zoneId = 0, optionalFields=None):
     def createWithRequired(self, className, zoneId = 0, optionalFields=None):
         if self.DOIDnext >= self.DOIDlast:
         if self.DOIDnext >= self.DOIDlast:
             self.notify.error(
             self.notify.error(
@@ -115,9 +115,9 @@ class ClientRepository(ClientRepositoryBase):
                 datagram.addUint32(zone)
                 datagram.addUint32(zone)
 
 
         # send the message
         # send the message
-        self.send(datagram)        
-    
-    def isLocalId(self,id):
+        self.send(datagram)
+
+    def isLocalId(self, id):
         return ((id >= self.DOIDbase) and (id < self.DOIDlast))
         return ((id >= self.DOIDbase) and (id < self.DOIDlast))
 
 
     def haveCreateAuthority(self):
     def haveCreateAuthority(self):
@@ -204,4 +204,4 @@ dclass.getName()))
             distObj.generate()
             distObj.generate()
             distObj.updateRequiredFields(dclass, di)
             distObj.updateRequiredFields(dclass, di)
             # updateRequiredFields calls announceGenerate
             # updateRequiredFields calls announceGenerate
-        return distObj               
+        return distObj

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

@@ -62,7 +62,7 @@ class ClientRepositoryBase(ConnectionRepository):
         ## # Create a message
         ## # Create a message
         ## datagram = PyDatagram()
         ## datagram = PyDatagram()
         ## datagram.addServerHeader(
         ## datagram.addServerHeader(
-            ## doID, localAvatar.getDoId(), 2020)           
+            ## doID, localAvatar.getDoId(), 2020)
         ## # A context that can be used to index the response if needed
         ## # A context that can be used to index the response if needed
         ## datagram.addUint32(context)
         ## datagram.addUint32(context)
         ## self.send(datagram)
         ## self.send(datagram)
@@ -499,7 +499,7 @@ class ClientRepositoryBase(ConnectionRepository):
         return doDict
         return doDict
 
 
 
 
-    def sendSetLocation(self,doId,parentId,zoneId):
+    def sendSetLocation(self, doId, parentId, zoneId):
         datagram = PyDatagram()
         datagram = PyDatagram()
         datagram.addUint16(CLIENT_OBJECT_LOCATION)
         datagram.addUint16(CLIENT_OBJECT_LOCATION)
         datagram.addUint32(doId)
         datagram.addUint32(doId)
@@ -565,7 +565,7 @@ class ClientRepositoryBase(ConnectionRepository):
             elif worldNP.isEmpty():
             elif worldNP.isEmpty():
                 return None
                 return None
         return worldNP
         return worldNP
-            
+
     def isLocalId(self, id):
     def isLocalId(self, id):
         # By default, no ID's are local.  See also
         # By default, no ID's are local.  See also
         # ClientRepository.isLocalId().
         # ClientRepository.isLocalId().

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

@@ -81,7 +81,7 @@ class ConnectionRepository(
                         packer.beginPack(field)
                         packer.beginPack(field)
                         packer.packDefaultValue()
                         packer.packDefaultValue()
                         packer.endPack()
                         packer.endPack()
-                        
+
                         unpacker = DCPacker()
                         unpacker = DCPacker()
                         unpacker.setUnpackData(packer.getString())
                         unpacker.setUnpackData(packer.getString())
                         unpacker.beginUnpack(field)
                         unpacker.beginUnpack(field)
@@ -94,7 +94,7 @@ class ConnectionRepository(
                         else:
                         else:
                             self.notify.error("\n\n\nNot able to find %s.%s"%(
                             self.notify.error("\n\n\nNot able to find %s.%s"%(
                                 distObj.__class__.__name__, field.getName()))
                                 distObj.__class__.__name__, field.getName()))
-            
+
         # Look up the dclass
         # Look up the dclass
         dclass = self.dclassesByName.get(dcname+self.dcSuffix)
         dclass = self.dclassesByName.get(dcname+self.dcSuffix)
         if dclass is None:
         if dclass is None:
@@ -162,7 +162,7 @@ class ConnectionRepository(
                     names.append(td.getName())
                     names.append(td.getName())
             nameList = ', '.join(names)
             nameList = ', '.join(names)
             self.notify.error("Undefined types in DC file: " + nameList)
             self.notify.error("Undefined types in DC file: " + nameList)
-            
+
         self.hashVal = dcFile.getHash()
         self.hashVal = dcFile.getHash()
 
 
         # Now import all of the modules required by the DC file.
         # Now import all of the modules required by the DC file.

+ 13 - 13
direct/src/distributed/DistributedCartesianGrid.py

@@ -35,11 +35,11 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
 
 
     def generate(self):
     def generate(self):
         DistributedNode.DistributedNode.generate(self)
         DistributedNode.DistributedNode.generate(self)
-        
+
     def disable(self):
     def disable(self):
         DistributedNode.DistributedNode.disable(self)
         DistributedNode.DistributedNode.disable(self)
         self.stopProcessVisibility()
         self.stopProcessVisibility()
-        
+
     def delete(self):
     def delete(self):
         DistributedNode.DistributedNode.delete(self)
         DistributedNode.DistributedNode.delete(self)
         # TODO: when teleporting off an island...
         # TODO: when teleporting off an island...
@@ -48,7 +48,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
     def isGridParent(self):
     def isGridParent(self):
         # If this distributed object is a DistributedGrid return 1.  0 by default
         # If this distributed object is a DistributedGrid return 1.  0 by default
         return 1
         return 1
-        
+
     def setParentingRules(self, style, rule):
     def setParentingRules(self, style, rule):
         assert self.notify.debug("setParentingRules: style: %s, rule: %s" % (style, rule))
         assert self.notify.debug("setParentingRules: style: %s, rule: %s" % (style, rule))
         rules = rule.split(self.RuleSeparator)
         rules = rule.split(self.RuleSeparator)
@@ -76,7 +76,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
         self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
         self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
         taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
         taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
 
 
-    def stopProcessVisibility(self,clearAll=False):
+    def stopProcessVisibility(self, clearAll=False):
         taskMgr.remove(self.taskName("processVisibility"))
         taskMgr.remove(self.taskName("processVisibility"))
         if self.gridVisContext is not None:
         if self.gridVisContext is not None:
             self.cr.removeInterest(self.gridVisContext)
             self.cr.removeInterest(self.gridVisContext)
@@ -97,7 +97,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
         y = pos[1] + dx
         y = pos[1] + dx
         col = x // self.cellWidth
         col = x // self.cellWidth
         row = y // self.cellWidth
         row = y // self.cellWidth
-        assert self.notify.debug("processVisibility: %s: avatar pos: %s %s" % (self.doId, x,y))
+        assert self.notify.debug("processVisibility: %s: avatar pos: %s %s" % (self.doId, x, y))
         if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
         if (row < 0) or (col < 0) or (row > self.gridSize) or (col > self.gridSize):
             assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
             assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
             # If we are viewingRadius away from this entire grid,
             # If we are viewingRadius away from this entire grid,
@@ -153,9 +153,9 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
         if (av.getParent().compareTo(self) == 0):
         if (av.getParent().compareTo(self) == 0):
             # only detach if object is directly parented
             # only detach if object is directly parented
             av.detachNode()
             av.detachNode()
-        #av.b_setLocation(0,0)
+        #av.b_setLocation(0, 0)
+
 
 
-        
     def handleAvatarZoneChange(self, av, zoneId):
     def handleAvatarZoneChange(self, av, zoneId):
         assert self.notify.debug("handleAvatarZoneChange(%s, %s)" % (av.doId, zoneId))
         assert self.notify.debug("handleAvatarZoneChange(%s, %s)" % (av.doId, zoneId))
         # This method can be overridden by derived classes that
         # This method can be overridden by derived classes that
@@ -165,7 +165,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
         if not self.isValidZone(zoneId):
         if not self.isValidZone(zoneId):
             self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
             self.notify.warning("handleAvatarZoneChange: not a valid zone (%s)" % zoneId)
             return
             return
-                
+
         # Set the location on the server
         # Set the location on the server
         av.b_setLocation(self.doId, zoneId)
         av.b_setLocation(self.doId, zoneId)
 
 
@@ -185,7 +185,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
             # A Dark version of the grid color
             # A Dark version of the grid color
             color = self.gridColor * 0.5
             color = self.gridColor * 0.5
             color.setW(1)
             color.setW(1)
-            
+
             self.lines = self.attachNewNode('gridLines')
             self.lines = self.attachNewNode('gridLines')
             self.minorLines = LineNodePath(self.lines)
             self.minorLines = LineNodePath(self.lines)
             self.minorLines.lineNode.setName('minorLines')
             self.minorLines.lineNode.setName('minorLines')
@@ -199,19 +199,19 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
 
 
             self.centerLines = LineNodePath(self.lines)
             self.centerLines = LineNodePath(self.lines)
             self.centerLines.lineNode.setName('centerLines')
             self.centerLines.lineNode.setName('centerLines')
-            self.centerLines.setColor(VBase4(1,0,0,0))
+            self.centerLines.setColor(VBase4(1, 0, 0, 0))
             self.centerLines.setThickness(3)
             self.centerLines.setThickness(3)
 
 
             # Load up grid parts to initialize grid object
             # Load up grid parts to initialize grid object
             # Polygon used to mark grid plane
             # Polygon used to mark grid plane
             # self.gridBack = loader.loadModel('models/misc/gridBack')
             # self.gridBack = loader.loadModel('models/misc/gridBack')
             # self.gridBack.reparentTo(self)
             # self.gridBack.reparentTo(self)
-            # self.gridBack.setColor(0.2,0.2,0.2,0.5)
+            # self.gridBack.setColor(0.2, 0.2, 0.2, 0.5)
 
 
             self.cellLabelParent = None
             self.cellLabelParent = None
             self.markerParent = None
             self.markerParent = None
             self.haveGridLines = 1
             self.haveGridLines = 1
-            
+
         def updateGrid(self):
         def updateGrid(self):
             # Update grid lines based upon current grid spacing and grid size
             # Update grid lines based upon current grid spacing and grid size
             # First reset existing grid lines
             # First reset existing grid lines
@@ -275,7 +275,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
                                                 (j * cw - dx) + (cw * 0.5), # y
                                                 (j * cw - dx) + (cw * 0.5), # y
                                                 3.0, # z
                                                 3.0, # z
                                                 # Lay them down flat
                                                 # Lay them down flat
-                                                0,-90,0, # hpr
+                                                0, -90, 0, # hpr
                                                 scale, scale, scale)
                                                 scale, scale, scale)
             self.cellLabelParent.flattenLight()
             self.cellLabelParent.flattenLight()
 
 

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

@@ -42,7 +42,7 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
     def addObjectToGrid(self, av, useZoneId=-1):
     def addObjectToGrid(self, av, useZoneId=-1):
         self.notify.debug("setting parent to grid %s" % self)
         self.notify.debug("setting parent to grid %s" % self)
         avId = av.doId
         avId = av.doId
-        
+
         # Create a grid parent
         # Create a grid parent
         #gridParent = self.attachNewNode("gridParent-%s" % avId)
         #gridParent = self.attachNewNode("gridParent-%s" % avId)
         #self.gridParents[avId] = gridParent
         #self.gridParents[avId] = gridParent
@@ -120,7 +120,7 @@ class DistributedCartesianGridAI(DistributedNodeAI, CartesianGridBase):
                 "%s handleAvatarZoneChange %s: not a valid zone (%s) for pos %s" %
                 "%s handleAvatarZoneChange %s: not a valid zone (%s) for pos %s" %
                 (self.doId, av.doId, zoneId, pos))
                 (self.doId, av.doId, zoneId, pos))
             return
             return
-        
+
         # Set the location on the server.
         # Set the location on the server.
         # setLocation will update the gridParent
         # setLocation will update the gridParent
         av.b_setLocation(self.doId, zoneId)
         av.b_setLocation(self.doId, zoneId)

+ 7 - 7
direct/src/distributed/DistributedNode.py

@@ -20,7 +20,7 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
 
 
             # initialize gridParent
             # initialize gridParent
             self.gridParent = None
             self.gridParent = None
-            
+
     def disable(self):
     def disable(self):
         if self.activeState != DistributedObject.ESDisabled:
         if self.activeState != DistributedObject.ESDisabled:
             self.reparentTo(hidden)
             self.reparentTo(hidden)
@@ -56,12 +56,12 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
             else:
             else:
                 if self.gridParent:
                 if self.gridParent:
                     self.gridParent.delete()
                     self.gridParent.delete()
-                    self.gridParent = None                    
+                    self.gridParent = None
         else:
         else:
             if self.gridParent:
             if self.gridParent:
                 self.gridParent.delete()
                 self.gridParent.delete()
                 self.gridParent = None
                 self.gridParent = None
-            
+
     def __cmp__(self, other):
     def __cmp__(self, other):
         # DistributedNode inherits from NodePath, which inherits a
         # DistributedNode inherits from NodePath, which inherits a
         # definition of __cmp__ from FFIExternalObject that uses the
         # definition of __cmp__ from FFIExternalObject that uses the
@@ -127,19 +127,19 @@ class DistributedNode(DistributedObject.DistributedObject, NodePath):
     # setY provided by NodePath
     # setY provided by NodePath
     def d_setY(self, y):
     def d_setY(self, y):
         self.sendUpdate("setY", [y])
         self.sendUpdate("setY", [y])
-    
+
     # setZ provided by NodePath
     # setZ provided by NodePath
     def d_setZ(self, z):
     def d_setZ(self, z):
         self.sendUpdate("setZ", [z])
         self.sendUpdate("setZ", [z])
-    
+
     # setH provided by NodePath
     # setH provided by NodePath
     def d_setH(self, h):
     def d_setH(self, h):
         self.sendUpdate("setH", [h])
         self.sendUpdate("setH", [h])
-    
+
     # setP provided by NodePath
     # setP provided by NodePath
     def d_setP(self, p):
     def d_setP(self, p):
         self.sendUpdate("setP", [p])
         self.sendUpdate("setP", [p])
-    
+
     # setR provided by NodePath
     # setR provided by NodePath
     def d_setR(self, r):
     def d_setR(self, r):
         self.sendUpdate("setR", [r])
         self.sendUpdate("setR", [r])

+ 8 - 8
direct/src/distributed/DistributedNodeAI.py

@@ -78,19 +78,19 @@ class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
     # setY provided by NodePath
     # setY provided by NodePath
     def d_setY(self, y):
     def d_setY(self, y):
         self.sendUpdate("setY", [y])
         self.sendUpdate("setY", [y])
-    
+
     # setZ provided by NodePath
     # setZ provided by NodePath
     def d_setZ(self, z):
     def d_setZ(self, z):
         self.sendUpdate("setZ", [z])
         self.sendUpdate("setZ", [z])
-    
+
     # setH provided by NodePath
     # setH provided by NodePath
     def d_setH(self, h):
     def d_setH(self, h):
         self.sendUpdate("setH", [h])
         self.sendUpdate("setH", [h])
-    
+
     # setP provided by NodePath
     # setP provided by NodePath
     def d_setP(self, p):
     def d_setP(self, p):
         self.sendUpdate("setP", [p])
         self.sendUpdate("setP", [p])
-    
+
     # setR provided by NodePath
     # setR provided by NodePath
     def d_setR(self, r):
     def d_setR(self, r):
         self.sendUpdate("setR", [r])
         self.sendUpdate("setR", [r])
@@ -117,16 +117,16 @@ class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
         self.sendUpdate("setXYH", [x, y, h])
         self.sendUpdate("setXYH", [x, y, h])
 
 
     def b_setXYZH(self, x, y, z, h):
     def b_setXYZH(self, x, y, z, h):
-        self.setXYZH(x,y,z,h)
-        self.d_setXYZH(x,y,z,h)
+        self.setXYZH(x, y, z, h)
+        self.d_setXYZH(x, y, z, h)
     def setXYZH(self, x, y, z, h):
     def setXYZH(self, x, y, z, h):
         self.setPos(x, y, z)
         self.setPos(x, y, z)
         self.setH(h)
         self.setH(h)
     def getXYZH(self):
     def getXYZH(self):
         pos = self.getPos()
         pos = self.getPos()
         h = self.getH()
         h = self.getH()
-        return pos[0],pos[1],pos[2],h
-    
+        return pos[0], pos[1], pos[2], h
+
     def d_setXYZH(self, x, y, z, h):
     def d_setXYZH(self, x, y, z, h):
         self.sendUpdate("setXYZH", [x, y, z, h])
         self.sendUpdate("setXYZH", [x, y, z, h])
 
 

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

@@ -45,19 +45,19 @@ class DistributedNodeUD(DistributedObjectUD):
     # setY provided by NodePath
     # setY provided by NodePath
     def d_setY(self, y):
     def d_setY(self, y):
         self.sendUpdate("setY", [y])
         self.sendUpdate("setY", [y])
-    
+
     # setZ provided by NodePath
     # setZ provided by NodePath
     def d_setZ(self, z):
     def d_setZ(self, z):
         self.sendUpdate("setZ", [z])
         self.sendUpdate("setZ", [z])
-    
+
     # setH provided by NodePath
     # setH provided by NodePath
     def d_setH(self, h):
     def d_setH(self, h):
         self.sendUpdate("setH", [h])
         self.sendUpdate("setH", [h])
-    
+
     # setP provided by NodePath
     # setP provided by NodePath
     def d_setP(self, p):
     def d_setP(self, p):
         self.sendUpdate("setP", [p])
         self.sendUpdate("setP", [p])
-    
+
     # setR provided by NodePath
     # setR provided by NodePath
     def d_setR(self, r):
     def d_setR(self, r):
         self.sendUpdate("setR", [r])
         self.sendUpdate("setR", [r])

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

@@ -70,7 +70,7 @@ class DistributedObject(DistributedObjectBase):
     if __debug__:
     if __debug__:
         def status(self, indent=0):
         def status(self, indent=0):
             """
             """
-            print out "doId(parentId,zoneId) className
+            print out "doId(parentId, zoneId) className
                 and conditionally show generated, disabled, neverDisable,
                 and conditionally show generated, disabled, neverDisable,
                 or cachable"
                 or cachable"
             """
             """
@@ -79,7 +79,7 @@ class DistributedObject(DistributedObjectBase):
                 print "%s%s:"%(
                 print "%s%s:"%(
                     ' '*indent, self.__class__.__name__)
                     ' '*indent, self.__class__.__name__)
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
-                    spaces, 
+                    spaces,
                     self.doId, self.parentId, self.zoneId),
                     self.doId, self.parentId, self.zoneId),
                 flags=[]
                 flags=[]
                 if self.activeState == ESGenerated:
                 if self.activeState == ESGenerated:

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

@@ -47,11 +47,11 @@ class DistributedObjectAI(DistributedObjectBase):
     #    For debugging purposes, this just prints out what got deleted
     #    For debugging purposes, this just prints out what got deleted
     #    """
     #    """
     #    print ("Destructing: " + self.__class__.__name__)
     #    print ("Destructing: " + self.__class__.__name__)
-    
+
     if __debug__:
     if __debug__:
         def status(self, indent=0):
         def status(self, indent=0):
             """
             """
-            print out doId(parentId,zoneId) className
+            print out doId(parentId, zoneId) className
                 and conditionally show generated, disabled, neverDisable,
                 and conditionally show generated, disabled, neverDisable,
                 or cachable
                 or cachable
             """
             """
@@ -60,7 +60,7 @@ class DistributedObjectAI(DistributedObjectBase):
                 print "%s%s:"%(
                 print "%s%s:"%(
                     ' '*indent, self.__class__.__name__)
                     ' '*indent, self.__class__.__name__)
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
-                    spaces, 
+                    spaces,
                     self.doId, self.parentId, self.zoneId),
                     self.doId, self.parentId, self.zoneId),
                 flags=[]
                 flags=[]
                 if self.__generated:
                 if self.__generated:
@@ -369,7 +369,7 @@ class DistributedObjectAI(DistributedObjectBase):
         else:
         else:
             self.doId = doId
             self.doId = doId
         # Put the new DO in the dictionaries
         # Put the new DO in the dictionaries
-        self.air.addDOToTables(self, location=(parentId,zoneId))
+        self.air.addDOToTables(self, location=(parentId, zoneId))
         # Send a generate message
         # Send a generate message
         self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
         self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
 
 

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

@@ -20,14 +20,14 @@ class DistributedObjectBase(DirectObject):
     if __debug__:
     if __debug__:
         def status(self, indent=0):
         def status(self, indent=0):
             """
             """
-            print out "doId(parentId,zoneId) className"
+            print out "doId(parentId, zoneId) className"
             """
             """
             spaces=' '*(indent+2)
             spaces=' '*(indent+2)
             try:
             try:
                 print "%s%s:"%(
                 print "%s%s:"%(
                     ' '*indent, self.__class__.__name__)
                     ' '*indent, self.__class__.__name__)
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
-                    spaces, 
+                    spaces,
                     self.doId, self.parentId, self.zoneId),
                     self.doId, self.parentId, self.zoneId),
             except Exception, e: print "%serror printing status"%(spaces,), e
             except Exception, e: print "%serror printing status"%(spaces,), e
 
 

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

@@ -5,7 +5,7 @@ from direct.distributed.DistributedObject import DistributedObject
 
 
 class DistributedObjectGlobal(DistributedObject):
 class DistributedObjectGlobal(DistributedObject):
     """
     """
-    The Distributed Object Global class is the base class for global 
+    The Distributed Object Global class is the base class for global
     network based (i.e. distributed) objects.
     network based (i.e. distributed) objects.
     """
     """
     notify = directNotify.newCategory("DistributedObjectGlobal")
     notify = directNotify.newCategory("DistributedObjectGlobal")

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

@@ -16,11 +16,11 @@ class DistributedObjectGlobalAI(DistributedObjectAI):
 
 
     def __init__(self, air):
     def __init__(self, air):
         DistributedObjectAI.__init__(self, air)
         DistributedObjectAI.__init__(self, air)
-    
+
     def announceGenerate(self):
     def announceGenerate(self):
         self.air.registerForChannel(self.doId)
         self.air.registerForChannel(self.doId)
         DistributedObjectAI.announceGenerate(self)
         DistributedObjectAI.announceGenerate(self)
-    
+
     def delete(self):
     def delete(self):
         self.air.unregisterForChannel(self.doId)
         self.air.unregisterForChannel(self.doId)
         ## self.air.removeDOFromTables(self)
         ## self.air.removeDOFromTables(self)

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

@@ -17,7 +17,7 @@ ESGenerated    = 6
 
 
 class DistributedObjectOV(DistributedObjectBase):
 class DistributedObjectOV(DistributedObjectBase):
     """
     """
-    Implementation of the 'owner view' (OV) of a distributed object; 
+    Implementation of the 'owner view' (OV) of a distributed object;
     """
     """
     notify = directNotify.newCategory("DistributedObjectOV")
     notify = directNotify.newCategory("DistributedObjectOV")
 
 
@@ -44,7 +44,7 @@ class DistributedObjectOV(DistributedObjectBase):
     if __debug__:
     if __debug__:
         def status(self, indent=0):
         def status(self, indent=0):
             """
             """
-            print out "doId(parentId,zoneId) className"
+            print out "doId(parentId, zoneId) className"
                 and conditionally show generated, disabled
                 and conditionally show generated, disabled
             """
             """
             spaces=' '*(indent+2)
             spaces=' '*(indent+2)
@@ -52,7 +52,7 @@ class DistributedObjectOV(DistributedObjectBase):
                 print "%s%s:"%(
                 print "%s%s:"%(
                     ' '*indent, self.__class__.__name__)
                     ' '*indent, self.__class__.__name__)
                 print "%sfrom DistributedObjectOV doId:%s, parent:%s, zone:%s"%(
                 print "%sfrom DistributedObjectOV doId:%s, parent:%s, zone:%s"%(
-                    spaces, 
+                    spaces,
                     self.doId, self.parentId, self.zoneId),
                     self.doId, self.parentId, self.zoneId),
                 flags=[]
                 flags=[]
                 if self.activeState == ESGenerated:
                 if self.activeState == ESGenerated:

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

@@ -47,11 +47,11 @@ class DistributedObjectUD(DistributedObjectBase):
     #    For debugging purposes, this just prints out what got deleted
     #    For debugging purposes, this just prints out what got deleted
     #    """
     #    """
     #    print ("Destructing: " + self.__class__.__name__)
     #    print ("Destructing: " + self.__class__.__name__)
-    
+
     if __debug__:
     if __debug__:
         def status(self, indent=0):
         def status(self, indent=0):
             """
             """
-            print out doId(parentId,zoneId) className
+            print out doId(parentId, zoneId) className
                 and conditionally show generated, disabled, neverDisable,
                 and conditionally show generated, disabled, neverDisable,
                 or cachable"
                 or cachable"
             """
             """
@@ -60,7 +60,7 @@ class DistributedObjectUD(DistributedObjectBase):
                 print "%s%s:"%(
                 print "%s%s:"%(
                     ' '*indent, self.__class__.__name__)
                     ' '*indent, self.__class__.__name__)
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
                 print "%sfrom DistributedObject doId:%s, parent:%s, zone:%s"%(
-                    spaces, 
+                    spaces,
                     self.doId, self.parentId, self.zoneId),
                     self.doId, self.parentId, self.zoneId),
                 flags=[]
                 flags=[]
                 if self.__generated:
                 if self.__generated:
@@ -315,7 +315,7 @@ class DistributedObjectUD(DistributedObjectBase):
         else:
         else:
             self.doId = doId
             self.doId = doId
         # Put the new DO in the dictionaries
         # Put the new DO in the dictionaries
-        self.air.addDOToTables(self, location=(parentId,zoneId))
+        self.air.addDOToTables(self, location=(parentId, zoneId))
         # Send a generate message
         # Send a generate message
         self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
         self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)
 
 

+ 14 - 14
direct/src/distributed/DistributedSmoothNodeAI.py

@@ -4,7 +4,7 @@ import DistributedSmoothNodeBase
 
 
 class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
 class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
                               DistributedSmoothNodeBase.DistributedSmoothNodeBase):
                               DistributedSmoothNodeBase.DistributedSmoothNodeBase):
-    
+
     def __init__(self, air, name=None):
     def __init__(self, air, name=None):
         DistributedNodeAI.DistributedNodeAI.__init__(self, air, name)
         DistributedNodeAI.DistributedNodeAI.__init__(self, air, name)
         DistributedSmoothNodeBase.DistributedSmoothNodeBase.__init__(self)
         DistributedSmoothNodeBase.DistributedSmoothNodeBase.__init__(self)
@@ -27,36 +27,36 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
 
 
     def setSmZ(self, z, t):
     def setSmZ(self, z, t):
         self.setZ(z)
         self.setZ(z)
-        
+
     def setSmXY(self, x, y, t):
     def setSmXY(self, x, y, t):
         self.setX(x)
         self.setX(x)
         self.setY(y)
         self.setY(y)
-        
+
     def setSmXZ(self, x, z, t):
     def setSmXZ(self, x, z, t):
         self.setX(x)
         self.setX(x)
         self.setZ(z)
         self.setZ(z)
-        
+
     def setSmPos(self, x, y, z, t):
     def setSmPos(self, x, y, z, t):
-        self.setPos(x,y,z)
-        
+        self.setPos(x, y, z)
+
     def setSmHpr(self, h, p, r, t):
     def setSmHpr(self, h, p, r, t):
-        self.setHpr(h,p,r)
-        
+        self.setHpr(h, p, r)
+
     def setSmXYH(self, x, y, h, t):
     def setSmXYH(self, x, y, h, t):
         self.setX(x)
         self.setX(x)
         self.setY(y)
         self.setY(y)
         self.setH(h)
         self.setH(h)
-        
+
     def setSmXYZH(self, x, y, z, h, t):
     def setSmXYZH(self, x, y, z, h, t):
-        self.setPos(x,y,z)
+        self.setPos(x, y, z)
         self.setH(h)
         self.setH(h)
-        
+
     def setSmPosHpr(self, x, y, z, h, p, r, t):
     def setSmPosHpr(self, x, y, z, h, p, r, t):
-        self.setPosHpr(x,y,z,h,p,r)
-        
+        self.setPosHpr(x, y, z, h, p, r)
+
     def clearSmoothing(self, bogus = None):
     def clearSmoothing(self, bogus = None):
         pass
         pass
-    
+
 
 
     # Do we use these on the AIx?
     # Do we use these on the AIx?
     def setComponentX(self, x):
     def setComponentX(self, x):

+ 17 - 17
direct/src/distributed/DoCollectionManager.py

@@ -13,7 +13,7 @@ class DoCollectionManager:
             # for 'owner' views of objects
             # for 'owner' views of objects
             self.doId2ownerView = {}
             self.doId2ownerView = {}
         # Dict of {
         # Dict of {
-        #   parent DistributedObject id: 
+        #   parent DistributedObject id:
         #     { zoneIds: [child DistributedObject ids] }}
         #     { zoneIds: [child DistributedObject ids] }}
         self.__doHierarchy = {}
         self.__doHierarchy = {}
 
 
@@ -26,7 +26,7 @@ class DoCollectionManager:
             callback(do)
             callback(do)
         else:
         else:
             relatedObjectMgr(doId, allCallback=callback)
             relatedObjectMgr(doId, allCallback=callback)
-    
+
     def getOwnerView(self, doId):
     def getOwnerView(self, doId):
         assert self.hasOwnerView()
         assert self.hasOwnerView()
         return self.doId2ownerView.get(doId)
         return self.doId2ownerView.get(doId)
@@ -85,12 +85,12 @@ class DoCollectionManager:
         """
         """
         parentId is any distributed object id.
         parentId is any distributed object id.
         zoneId is a uint32, defaults to None (all zones).  Try zone 2 if
         zoneId is a uint32, defaults to None (all zones).  Try zone 2 if
-            you're not sure which zone to use (0 is a bad/null zone and 
+            you're not sure which zone to use (0 is a bad/null zone and
             1 has had reserved use in the past as a no messages zone, while
             1 has had reserved use in the past as a no messages zone, while
             2 has traditionally been a global, uber, misc stuff zone).
             2 has traditionally been a global, uber, misc stuff zone).
-        dclassType is a distributed class type filter, defaults 
+        dclassType is a distributed class type filter, defaults
             to None (no filter).
             to None (no filter).
-        
+
         If dclassName is None then all objects in the zone are returned;
         If dclassName is None then all objects in the zone are returned;
         otherwise the list is filtered to only include objects of that type.
         otherwise the list is filtered to only include objects of that type.
         """
         """
@@ -101,12 +101,12 @@ class DoCollectionManager:
         """
         """
         parentId is any distributed object id.
         parentId is any distributed object id.
         zoneId is a uint32, defaults to None (all zones).  Try zone 2 if
         zoneId is a uint32, defaults to None (all zones).  Try zone 2 if
-            you're not sure which zone to use (0 is a bad/null zone and 
+            you're not sure which zone to use (0 is a bad/null zone and
             1 has had reserved use in the past as a no messages zone, while
             1 has had reserved use in the past as a no messages zone, while
             2 has traditionally been a global, uber, misc stuff zone).
             2 has traditionally been a global, uber, misc stuff zone).
-        dclassType is a distributed class type filter, defaults 
+        dclassType is a distributed class type filter, defaults
             to None (no filter).
             to None (no filter).
-        
+
         If dclassName is None then all objects in the zone are returned;
         If dclassName is None then all objects in the zone are returned;
         otherwise the list is filtered to only include objects of that type.
         otherwise the list is filtered to only include objects of that type.
         """
         """
@@ -128,7 +128,7 @@ class DoCollectionManager:
                     a.append(doId)
                     a.append(doId)
             r = a
             r = a
         return r
         return r
-    
+
     def getOwnerViewDoList(self, classType):
     def getOwnerViewDoList(self, classType):
         assert self.hasOwnerView()
         assert self.hasOwnerView()
         l = []
         l = []
@@ -236,11 +236,11 @@ class DoCollectionManager:
             parentZoneDict = self.__doHierarchy.setdefault(parentId, {})
             parentZoneDict = self.__doHierarchy.setdefault(parentId, {})
             zoneDoSet = parentZoneDict.setdefault(zoneId, set())
             zoneDoSet = parentZoneDict.setdefault(zoneId, set())
             zoneDoSet.add(doId)
             zoneDoSet.add(doId)
-            
+
             # Set the new parent and zone on the object
             # Set the new parent and zone on the object
             obj.parentId = parentId
             obj.parentId = parentId
             obj.zoneId = zoneId
             obj.zoneId = zoneId
-    
+
             if 1:
             if 1:
                 # Do we still need this
                 # Do we still need this
                 if oldParentId != parentId:
                 if oldParentId != parentId:
@@ -257,7 +257,7 @@ class DoCollectionManager:
             return
             return
         if 1:
         if 1:
             # Do we still need this
             # Do we still need this
-            
+
             # notify any existing parent that we're moving away
             # notify any existing parent that we're moving away
             oldParentObj = self.doId2do.get(parentId)
             oldParentObj = self.doId2do.get(parentId)
             obj = self.doId2do.get(doId)
             obj = self.doId2do.get(doId)
@@ -281,7 +281,7 @@ class DoCollectionManager:
         else:
         else:
             self.notify.warning(
             self.notify.warning(
                 "deleteObjectLocation: parentId: %s not found"%(parentId,))
                 "deleteObjectLocation: parentId: %s not found"%(parentId,))
-    
+
     def addDOToTables(self, do, location=None, ownerView=False):
     def addDOToTables(self, do, location=None, ownerView=False):
         assert self.notify.debugStateCall(self)
         assert self.notify.debugStateCall(self)
         #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
         #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
@@ -306,7 +306,7 @@ class DoCollectionManager:
         if not ownerView:
         if not ownerView:
             if self.isValidLocationTuple(location):
             if self.isValidLocationTuple(location):
                 self.storeObjectLocation(do.doId, location[0], location[1])
                 self.storeObjectLocation(do.doId, location[0], location[1])
-                ##assert do.doId not in self.zoneId2doIds.get(location,{})
+                ##assert do.doId not in self.zoneId2doIds.get(location, {})
                 ##self.zoneId2doIds.setdefault(location, {})
                 ##self.zoneId2doIds.setdefault(location, {})
                 ##self.zoneId2doIds[location][do.doId]=do
                 ##self.zoneId2doIds[location][do.doId]=do
 
 
@@ -346,7 +346,7 @@ class DoCollectionManager:
         ##             del self.zoneId2doIds[location]
         ##             del self.zoneId2doIds[location]
         if do.doId in self.doId2do:
         if do.doId in self.doId2do:
             del self.doId2do[do.doId]
             del self.doId2do[do.doId]
-        
+
     ## def changeDOZoneInTables(self, do, newParentId, newZoneId, oldParentId, oldZoneId):
     ## def changeDOZoneInTables(self, do, newParentId, newZoneId, oldParentId, oldZoneId):
     ##     if 1:
     ##     if 1:
     ##         self.storeObjectLocation(do.doId, newParentId, newZoneId)
     ##         self.storeObjectLocation(do.doId, newParentId, newZoneId)
@@ -354,13 +354,13 @@ class DoCollectionManager:
     ##         #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
     ##         #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
     ##         oldLocation = (oldParentId, oldZoneId)
     ##         oldLocation = (oldParentId, oldZoneId)
     ##         newLocation = (newParentId, newZoneId)
     ##         newLocation = (newParentId, newZoneId)
-    ##         # HACK: DistributedGuildMemberUD starts in -1,-1, which isnt ever put in the
+    ##         # HACK: DistributedGuildMemberUD starts in -1, -1, which isnt ever put in the
     ##         # zoneId2doIds table
     ##         # zoneId2doIds table
     ##         if self.isValidLocationTuple(oldLocation):
     ##         if self.isValidLocationTuple(oldLocation):
     ##             assert self.notify.debugStateCall(self)
     ##             assert self.notify.debugStateCall(self)
     ##             assert oldLocation in self.zoneId2doIds
     ##             assert oldLocation in self.zoneId2doIds
     ##             assert do.doId in self.zoneId2doIds[oldLocation]
     ##             assert do.doId in self.zoneId2doIds[oldLocation]
-    ##             assert do.doId not in self.zoneId2doIds.get(newLocation,{})
+    ##             assert do.doId not in self.zoneId2doIds.get(newLocation, {})
     ##             # remove from old zone
     ##             # remove from old zone
     ##             del(self.zoneId2doIds[oldLocation][do.doId])
     ##             del(self.zoneId2doIds[oldLocation][do.doId])
     ##             if len(self.zoneId2doIds[oldLocation]) == 0:
     ##             if len(self.zoneId2doIds[oldLocation]) == 0:

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

@@ -223,7 +223,7 @@ class DoInterestManager(DirectObject.DirectObject):
         datagram.addUint16(CLIENT_REMOVE_INTEREST)
         datagram.addUint16(CLIENT_REMOVE_INTEREST)
         datagram.addUint16(handle)
         datagram.addUint16(handle)
         if scopeId != 0:
         if scopeId != 0:
-            datagram.addUint32(scopeId)            
+            datagram.addUint32(scopeId)
         self.send(datagram)
         self.send(datagram)
 
 
     def handleInterestDoneMessage(self, di):
     def handleInterestDoneMessage(self, di):

+ 7 - 7
direct/src/distributed/GridParent.py

@@ -12,7 +12,7 @@ from pandac.PandaModules import *
 # it lies in.
 # it lies in.
 
 
 class GridParent:
 class GridParent:
-    
+
     def __init__(self, av):
     def __init__(self, av):
         # The object on the grid will need to broadcast his position relative to
         # The object on the grid will need to broadcast his position relative to
         # his current grid cell in order to use 16 bit
         # his current grid cell in order to use 16 bit
@@ -36,7 +36,7 @@ class GridParent:
             self.av = None
             self.av = None
         # Remove the gridNodes
         # Remove the gridNodes
         self.cellOrigin.removeNode()
         self.cellOrigin.removeNode()
-                
+
     def setGridParent(self, grid, zoneId, teleport=0):
     def setGridParent(self, grid, zoneId, teleport=0):
         # If teleport=0, preserve the avatar's absolute position.  If teleport=1
         # If teleport=0, preserve the avatar's absolute position.  If teleport=1
         # the avatars previous world position is invalid, so don't wrtReparent,
         # the avatars previous world position is invalid, so don't wrtReparent,
@@ -57,8 +57,8 @@ class GridParent:
             self.grid = grid
             self.grid = grid
             # Reparent the gridNodes under this grid
             # Reparent the gridNodes under this grid
             self.cellOrigin.reparentTo(grid)
             self.cellOrigin.reparentTo(grid)
-            self.cellOrigin.setPosHpr(0,0,0,0,0,0)
-        
+            self.cellOrigin.setPosHpr(0, 0, 0, 0, 0, 0)
+
         # Get grid cell origin
         # Get grid cell origin
         cellPos = self.grid.getZoneCellOrigin(zoneId)
         cellPos = self.grid.getZoneCellOrigin(zoneId)
 
 
@@ -72,8 +72,8 @@ class GridParent:
             self.av.wrtReparentTo(self.cellOrigin)
             self.av.wrtReparentTo(self.cellOrigin)
         else:
         else:
             self.av.reparentTo(self.cellOrigin)
             self.av.reparentTo(self.cellOrigin)
-            
+
         #print "gridParent: reparent to %s" % self.av
         #print "gridParent: reparent to %s" % self.av
-        #print "gridParent: pos = %s,%s" % (self.av.getPos(), self.av.getParent().getPos())
+        #print "gridParent: pos = %s, %s" % (self.av.getPos(), self.av.getParent().getPos())
+
 
 
-        

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

@@ -14,7 +14,7 @@ class SampleObject(DistributedObject):
 #        self.blue = 0
 #        self.blue = 0
 
 
     def setColor(self, red = 0, green = 0, blue = 0):
     def setColor(self, red = 0, green = 0, blue = 0):
-        self.red = red                 
+        self.red = red
         self.green = green
         self.green = green
         self.blue = blue
         self.blue = blue
         self.announceGenerate()
         self.announceGenerate()

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

@@ -21,7 +21,7 @@ class ServerRepository:
         self.qcm = QueuedConnectionManager()
         self.qcm = QueuedConnectionManager()
         self.qcl = QueuedConnectionListener(self.qcm, 0)
         self.qcl = QueuedConnectionListener(self.qcm, 0)
         self.qcr = QueuedConnectionReader(self.qcm, 0)
         self.qcr = QueuedConnectionReader(self.qcm, 0)
-        self.cw = ConnectionWriter(self.qcm,0)
+        self.cw = ConnectionWriter(self.qcm, 0)
         self.tcpRendezvous = self.qcm.openTCPServerRendezvous(tcpPort, 10)
         self.tcpRendezvous = self.qcm.openTCPServerRendezvous(tcpPort, 10)
         print self.tcpRendezvous
         print self.tcpRendezvous
         self.qcl.addConnection(self.tcpRendezvous)
         self.qcl.addConnection(self.tcpRendezvous)
@@ -326,7 +326,7 @@ class ServerRepository:
         datagram.addUint16(CLIENT_SET_DOID_RANGE)
         datagram.addUint16(CLIENT_SET_DOID_RANGE)
         datagram.addUint32(id)
         datagram.addUint32(id)
         datagram.addUint32(self.DOIDrange)
         datagram.addUint32(self.DOIDrange)
-        print "Sending DOID range: ",id,self.DOIDrange
+        print "Sending DOID range: ", id, self.DOIDrange
         self.cw.send(datagram, connection)
         self.cw.send(datagram, connection)
 
 
     # a client disconnected from us, we need to update our data, also tell other clients to remove
     # a client disconnected from us, we need to update our data, also tell other clients to remove
@@ -370,7 +370,7 @@ class ServerRepository:
             datagram.addUint16(CLIENT_REQUEST_GENERATES)
             datagram.addUint16(CLIENT_REQUEST_GENERATES)
             datagram.addUint32(ZoneID)
             datagram.addUint32(ZoneID)
             self.sendToAll(datagram)
             self.sendToAll(datagram)
-            print "SENDING REQUEST GENERATES (",ZoneID,") TO ALL"
+            print "SENDING REQUEST GENERATES (", ZoneID, ") TO ALL"
 
 
     # client has moved zones, need to update them
     # client has moved zones, need to update them
     def handleRemoveZone(self, dgi, connection):
     def handleRemoveZone(self, dgi, connection):

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

@@ -48,7 +48,7 @@
             tl = Toplevel()
             tl = Toplevel()
             tl.title('Interval Controls')
             tl.title('Interval Controls')
         outerFrame = Frame(tl)
         outerFrame = Frame(tl)
-        def entryScaleCommand(t,s=self):
+        def entryScaleCommand(t, s=self):
             s.setT(t)
             s.setT(t)
             s.pause()
             s.pause()
         self.es = es = EntryScale.EntryScale(
         self.es = es = EntryScale.EntryScale(
@@ -70,7 +70,7 @@
         # Stop/play buttons
         # Stop/play buttons
         def doPlay(s=self, es=es):
         def doPlay(s=self, es=es):
             s.resume(es.get())
             s.resume(es.get())
-                       
+
         stop = Button(bf, text = 'Stop',
         stop = Button(bf, text = 'Stop',
                       command = lambda s=self: s.pause())
                       command = lambda s=self: s.pause())
         play = Button(
         play = Button(
@@ -84,7 +84,7 @@
         bf.pack(expand = 1, fill = X)
         bf.pack(expand = 1, fill = X)
         outerFrame.pack(expand = 1, fill = X)
         outerFrame.pack(expand = 1, fill = X)
         # Add function to update slider during setT calls
         # Add function to update slider during setT calls
-        def update(t,es=es):
+        def update(t, es=es):
             es.set(t, fCommand = 0)
             es.set(t, fCommand = 0)
         if not hasattr(self, "setTHooks"):
         if not hasattr(self, "setTHooks"):
             self.setTHooks = []
             self.setTHooks = []