formatting

This commit is contained in:
Dave Schuyler 2005-11-04 22:16:25 +00:00
parent 9275909425
commit c176b0e336
13 changed files with 14 additions and 48 deletions

View File

@ -7,8 +7,9 @@ import math
class Logger: class Logger:
def __init__(self, fileName="log"): def __init__(self, fileName="log"):
"""__init__(self) """
Logger constructor""" Logger constructor
"""
self.__timeStamp = 1 self.__timeStamp = 1
self.__startTime = 0.0 self.__startTime = 0.0
self.__logFile = None self.__logFile = None

View File

@ -82,8 +82,6 @@ class Mopath(PandaObject):
return tIn return tIn
def getFinalState(self): def getFinalState(self):
""" getFinalState()
"""
pos = Point3(0) pos = Point3(0)
if (self.xyzNurbsCurve != None): if (self.xyzNurbsCurve != None):
self.xyzNurbsCurve.getPoint(self.maxT, pos) self.xyzNurbsCurve.getPoint(self.maxT, pos)

View File

@ -143,12 +143,10 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
def forceToTruePosition(self): def forceToTruePosition(self):
"""forceToTruePosition(self) """
This forces the node to reposition itself to its latest known This forces the node to reposition itself to its latest known
position. This may result in a pop as the node skips the last position. This may result in a pop as the node skips the last
of its lerp points. of its lerp points.
""" """
if (not self.isLocal()) and \ if (not self.isLocal()) and \
self.smoother.getLatestPosition(): self.smoother.getLatestPosition():
@ -156,13 +154,11 @@ class DistributedSmoothNode(DistributedNode.DistributedNode,
self.smoother.clearPositions(1) self.smoother.clearPositions(1)
def reloadPosition(self): def reloadPosition(self):
"""reloadPosition(self) """
This function re-reads the position from the node itself and This function re-reads the position from the node itself and
clears any old position reports for the node. This should be clears any old position reports for the node. This should be
used whenever show code bangs on the node position and expects used whenever show code bangs on the node position and expects
it to stick. it to stick.
""" """
self.smoother.clearPositions(0) self.smoother.clearPositions(0)
self.smoother.setMat(self.getMat()) self.smoother.setMat(self.getMat())

View File

@ -11,8 +11,7 @@ class OnscreenGeom(PandaObject, NodePath):
color = None, color = None,
parent = None, parent = None,
sort = 0): sort = 0):
"""__init__(self, ...) """
Make a geom node from string or a node path, Make a geom node from string or a node path,
put it into the 2d sg and set it up with all the indicated parameters. put it into the 2d sg and set it up with all the indicated parameters.

View File

@ -11,8 +11,7 @@ class OnscreenImage(PandaObject, NodePath):
color = None, color = None,
parent = None, parent = None,
sort = 0): sort = 0):
"""__init__(self, ...) """
Make a image node from string or a node path, Make a image node from string or a node path,
put it into the 2d sg and set it up with all the indicated parameters. put it into the 2d sg and set it up with all the indicated parameters.

View File

@ -40,8 +40,6 @@ class ActorInterval(Interval.Interval):
startFrame=None, endFrame=None, startFrame=None, endFrame=None,
playRate=1.0, name=None, forceUpdate=0, playRate=1.0, name=None, forceUpdate=0,
partName=None, lodName=None): partName=None, lodName=None):
"""__init__(name)
"""
# Generate unique id # Generate unique id
id = 'Actor-%s-%d' % (animName, ActorInterval.animNum) id = 'Actor-%s-%d' % (animName, ActorInterval.animNum)
ActorInterval.animNum += 1 ActorInterval.animNum += 1

View File

@ -34,8 +34,8 @@ class MopathInterval(LerpInterval.LerpFunctionInterval):
self.node = node self.node = node
def __doMopath(self, t): def __doMopath(self, t):
""" updateFunc(t, event) """
Go to time t Go to time t
""" """
self.mopath.goTo(self.node, t) self.mopath.goTo(self.node, t)

View File

@ -792,7 +792,7 @@ class LevelEditor(NodePath, PandaObject):
self.traversalOn() self.traversalOn()
def configureDriveModeCollisionData(self): def configureDriveModeCollisionData(self):
"""initializeCollisions(self) """
Set up the local avatar for collisions Set up the local avatar for collisions
""" """
# Set up the collision sphere # Set up the collision sphere

View File

@ -14,7 +14,7 @@ noBlend = NoBlendType()
def getBlend(blendType): def getBlend(blendType):
"""getBlend(string) """
Return the C++ blend class corresponding to blendType string Return the C++ blend class corresponding to blendType string
""" """
# Note, this is temporary until blend functions get exposed # Note, this is temporary until blend functions get exposed

View File

@ -976,8 +976,7 @@ class ShowBase(DirectObject.DirectObject):
mw.node().addRegion(PGMouseWatcherBackground()) mw.node().addRegion(PGMouseWatcherBackground())
def enableSoftwareMousePointer(self): def enableSoftwareMousePointer(self):
"""enableSoftwareMousePointer(self) """
Creates some geometry and parents it to render2d to show Creates some geometry and parents it to render2d to show
the currently-known mouse position. Useful if the mouse the currently-known mouse position. Useful if the mouse
pointer is invisible for some reason. pointer is invisible for some reason.
@ -1007,21 +1006,18 @@ class ShowBase(DirectObject.DirectObject):
KeyboardButton.control()) KeyboardButton.control())
def addAngularIntegrator(self): def addAngularIntegrator(self):
"""addAngularIntegrator(self)"""
if (self.physicsMgrAngular == 0): if (self.physicsMgrAngular == 0):
self.physicsMgrAngular = 1 self.physicsMgrAngular = 1
integrator = AngularEulerIntegrator() integrator = AngularEulerIntegrator()
self.physicsMgr.attachAngularIntegrator(integrator) self.physicsMgr.attachAngularIntegrator(integrator)
def enableParticles(self): def enableParticles(self):
"""enableParticles(self)"""
self.particleMgrEnabled = 1 self.particleMgrEnabled = 1
self.physicsMgrEnabled = 1 self.physicsMgrEnabled = 1
self.taskMgr.remove('manager-update') self.taskMgr.remove('manager-update')
self.taskMgr.add(self.updateManagers, 'manager-update') self.taskMgr.add(self.updateManagers, 'manager-update')
def disableParticles(self): def disableParticles(self):
"""enableParticles(self)"""
self.particleMgrEnabled = 0 self.particleMgrEnabled = 0
self.physicsMgrEnabled = 0 self.physicsMgrEnabled = 0
self.taskMgr.remove('manager-update') self.taskMgr.remove('manager-update')

View File

@ -2,12 +2,9 @@ from pandac.PandaModules import *
import Task import Task
class Timer: class Timer:
id = 0 id = 0
def __init__(self, name=None): def __init__(self, name=None):
""" __init__()
"""
self.finalT = 0.0 self.finalT = 0.0
self.currT = 0.0 self.currT = 0.0
if (name == None): if (name == None):
@ -18,8 +15,6 @@ class Timer:
self.callback = None self.callback = None
def start(self, t, name): def start(self, t, name):
""" start(t, name)
"""
if (self.started): if (self.started):
self.stop() self.stop()
self.callback = None self.callback = None
@ -31,8 +26,6 @@ class Timer:
self.started = 1 self.started = 1
def startCallback(self, t, callback): def startCallback(self, t, callback):
""" startCallback(t, callback)
"""
if (self.started): if (self.started):
self.stop() self.stop()
self.callback = callback self.callback = callback
@ -43,8 +36,6 @@ class Timer:
self.started = 1 self.started = 1
def stop(self): def stop(self):
""" stop()
"""
if (not self.started): if (not self.started):
return 0.0 return 0.0
taskMgr.remove(self.name + '-run') taskMgr.remove(self.name + '-run')
@ -52,38 +43,26 @@ class Timer:
return self.currT return self.currT
def resume(self): def resume(self):
""" resume()
"""
assert(self.currT <= self.finalT) assert(self.currT <= self.finalT)
assert(self.started == 0) assert(self.started == 0)
self.start(self.finalT - self.currT, self.name) self.start(self.finalT - self.currT, self.name)
def restart(self): def restart(self):
""" restart()
"""
if (self.callback != None): if (self.callback != None):
self.startCallback(self.finalT, self.callback) self.startCallback(self.finalT, self.callback)
else: else:
self.start(self.finalT, self.name) self.start(self.finalT, self.name)
def isStarted(self): def isStarted(self):
""" isStarted()
"""
return self.started return self.started
def addT(self, t): def addT(self, t):
""" addT(t)
"""
self.finalT = self.finalT + t self.finalT = self.finalT + t
def setT(self, t): def setT(self, t):
""" setT(t)
"""
self.finalT = t self.finalT = t
def getT(self): def getT(self):
""" getT()
"""
return (self.finalT - self.currT) return (self.finalT - self.currT)
def __timerTask(self, task): def __timerTask(self, task):

View File

@ -4,7 +4,7 @@ class NotifyPanel:
a panel to control direct/panda notify categories.""" a panel to control direct/panda notify categories."""
def __init__(self, directNotify, tl = None): def __init__(self, directNotify, tl = None):
"""__init__(self) """
NotifyPanel class pops up a control panel to view/set NotifyPanel class pops up a control panel to view/set
notify levels for all available DIRECT and PANDA notify categories notify levels for all available DIRECT and PANDA notify categories
""" """

View File

@ -41,7 +41,7 @@ class TaskManagerWidget(PandaObject):
""" """
def __init__(self, parent, taskMgr): def __init__(self, parent, taskMgr):
"""__init__(self) """
TaskManagerWidget class pops up a control panel to view/delete TaskManagerWidget class pops up a control panel to view/delete
tasks managed by the taskManager. tasks managed by the taskManager.
""" """