formatting

This commit is contained in:
Dave Schuyler 2005-12-21 04:18:47 +00:00
parent 9c2634a40b
commit 699be47bab
15 changed files with 38 additions and 38 deletions

View File

@ -227,9 +227,9 @@ class DisplayConnection:
def sendCamOffset(self,xyz,hpr): def sendCamOffset(self,xyz,hpr):
ClusterClient.notify.debug("send cam offset...") ClusterClient.notify.debug("send cam offset...")
ClusterClient.notify.debug( ("packet %d xyz,hpr=%f %f %f %f %f %f" % ClusterClient.notify.debug(("packet %d xyz,hpr=%f %f %f %f %f %f" %
(self.msgHandler.packetNumber,xyz[0],xyz[1],xyz[2], (self.msgHandler.packetNumber,xyz[0],xyz[1],xyz[2],
hpr[0],hpr[1],hpr[2])) ) hpr[0],hpr[1],hpr[2])))
datagram = self.msgHandler.makeCamOffsetDatagram(xyz, hpr) datagram = self.msgHandler.makeCamOffsetDatagram(xyz, hpr)
self.cw.send(datagram, self.tcpConn) self.cw.send(datagram, self.tcpConn)
@ -247,9 +247,9 @@ class DisplayConnection:
def sendMoveCam(self,xyz,hpr): def sendMoveCam(self,xyz,hpr):
ClusterClient.notify.debug("send cam move...") ClusterClient.notify.debug("send cam move...")
ClusterClient.notify.debug( ("packet %d xyz,hpr=%f %f %f %f %f %f" % ClusterClient.notify.debug(("packet %d xyz,hpr=%f %f %f %f %f %f" %
(self.msgHandler.packetNumber,xyz[0],xyz[1],xyz[2], (self.msgHandler.packetNumber,xyz[0],xyz[1],xyz[2],
hpr[0],hpr[1],hpr[2])) ) hpr[0],hpr[1],hpr[2])))
datagram = self.msgHandler.makeCamMovementDatagram(xyz, hpr) datagram = self.msgHandler.makeCamMovementDatagram(xyz, hpr)
self.cw.send(datagram, self.tcpConn) self.cw.send(datagram, self.tcpConn)

View File

@ -87,6 +87,6 @@ class Logger:
else: else:
minutes = 0 minutes = 0
seconds = int(math.ceil(dt)) seconds = int(math.ceil(dt))
return("%02d:%02d:%02d:%02d: " % (days, hours, minutes, seconds) ) return("%02d:%02d:%02d:%02d: " % (days, hours, minutes, seconds))

View File

@ -217,7 +217,7 @@ class AsyncRequest(DirectObject):
self.accept( self.accept(
self.air.getDatabaseGenerateResponseEvent(context), self.air.getDatabaseGenerateResponseEvent(context),
self._doCreateObject, [name, className, values]) self._doCreateObject, [name, className, values])
## newDBRequestGen = config.GetBool( #HACK: ## newDBRequestGen = config.GetBool(#HACK:
## 'new-database-request-generate', 1) ## 'new-database-request-generate', 1)
## if newDBRequestGen: ## if newDBRequestGen:
## self.accept( ## self.accept(

View File

@ -237,7 +237,7 @@ def generateNativeWrappers():
pandaModules = open(pandaModulesFilename, 'w') pandaModules = open(pandaModulesFilename, 'w')
# Copy in any helper classes from the extensions_native directory # Copy in any helper classes from the extensions_native directory
extensionHelperFiles = [ 'extension_native_helpers.py' ] extensionHelperFiles = ['extension_native_helpers.py']
for name in extensionHelperFiles: for name in extensionHelperFiles:
inFilename = os.path.join(extensionsDir, name) inFilename = os.path.join(extensionsDir, name)
outFilename = os.path.join(outputCodeDir, name) outFilename = os.path.join(outputCodeDir, name)

View File

@ -47,9 +47,9 @@ class ClassicFSM(DirectObject):
final state as: final state as:
fsm = ClassicFSM.ClassicFSM('stopLight', fsm = ClassicFSM.ClassicFSM('stopLight',
[ State.State('red', enterRed, exitRed, ['green']), [State.State('red', enterRed, exitRed, ['green']),
State.State('yellow', enterYellow, exitYellow, ['red']), State.State('yellow', enterYellow, exitYellow, ['red']),
State.State('green', enterGreen, exitGreen, ['yellow']) ], State.State('green', enterGreen, exitGreen, ['yellow'])],
'red', 'red',
'red') 'red')

View File

@ -48,13 +48,13 @@ class FourState:
names is a list of state names names is a list of state names
E.g. E.g.
['off', 'opening', 'open', 'closing', 'closed', ] ['off', 'opening', 'open', 'closing', 'closed',]
e.g. 2: e.g. 2:
['off', 'locking', 'locked', 'unlocking', 'unlocked', ] ['off', 'locking', 'locked', 'unlocking', 'unlocked',]
e.g. 3: e.g. 3:
['off', 'deactivating', 'deactive', 'activating', 'activated', ] ['off', 'deactivating', 'deactive', 'activating', 'activated',]
durations is a list of time values (floats) or None values. durations is a list of time values (floats) or None values.

View File

@ -47,13 +47,13 @@ class FourStateAI:
""" """
names is a list of state names names is a list of state names
E.g. E.g.
['off', 'opening', 'open', 'closing', 'closed', ] ['off', 'opening', 'open', 'closing', 'closed',]
e.g. 2: e.g. 2:
['off', 'locking', 'locked', 'unlocking', 'unlocked', ] ['off', 'locking', 'locked', 'unlocking', 'unlocked',]
e.g. 3: e.g. 3:
['off', 'deactivating', 'deactive', 'activating', 'activated', ] ['off', 'deactivating', 'deactive', 'activating', 'activated',]
durations is a list of durations in seconds or None values. durations is a list of durations in seconds or None values.
The list of duration values should be the same length The list of duration values should be the same length

View File

@ -66,7 +66,7 @@ class MetaInterval(CMetaInterval):
if kw: if kw:
self.notify.error("Unexpected keyword parameters: %s" % (kw.keys())) self.notify.error("Unexpected keyword parameters: %s" % (kw.keys()))
# We must allow the old style: Track([ ival0, ival1, ... ]) as # We must allow the old style: Track([ival0, ival1, ...]) as
# well as the new style: Track(ival0, ival1, ...) # well as the new style: Track(ival0, ival1, ...)
# Note: this breaks in the case of a Track with one tuple: # Note: this breaks in the case of a Track with one tuple:
@ -259,8 +259,8 @@ class MetaInterval(CMetaInterval):
def addTrack(self, list, name, relTime, relTo, duration): def addTrack(self, list, name, relTime, relTo, duration):
# Adds a "track list". This is a list of tuples of the form: # Adds a "track list". This is a list of tuples of the form:
# #
# ( <delay>, <Interval>, # (<delay>, <Interval>,
# PREVIOUS_END | PREVIOUS_START | TRACK_START ) # PREVIOUS_END | PREVIOUS_START | TRACK_START)
# #
# where <delay> is a relative time, in seconds, for the # where <delay> is a relative time, in seconds, for the
# <Interval> to start, relative to either the end of the # <Interval> to start, relative to either the end of the

View File

@ -29,7 +29,7 @@ fUseCVS = base.config.GetBool("level-editor-use-cvs", 1)
# Colors used by all color menus # Colors used by all color menus
DEFAULT_COLORS = [ DEFAULT_COLORS = [
Vec4(1,1,1,1), Vec4(1,1,1,1),
Vec4(0.75, 0.75, 0.75, 1.0 ), Vec4(0.75, 0.75, 0.75, 1.0),
Vec4(0.5, 0.5, 0.5, 1.0), Vec4(0.5, 0.5, 0.5, 1.0),
Vec4(0.25, 0.25, 0.25, 1.0) Vec4(0.25, 0.25, 0.25, 1.0)
] ]
@ -47,7 +47,7 @@ BUILDING_TYPES = ['10_10', '20', '10_20', '20_10', '10_10_10',
] ]
BUILDING_HEIGHTS = [10, 14, 20, 24, 25, 30] BUILDING_HEIGHTS = [10, 14, 20, 24, 25, 30]
NUM_WALLS = [1,2,3] NUM_WALLS = [1,2,3]
LANDMARK_SPECIAL_TYPES = ['', 'hq', 'gagshop', 'clotheshop', 'petshop', 'kartshop' ] LANDMARK_SPECIAL_TYPES = ['', 'hq', 'gagshop', 'clotheshop', 'petshop', 'kartshop']
OBJECT_SNAP_POINTS = { OBJECT_SNAP_POINTS = {
'street_5x20': [(Vec3(5.0,0,0), Vec3(0)), 'street_5x20': [(Vec3(5.0,0,0), Vec3(0)),
@ -1532,7 +1532,7 @@ class LevelEditor(NodePath, DirectObject):
newDNALandmarkBuilding.setPos(VBase3(0)) newDNALandmarkBuilding.setPos(VBase3(0))
newDNALandmarkBuilding.setHpr(VBase3(0)) newDNALandmarkBuilding.setHpr(VBase3(0))
# Headquarters do not have doors # Headquarters do not have doors
if specialType not in [ 'hq', 'kartshop' ]: if specialType not in ['hq', 'kartshop']:
newDNADoor = self.createDoor('landmark_door') newDNADoor = self.createDoor('landmark_door')
newDNALandmarkBuilding.add(newDNADoor) newDNALandmarkBuilding.add(newDNADoor)
# Now place new landmark building in the world # Now place new landmark building in the world
@ -2372,7 +2372,7 @@ class LevelEditor(NodePath, DirectObject):
# Also move the camera # Also move the camera
taskMgr.remove('autoMoveDelay') taskMgr.remove('autoMoveDelay')
handlesToCam = direct.widget.getPos(direct.camera) handlesToCam = direct.widget.getPos(direct.camera)
handlesToCam = handlesToCam * ( direct.dr.near/handlesToCam[1]) handlesToCam = handlesToCam * (direct.dr.near/handlesToCam[1])
if ((abs(handlesToCam[0]) > (direct.dr.nearWidth * 0.4)) or if ((abs(handlesToCam[0]) > (direct.dr.nearWidth * 0.4)) or
(abs(handlesToCam[2]) > (direct.dr.nearHeight * 0.4))): (abs(handlesToCam[2]) > (direct.dr.nearHeight * 0.4))):
taskMgr.remove('manipulateCamera') taskMgr.remove('manipulateCamera')

View File

@ -76,6 +76,6 @@ def Dependencies(script):
#if ispkg: #if ispkg:
# rslt.append(k+'.__init__', v.__file__) # rslt.append(k+'.__init__', v.__file__)
#else: #else:
rslt.append( (k, v.__file__) ) rslt.append((k, v.__file__))
return rslt return rslt

View File

@ -32,7 +32,7 @@ class Loader:
Attempt to load a model from given file path, return Attempt to load a model from given file path, return
a nodepath to the model if successful or None otherwise. a nodepath to the model if successful or None otherwise.
""" """
assert(Loader.notify.debug("Loading model: %s" % (modelPath) )) assert(Loader.notify.debug("Loading model: %s" % (modelPath)))
if phaseChecker: if phaseChecker:
phaseChecker(modelPath) phaseChecker(modelPath)
node = self.loader.loadSync(Filename(modelPath)) node = self.loader.loadSync(Filename(modelPath))
@ -196,12 +196,12 @@ class Loader:
TexturePool class. Returns None if not found TexturePool class. Returns None if not found
""" """
if alphaPath is None: if alphaPath is None:
assert(Loader.notify.debug("Loading texture: %s" % (texturePath) )) assert(Loader.notify.debug("Loading texture: %s" % (texturePath)))
if phaseChecker: if phaseChecker:
phaseChecker(texturePath) phaseChecker(texturePath)
texture = TexturePool.loadTexture(texturePath) texture = TexturePool.loadTexture(texturePath)
else: else:
assert(Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath) )) assert(Loader.notify.debug("Loading texture: %s %s" % (texturePath, alphaPath)))
if phaseChecker: if phaseChecker:
phaseChecker(texturePath) phaseChecker(texturePath)
texture = TexturePool.loadTexture(texturePath, alphaPath) texture = TexturePool.loadTexture(texturePath, alphaPath)
@ -216,7 +216,7 @@ class Loader:
Returns a 3-D Texture object, suitable for rendering Returns a 3-D Texture object, suitable for rendering
volumetric textures, if successful, or None if not. volumetric textures, if successful, or None if not.
""" """
assert(Loader.notify.debug("Loading 3-D texture: %s" % (texturePattern) )) assert(Loader.notify.debug("Loading 3-D texture: %s" % (texturePattern)))
if phaseChecker: if phaseChecker:
phaseChecker(texturePattern) phaseChecker(texturePattern)
texture = TexturePool.load3dTexture(texturePattern) texture = TexturePool.load3dTexture(texturePattern)
@ -232,7 +232,7 @@ class Loader:
None if not. None if not.
""" """
assert(Loader.notify.debug("Loading cube map: %s" % (texturePattern) )) assert(Loader.notify.debug("Loading cube map: %s" % (texturePattern)))
if phaseChecker: if phaseChecker:
phaseChecker(texturePattern) phaseChecker(texturePattern)
texture = TexturePool.loadCubeMap(texturePattern) texture = TexturePool.loadCubeMap(texturePattern)
@ -251,12 +251,12 @@ class Loader:
The texture parameter may be the return value of any previous The texture parameter may be the return value of any previous
call to loadTexture(), load3DTexture(), or loadCubeMap(). call to loadTexture(), load3DTexture(), or loadCubeMap().
""" """
assert(Loader.notify.debug("Unloading texture: %s" % (texture) )) assert(Loader.notify.debug("Unloading texture: %s" % (texture)))
TexturePool.releaseTexture(texture) TexturePool.releaseTexture(texture)
# sound loading funcs # sound loading funcs
def loadSfx(self, name): def loadSfx(self, name):
assert(Loader.notify.debug("Loading sound: %s" % (name) )) assert(Loader.notify.debug("Loading sound: %s" % (name)))
if phaseChecker: if phaseChecker:
phaseChecker(name) phaseChecker(name)
# should return a valid sound obj even if soundMgr is invalid # should return a valid sound obj even if soundMgr is invalid
@ -269,7 +269,7 @@ class Loader:
return sound return sound
def loadMusic(self, name): def loadMusic(self, name):
assert(Loader.notify.debug("Loading sound: %s" % (name) )) assert(Loader.notify.debug("Loading sound: %s" % (name)))
# should return a valid sound obj even if musicMgr is invalid # should return a valid sound obj even if musicMgr is invalid
sound = None sound = None
if (name): if (name):

View File

@ -114,8 +114,8 @@ def traceFunctionCall(frame):
if co.co_flags & 8: n = n+1 if co.co_flags & 8: n = n+1
r='' r=''
if dict.has_key('self'): if dict.has_key('self'):
r = '%s.'%(dict['self'].__class__.__name__, ) r = '%s.'%(dict['self'].__class__.__name__,)
r+="%s("%(f.f_code.co_name, ) r+="%s("%(f.f_code.co_name,)
comma=0 # formatting, whether we should type a comma. comma=0 # formatting, whether we should type a comma.
for i in range(n): for i in range(n):
name = co.co_varnames[i] name = co.co_varnames[i]

View File

@ -292,12 +292,12 @@ class ActorControl(Pmw.MegaWidget):
activebackground = '#909090', activebackground = '#909090',
text = self['text']) text = self['text'])
# Top level menu # Top level menu
labelMenu = Menu(self._label, tearoff = 0 ) labelMenu = Menu(self._label, tearoff = 0)
# Menu to select display mode # Menu to select display mode
self.unitsVar = IntVar() self.unitsVar = IntVar()
self.unitsVar.set(FRAMES) self.unitsVar.set(FRAMES)
displayMenu = Menu(labelMenu, tearoff = 0 ) displayMenu = Menu(labelMenu, tearoff = 0)
displayMenu.add_radiobutton(label = 'Frame count', displayMenu.add_radiobutton(label = 'Frame count',
value = FRAMES, value = FRAMES,
variable = self.unitsVar, variable = self.unitsVar,

View File

@ -464,9 +464,9 @@ def exitState():
print 'exitState' print 'exitState'
fsm = ClassicFSM.ClassicFSM('stopLight', fsm = ClassicFSM.ClassicFSM('stopLight',
[ State.State('red', enterState, exitState, ['green']), [State.State('red', enterState, exitState, ['green']),
State.State('yellow', enterState, exitState, ['red']), State.State('yellow', enterState, exitState, ['red']),
State.State('green', enterState, exitState, ['yellow']) ], State.State('green', enterState, exitState, ['yellow'])],
'red', 'red',
'red') 'red')

View File

@ -347,7 +347,7 @@ class InspectorWindow:
def pop(self): def pop(self):
if len(self.inspectors) > 1: if len(self.inspectors) > 1:
self.inspectors = self.inspectors[ : -1] self.inspectors = self.inspectors[:-1]
self.update() self.update()
def dive(self): def dive(self):