*** empty log message ***

This commit is contained in:
Joe Shochet 2000-12-08 23:23:25 +00:00
parent 456ca52ec2
commit c1593ed61f
3 changed files with 34 additions and 21 deletions

View File

@ -43,7 +43,7 @@ class Notifier:
"""warning(self, string)
Issue the warning message if warn flag is on"""
if (self.__warning):
str = "Warning: " + self.__name + ": " + warningString
str = ':' + self.__name + '(warning): ' + warningString
self.__log(str)
print(str)
@ -64,7 +64,7 @@ class Notifier:
"""debug(self, string)
Issue the debug message if debug flag is on"""
if (self.__debug):
str = "Debug: " + self.__name + ": " + debugString
str = ':' + self.__name + '(debug): ' + debugString
self.__log(str)
print(str)
@ -85,7 +85,7 @@ class Notifier:
"""info(self, string)
Print the given informational string, if verbose flag is on"""
if (self.__verbose):
str = "Info: " + self.__name + ": " + infoString
str = ':' + self.__name + '(info): ' + infoString
self.__log(str)
print(str)

View File

@ -23,6 +23,7 @@ class ShowBase:
self.wantTk = self.config.GetBool('want-tk', 0)
self.wantSound = self.config.GetBool('want-sound', 1)
self.wantDIRECT = self.config.GetBool('want-directtools', 0)
self.wantStats = self.config.GetBool('want-stats', 0)
# Set a maximum frame rate on the render loop (0 means do not limit)
Task.maxFps = self.config.GetInt('max-fps', 120)
@ -91,9 +92,16 @@ class ShowBase:
self.createAudioManager()
self.createRootPanel()
self.createStats()
self.restart()
def createStats(self):
# You must specify a pstats-host in your configrc
# The default is localhost
if self.wantStats:
PStatClient.getGlobalPstats().connect()
def createAudioManager(self):
if self.wantSound:
AudioManager.spawnUpdate()

View File

@ -184,12 +184,15 @@ class TaskManager:
def __init__(self):
self.running = 0
self.stepping = 0
self.taskList = []
self.currentTime, self.currentFrame = getTimeFrame()
if (TaskManager.notify == None):
TaskManager.notify = directNotify.newCategory("TaskManager")
#TaskManager.notify.setDebug(1)
def stepping(value):
self.stepping = value
def spawnMethodNamed(self, func, name):
task = Task(func)
@ -235,6 +238,7 @@ class TaskManager:
return len(removedTasks)
def step(self):
TaskManager.notify.debug('step')
self.currentTime, self.currentFrame = getTimeFrame()
for task in self.taskList:
task.setCurrentTimeFrame(self.currentTime, self.currentFrame)
@ -255,28 +259,29 @@ class TaskManager:
return len(self.taskList)
def run(self):
# Set the clock to have last frame's time in case we were
# Paused at the prompt for a long time
t = globalClock.getTime()
globalClock.setTime(t)
self.running = 1
while self.running:
try:
startTime = globalClock.getRealTime()
self.step()
finishTime = globalClock.getRealTime()
# Max out the frame rate so we do not starve the cpu
if (maxFps > 0):
dt = finishTime - startTime
length = (1.0/maxFps)-dt
if (length > 0):
time.sleep(length)
except KeyboardInterrupt:
self.stop()
except:
raise
if self.stepping:
self.step()
else:
self.running = 1
while self.running:
try:
startTime = globalClock.getRealTime()
self.step()
finishTime = globalClock.getRealTime()
# Max out the frame rate so we do not starve the cpu
if (maxFps > 0):
dt = finishTime - startTime
length = (1.0/maxFps)-dt
if (length > 0):
time.sleep(length)
except KeyboardInterrupt:
self.stop()
except:
raise
def stop(self):
# Set a flag so we will stop before beginning next frame