formatting

This commit is contained in:
Dave Schuyler 2006-03-17 22:43:25 +00:00
parent 0574017d72
commit fc7fc09140
33 changed files with 212 additions and 212 deletions

View File

@ -136,7 +136,7 @@ class SelectedNodePaths(DirectObject):
"""
return self.selectedDict.values()[:]
def __getitem__(self,index):
def __getitem__(self, index):
return self.getSelectedAsList()[index]
def getSelectedDict(self, id):
@ -266,7 +266,7 @@ class DirectBoundingBox:
# Get bounds
self.min = Point3(0)
self.max = Point3(0)
self.nodePath.calcTightBounds(self.min,self.max)
self.nodePath.calcTightBounds(self.min, self.max)
# Calc center and radius
self.center = Point3((self.min + self.max)/2.0)
self.radius = Vec3(self.max - self.min).length()
@ -332,11 +332,11 @@ class DirectBoundingBox:
return lines
def setBoxColorScale(self,r,g,b,a):
def setBoxColorScale(self, r, g, b, a):
if (self.lines):
self.lines.reset()
self.lines = None
self.lines = self.createBBoxLines((r,g,b,a))
self.lines = self.createBBoxLines((r, g, b, a))
self.show()
def updateBBoxLines(self):
@ -528,7 +528,7 @@ class SelectionQueue(CollisionHandlerQueue):
self.setCurrentIndex(-1)
self.setCurrentEntry(None)
# 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)
nodePath = entry.getIntoNodePath()
if (skipFlags & SKIP_HIDDEN) and nodePath.isHidden():
@ -606,7 +606,7 @@ class SelectionRay(SelectionQueue):
self.sortEntries()
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):
self.collideWithGeom()
self.pick3D(targetNodePath, origin, dir)
@ -615,7 +615,7 @@ class SelectionRay(SelectionQueue):
def pickBitMask3D(self, bitMask = BitMask32.allOff(),
targetNodePath = render,
origin = Point3(0), dir = Vec3(0,0,-1),
origin = Point3(0), dir = Vec3(0, 0, -1),
skipFlags = SKIP_ALL):
self.collideWithBitMask(bitMask)
self.pick3D(targetNodePath, origin, dir)

View File

@ -65,7 +65,7 @@ class DirectSession(DirectObject):
self.activeParent = None
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,
mayChange = 1, font = self.font)
# Make sure readout is never lit or drawn in wireframe
@ -73,7 +73,7 @@ class DirectSession(DirectObject):
self.selectedNPReadout.reparentTo(hidden)
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,
mayChange = 1, font = self.font)
# Make sure readout is never lit or drawn in wireframe
@ -81,7 +81,7 @@ class DirectSession(DirectObject):
self.activeParentReadout.reparentTo(hidden)
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,
mayChange = 1, font = self.font)
# Make sure readout is never lit or drawn in wireframe
@ -303,7 +303,7 @@ class DirectSession(DirectObject):
base.cam.reparentTo(self.oobeCamera)
# Position a target point to lerp the oobe camera to
direct.cameraControl.camManipRef.setPos(
self.trueCamera, Vec3(-2,-20, 5))
self.trueCamera, Vec3(-2, -20, 5))
direct.cameraControl.camManipRef.lookAt(self.trueCamera)
t = self.oobeCamera.lerpPosHpr(
Point3(0), Vec3(0), 2.0,
@ -447,7 +447,7 @@ class DirectSession(DirectObject):
if self.clusterMode == 'client':
if input in ('v','b','l','p', 'r', 'shift-r', 's', 't',
'shift-a', 'w'):
self.cluster('messenger.send("%s")' % input,0)
self.cluster('messenger.send("%s")' % input, 0)
def getModifiers(self, input, base):
modifiers = DIRECT_NO_MOD
@ -506,9 +506,9 @@ class DirectSession(DirectObject):
def followSelectedNodePathTask(self, state):
mCoa2Render = state.dnp.mCoa2Dnp * state.dnp.getMat(render)
decomposeMatrix(mCoa2Render,
self.scale,self.hpr,self.pos,
self.scale, self.hpr, self.pos,
CSDefault)
self.widget.setPosHpr(self.pos,self.hpr)
self.widget.setPosHpr(self.pos, self.hpr)
return Task.cont
def deselect(self, nodePath):
@ -577,7 +577,7 @@ class DirectSession(DirectObject):
flashColor.setW(1)
else:
doneColor = None
flashColor = VBase4(1,0,0,1)
flashColor = VBase4(1, 0, 0, 1)
# Temporarily set node path color
nodePath.setColor(flashColor)
# Clean up color in a few seconds
@ -594,7 +594,7 @@ class DirectSession(DirectObject):
# Real work is done in upon death function
return Task.done
def flashDone(self,state):
def flashDone(self, state):
# Return node Path to original state
if state.nodePath.isEmpty():
# Node path doesn't exist anymore, bail
@ -843,7 +843,7 @@ class DisplayRegionContext(DirectObject):
self.setOrientation()
self.camUpdate()
def __getitem__(self,key):
def __getitem__(self, key):
return self.__dict__[key]
def setOrientation(self):
@ -869,19 +869,19 @@ class DisplayRegionContext(DirectObject):
else:
return self.camLens.getVfov()
def setHfov(self,hfov):
def setHfov(self, hfov):
if self.isSideways:
self.camLens.setFov(self.camLens.getHfov(), hfov)
else:
self.camLens.setFov(hfov, self.camLens.getVfov())
def setVfov(self,vfov):
def setVfov(self, vfov):
if self.isSideways:
self.camLens.setFov(vfov, self.camLens.getVfov())
else:
self.camLens.setFov(self.camLens.getHfov(), vfov)
def setFov(self,hfov,vfov):
def setFov(self, hfov, vfov):
if self.isSideways:
self.camLens.setFov(vfov, hfov)
else:
@ -961,12 +961,12 @@ class DisplayRegionList(DirectObject):
drc = DisplayRegionContext(cam)
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):
return self.displayRegionList[index]

View File

@ -28,7 +28,7 @@ def getTkColorString(color):
return "#" + r + g + b
## Background Color ##
def lerpBackgroundColor(r,g,b,duration):
def lerpBackgroundColor(r, g, b, duration):
"""
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]
g = sf * state.ec[1] + (1 - sf) * state.sc[1]
b = sf * state.ec[2] + (1 - sf) * state.sc[2]
base.setBackgroundColor(r,g,b)
base.setBackgroundColor(r, g, b)
return Task.cont
taskMgr.remove('lerpBackgroundColor')
t = taskMgr.add(lerpColor, 'lerpBackgroundColor')
t.time = 0.0
t.duration = duration
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
# Never light object or draw in wireframe

View File

@ -3,7 +3,7 @@
class CartesianGridBase:
def isValidZone(self, zoneId):
def checkBounds(self=self,zoneId=zoneId):
def checkBounds(self=self, zoneId=zoneId):
if ((zoneId < self.startingZone) or
(zoneId > self.startingZone + self.gridSize * self.gridSize - 1)):
return 0
@ -49,7 +49,7 @@ class CartesianGridBase:
x = col * self.cellWidth - dx
y = row * self.cellWidth - dx
return (x,y,0)
return (x, y, 0)
def getZoneCellOriginCenter(self, zoneId):
# Variant of the getZoneCellOrigin. It
@ -62,5 +62,5 @@ class CartesianGridBase:
x = col * self.cellWidth - dx + center
y = row * self.cellWidth - dx + center
return (x,y,0)
return (x, y, 0)

View File

@ -117,7 +117,7 @@ class ClientRepository(ClientRepositoryBase):
# send the message
self.send(datagram)
def isLocalId(self,id):
def isLocalId(self, id):
return ((id >= self.DOIDbase) and (id < self.DOIDlast))
def haveCreateAuthority(self):

View File

@ -499,7 +499,7 @@ class ClientRepositoryBase(ConnectionRepository):
return doDict
def sendSetLocation(self,doId,parentId,zoneId):
def sendSetLocation(self, doId, parentId, zoneId):
datagram = PyDatagram()
datagram.addUint16(CLIENT_OBJECT_LOCATION)
datagram.addUint32(doId)

View File

@ -76,7 +76,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
self.gridVisContext = self.cr.addInterest(self.getDoId(), 0, self.uniqueName("visibility"))
taskMgr.add(self.processVisibility, self.taskName("processVisibility"))
def stopProcessVisibility(self,clearAll=False):
def stopProcessVisibility(self, clearAll=False):
taskMgr.remove(self.taskName("processVisibility"))
if self.gridVisContext is not None:
self.cr.removeInterest(self.gridVisContext)
@ -97,7 +97,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
y = pos[1] + dx
col = x // 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):
assert self.notify.debug("processVisibility: %s: not on the grid" % (self.doId))
# If we are viewingRadius away from this entire grid,
@ -153,7 +153,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
if (av.getParent().compareTo(self) == 0):
# only detach if object is directly parented
av.detachNode()
#av.b_setLocation(0,0)
#av.b_setLocation(0, 0)
def handleAvatarZoneChange(self, av, zoneId):
@ -199,14 +199,14 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
self.centerLines = LineNodePath(self.lines)
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)
# Load up grid parts to initialize grid object
# Polygon used to mark grid plane
# self.gridBack = loader.loadModel('models/misc/gridBack')
# 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.markerParent = None
@ -275,7 +275,7 @@ class DistributedCartesianGrid(DistributedNode.DistributedNode,
(j * cw - dx) + (cw * 0.5), # y
3.0, # z
# Lay them down flat
0,-90,0, # hpr
0, -90, 0, # hpr
scale, scale, scale)
self.cellLabelParent.flattenLight()

View File

@ -117,15 +117,15 @@ class DistributedNodeAI(DistributedObjectAI.DistributedObjectAI, NodePath):
self.sendUpdate("setXYH", [x, y, 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):
self.setPos(x, y, z)
self.setH(h)
def getXYZH(self):
pos = self.getPos()
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):
self.sendUpdate("setXYZH", [x, y, z, h])

View File

@ -70,7 +70,7 @@ class DistributedObject(DistributedObjectBase):
if __debug__:
def status(self, indent=0):
"""
print out "doId(parentId,zoneId) className
print out "doId(parentId, zoneId) className
and conditionally show generated, disabled, neverDisable,
or cachable"
"""

View File

@ -51,7 +51,7 @@ class DistributedObjectAI(DistributedObjectBase):
if __debug__:
def status(self, indent=0):
"""
print out doId(parentId,zoneId) className
print out doId(parentId, zoneId) className
and conditionally show generated, disabled, neverDisable,
or cachable
"""
@ -369,7 +369,7 @@ class DistributedObjectAI(DistributedObjectBase):
else:
self.doId = doId
# 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
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)

View File

@ -20,7 +20,7 @@ class DistributedObjectBase(DirectObject):
if __debug__:
def status(self, indent=0):
"""
print out "doId(parentId,zoneId) className"
print out "doId(parentId, zoneId) className"
"""
spaces=' '*(indent+2)
try:

View File

@ -44,7 +44,7 @@ class DistributedObjectOV(DistributedObjectBase):
if __debug__:
def status(self, indent=0):
"""
print out "doId(parentId,zoneId) className"
print out "doId(parentId, zoneId) className"
and conditionally show generated, disabled
"""
spaces=' '*(indent+2)

View File

@ -51,7 +51,7 @@ class DistributedObjectUD(DistributedObjectBase):
if __debug__:
def status(self, indent=0):
"""
print out doId(parentId,zoneId) className
print out doId(parentId, zoneId) className
and conditionally show generated, disabled, neverDisable,
or cachable"
"""
@ -315,7 +315,7 @@ class DistributedObjectUD(DistributedObjectBase):
else:
self.doId = doId
# 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
self.sendGenerateWithRequired(self.air, parentId, zoneId, optionalFields)

View File

@ -37,10 +37,10 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
self.setZ(z)
def setSmPos(self, x, y, z, t):
self.setPos(x,y,z)
self.setPos(x, y, z)
def setSmHpr(self, h, p, r, t):
self.setHpr(h,p,r)
self.setHpr(h, p, r)
def setSmXYH(self, x, y, h, t):
self.setX(x)
@ -48,11 +48,11 @@ class DistributedSmoothNodeAI(DistributedNodeAI.DistributedNodeAI,
self.setH(h)
def setSmXYZH(self, x, y, z, h, t):
self.setPos(x,y,z)
self.setPos(x, y, z)
self.setH(h)
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):
pass

View File

@ -306,7 +306,7 @@ class DoCollectionManager:
if not ownerView:
if self.isValidLocationTuple(location):
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[location][do.doId]=do
@ -354,13 +354,13 @@ class DoCollectionManager:
## #assert not hasattr(do, "isQueryAllResponse") or not do.isQueryAllResponse
## oldLocation = (oldParentId, oldZoneId)
## 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
## if self.isValidLocationTuple(oldLocation):
## assert self.notify.debugStateCall(self)
## assert oldLocation in self.zoneId2doIds
## 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
## del(self.zoneId2doIds[oldLocation][do.doId])
## if len(self.zoneId2doIds[oldLocation]) == 0:

View File

@ -57,7 +57,7 @@ class GridParent:
self.grid = grid
# Reparent the gridNodes under this 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
cellPos = self.grid.getZoneCellOrigin(zoneId)
@ -74,6 +74,6 @@ class GridParent:
self.av.reparentTo(self.cellOrigin)
#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())

View File

@ -21,7 +21,7 @@ class ServerRepository:
self.qcm = QueuedConnectionManager()
self.qcl = QueuedConnectionListener(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)
print self.tcpRendezvous
self.qcl.addConnection(self.tcpRendezvous)
@ -326,7 +326,7 @@ class ServerRepository:
datagram.addUint16(CLIENT_SET_DOID_RANGE)
datagram.addUint32(id)
datagram.addUint32(self.DOIDrange)
print "Sending DOID range: ",id,self.DOIDrange
print "Sending DOID range: ", id, self.DOIDrange
self.cw.send(datagram, connection)
# 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.addUint32(ZoneID)
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
def handleRemoveZone(self, dgi, connection):

View File

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