*** empty log message ***
This commit is contained in:
parent
242ac509e5
commit
7ebeef4d09
|
|
@ -29,19 +29,7 @@ class DirectNotify:
|
|||
def getCategory(self, categoryName):
|
||||
"""getCategory(self, string)
|
||||
Return the category with given name if present, None otherwise"""
|
||||
return(self.__categories.get(categoryName, None))
|
||||
|
||||
def addCategory(self, categoryName, category):
|
||||
"""addCategory(self, Notifier)
|
||||
Add a given Notifier with given name to the category dictionary
|
||||
and return 0 if not present, else return 0. """
|
||||
if (self.__categories.has_key(categoryName)):
|
||||
print "Warning: DirectNotify: category '%s' already exists" % \
|
||||
(categoryName)
|
||||
return(0)
|
||||
else:
|
||||
self.__categories[categoryName] = category
|
||||
return(1)
|
||||
return (self.__categories.get(categoryName, None))
|
||||
|
||||
def newCategory(self, categoryName, logger=None):
|
||||
"""newCategory(self, string)
|
||||
|
|
@ -49,16 +37,57 @@ class DirectNotify:
|
|||
if no such category exists, else return existing category"""
|
||||
if (not self.__categories.has_key(categoryName)):
|
||||
self.__categories[categoryName] = Notifier.Notifier(categoryName, logger)
|
||||
self.setDconfigLevel(categoryName)
|
||||
else:
|
||||
print "Warning: DirectNotify: category '%s' already exists" % \
|
||||
(categoryName)
|
||||
return(self.getCategory(categoryName))
|
||||
return (self.getCategory(categoryName))
|
||||
|
||||
|
||||
|
||||
#global DirectNotify for public access
|
||||
directNotify = DirectNotify()
|
||||
def setDconfigLevel(self, categoryName):
|
||||
"""
|
||||
Check to see if this category has a dconfig variable
|
||||
to set the notify severity and then set that level. You cannot
|
||||
set these until base.config is set.
|
||||
"""
|
||||
|
||||
# We cannot check dconfig variables until base.config has been
|
||||
# set. Once base.config is set in ShowBase.py, it tries to set
|
||||
# all the levels again in case some were created before base.config
|
||||
# was created.
|
||||
try:
|
||||
base.config
|
||||
except:
|
||||
return 0
|
||||
|
||||
dconfigParam = ("notify-level-" + categoryName)
|
||||
level = base.config.GetString(dconfigParam, "")
|
||||
if level:
|
||||
print ("Setting DirectNotify category: " + dconfigParam +
|
||||
" to severity: " + level)
|
||||
category = self.getCategory(categoryName)
|
||||
if level == "error":
|
||||
category.setWarning(0)
|
||||
category.setInfo(0)
|
||||
category.setDebug(0)
|
||||
elif level == "warning":
|
||||
category.setWarning(1)
|
||||
category.setInfo(0)
|
||||
category.setDebug(0)
|
||||
elif level == "info":
|
||||
category.setWarning(1)
|
||||
category.setInfo(1)
|
||||
category.setDebug(0)
|
||||
elif level == "debug":
|
||||
category.setWarning(1)
|
||||
category.setInfo(1)
|
||||
category.setDebug(1)
|
||||
else:
|
||||
print ("DirectNotify: unknown notify level: " + str(level)
|
||||
+ " for category: " + str(categoryName))
|
||||
|
||||
def setDconfigLevels(self):
|
||||
for categoryName in self.getCategories():
|
||||
self.setDconfigLevel(categoryName)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,8 @@ class Notifier:
|
|||
else:
|
||||
self.__logger = logger
|
||||
|
||||
self.__verbose = 0
|
||||
# Global default levels are initialized here
|
||||
self.__info = 1
|
||||
self.__warning = 1
|
||||
self.__debug = 0
|
||||
self.__logging = 0
|
||||
|
|
@ -25,8 +26,8 @@ class Notifier:
|
|||
def __str__(self):
|
||||
"""__str__(self)
|
||||
Print handling routine"""
|
||||
return "%s: verbose = %d, warning = %d, debug = %d, logging = %d" % \
|
||||
(self.__name, self.__verbose, self.__warning, self.__debug, self.__logging)
|
||||
return "%s: info = %d, warning = %d, debug = %d, logging = %d" % \
|
||||
(self.__name, self.__info, self.__warning, self.__debug, self.__logging)
|
||||
|
||||
|
||||
# error funcs
|
||||
|
|
@ -83,21 +84,21 @@ class Notifier:
|
|||
# info funcs
|
||||
def info(self, infoString):
|
||||
"""info(self, string)
|
||||
Print the given informational string, if verbose flag is on"""
|
||||
if (self.__verbose):
|
||||
Print the given informational string, if info flag is on"""
|
||||
if (self.__info):
|
||||
str = ':' + self.__name + '(info): ' + infoString
|
||||
self.__log(str)
|
||||
print(str)
|
||||
|
||||
def getVerbose(self):
|
||||
"""getVerbose(self)
|
||||
def getInfo(self):
|
||||
"""getInfo(self)
|
||||
Return whether the printing of info messages is on or off"""
|
||||
return(self.__verbose)
|
||||
return(self.__info)
|
||||
|
||||
def setVerbose(self, bool):
|
||||
"""setVerbose(self, int)
|
||||
def setInfo(self, bool):
|
||||
"""setInfo(self, int)
|
||||
Enable/Disable informational message printing"""
|
||||
self.__verbose = bool
|
||||
self.__info = bool
|
||||
|
||||
|
||||
# log funcs
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ WrapperClassMap = {}
|
|||
DowncastMap = {}
|
||||
|
||||
# For testing, you can turn verbose and debug on
|
||||
# FFIConstants.notify.setVerbose(1)
|
||||
# FFIConstants.notify.setInfo(1)
|
||||
# FFIConstants.notify.setDebug(1)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
#define INSTALL_SCRIPTS generatePythonCode
|
||||
#define INSTALL_SCRIPTS genPyCode
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
#! /bin/sh
|
||||
|
||||
# This is just a helper script to generatePythonCode to cover
|
||||
# the three or four cases we use all the time
|
||||
|
||||
if [ "$1" = "linux" ]; then
|
||||
cd $DIRECT/bin
|
||||
exec ppython -d generatePythonCode -v -d $DIRECT/lib/py -e $DIRECT/src/extensions -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect libtoontown
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "win-debug" ]; then
|
||||
cd $DIRECT/bin
|
||||
exec ppython -d generatePythonCode -v -d `cygpath -w $DIRECT/lib/py` -e `cygpath -w $DIRECT/src/extensions` -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect libtoontown
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "win-release" ]; then
|
||||
cd $DIRECT/bin
|
||||
exec ppython -i generatePythonCode -v -d `cygpath -w $DIRECT/lib/py` -e `cygpath -w $DIRECT/src/extensions` -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect libtoontown
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" = "win-publish" ]; then
|
||||
# no assertions, no comments, no docstrings
|
||||
cd $DIRECT/bin
|
||||
exec ppython -OO generatePythonCode -O -v -d `cygpath -w $DIRECT/lib/py` -e `cygpath -w $DIRECT/src/extensions` -i libdtoolconfig libpandaexpress libpanda libpandaphysics libdirect libtoontown
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -33,6 +33,10 @@ Options:
|
|||
-e dir directory to pull extension code from
|
||||
-i lib interrogate library
|
||||
-O no C++ comments or assertion statements
|
||||
linux
|
||||
windows-debug
|
||||
windows-release
|
||||
windows-publish
|
||||
"""
|
||||
|
||||
# Initialize variables
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ class Loader:
|
|||
"""Loader class: contains method to load models, sounds and code"""
|
||||
|
||||
notify = directNotify.newCategory("Loader")
|
||||
# notify.setVerbose(1)
|
||||
# notify.setInfo(1)
|
||||
|
||||
# special methods
|
||||
def __init__(self, base):
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class Messenger:
|
|||
def ignoreAll(self, object):
|
||||
""" ignoreAll(self, DirectObject)
|
||||
Make this object no longer respond to any events it was accepting
|
||||
Useful for cleanup
|
||||
"""
|
||||
|
||||
Messenger.notify.debug(`object` + '\n now ignoring all events')
|
||||
|
|
@ -139,6 +140,10 @@ class Messenger:
|
|||
|
||||
|
||||
def replaceMethod(self, oldMethod, newFunction):
|
||||
"""
|
||||
This is only used by Finder.py - the module that lets
|
||||
you redefine functions with Control-c-Control-v
|
||||
"""
|
||||
import new
|
||||
for entry in self.dict.items():
|
||||
event, objectDict = entry
|
||||
|
|
|
|||
|
|
@ -12,16 +12,13 @@ import Task
|
|||
import EventManager
|
||||
import math
|
||||
import sys
|
||||
import LinearEulerIntegrator
|
||||
import AngularEulerIntegrator
|
||||
import ClockObject
|
||||
import Transitions
|
||||
import Loader
|
||||
import time
|
||||
import FSM
|
||||
import State
|
||||
|
||||
globalClock = ClockObject.ClockObject.getGlobalClock()
|
||||
globalClock = ClockObject.getGlobalClock()
|
||||
|
||||
class ShowBase:
|
||||
|
||||
|
|
@ -40,9 +37,6 @@ class ShowBase:
|
|||
|
||||
taskMgr.taskTimerVerbose = self.config.GetBool('task-timer-verbose', 0)
|
||||
|
||||
fsmDebug = self.config.GetBool('fsm-debug', 0)
|
||||
FSM.FSM.notify.setDebug(fsmDebug)
|
||||
|
||||
fsmRedefine = self.config.GetBool('fsm-redefine', 0)
|
||||
State.FsmRedefine = fsmRedefine
|
||||
|
||||
|
|
@ -160,7 +154,7 @@ class ShowBase:
|
|||
|
||||
# Physics manager
|
||||
self.physicsMgr = physicsMgr
|
||||
integrator = LinearEulerIntegrator.LinearEulerIntegrator()
|
||||
integrator = LinearEulerIntegrator()
|
||||
self.physicsMgr.attachLinearIntegrator(integrator)
|
||||
self.physicsMgrEnabled = 0
|
||||
self.physicsMgrAngular = 0
|
||||
|
|
@ -178,7 +172,7 @@ class ShowBase:
|
|||
"""addAngularIntegrator(self)"""
|
||||
if (self.physicsMgrAngular == 0):
|
||||
self.physicsMgrAngular = 1
|
||||
integrator = AngularEulerIntegrator.AngularEulerIntegrator()
|
||||
integrator = AngularEulerIntegrator()
|
||||
self.physicsMgr.attachAngularIntegrator(integrator)
|
||||
|
||||
def enableParticles(self):
|
||||
|
|
|
|||
|
|
@ -19,3 +19,9 @@ __builtin__.taskMgr = base.taskMgr
|
|||
__builtin__.eventMgr = base.eventMgr
|
||||
__builtin__.messenger = base.messenger
|
||||
__builtin__.config = base.config
|
||||
__builtin__.directNotify = directNotify
|
||||
|
||||
# Set direct notify categories now that we have config
|
||||
directNotify.setDconfigLevels()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from libpandaexpressModules import *
|
||||
from DirectNotify import *
|
||||
from DirectNotifyGlobal import *
|
||||
from PythonUtil import *
|
||||
import time
|
||||
import fnmatch
|
||||
|
|
@ -348,7 +348,7 @@ class TaskManager:
|
|||
for task in self.taskList:
|
||||
task.setCurrentTimeFrame(self.currentTime, self.currentFrame)
|
||||
|
||||
if (self.taskTimerVerbose == 0):
|
||||
if not self.taskTimerVerbose:
|
||||
# don't record timing info
|
||||
ret = task(task)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue