mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-17 20:23:47 -04:00
protect against no profile module
This commit is contained in:
parent
a2a8aacb7e
commit
da7a5b6b55
@ -128,13 +128,7 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
taskMgr.resumeFunc = PStatClient.resumeAfterPause
|
taskMgr.resumeFunc = PStatClient.resumeAfterPause
|
||||||
|
|
||||||
if self.__dev__:
|
if self.__dev__:
|
||||||
import profile, pstats
|
self.__setupProfile()
|
||||||
profile.Profile.bias = float(self.config.GetString("profile-bias","0"))
|
|
||||||
|
|
||||||
|
|
||||||
def f8(x):
|
|
||||||
return ("%"+"8.%df"%base.config.GetInt("profile-decimals",3)) % x
|
|
||||||
pstats.f8=f8
|
|
||||||
|
|
||||||
# If the aspect ratio is 0 or None, it means to infer the
|
# If the aspect ratio is 0 or None, it means to infer the
|
||||||
# aspect ratio from the window size.
|
# aspect ratio from the window size.
|
||||||
@ -426,6 +420,21 @@ class ShowBase(DirectObject.DirectObject):
|
|||||||
def popCTrav(self):
|
def popCTrav(self):
|
||||||
self.cTrav = self.cTravStack.pop()
|
self.cTrav = self.cTravStack.pop()
|
||||||
|
|
||||||
|
def __setupProfile(self):
|
||||||
|
""" Sets up the Python profiler, if avaialable, according to
|
||||||
|
some Panda config settings. """
|
||||||
|
|
||||||
|
try:
|
||||||
|
import profile, pstats
|
||||||
|
except ImportError:
|
||||||
|
return
|
||||||
|
|
||||||
|
profile.Profile.bias = float(self.config.GetString("profile-bias","0"))
|
||||||
|
|
||||||
|
def f8(x):
|
||||||
|
return ("%"+"8.%df"%base.config.GetInt("profile-decimals",3)) % x
|
||||||
|
pstats.f8=f8
|
||||||
|
|
||||||
# temp; see ToonBase.py
|
# temp; see ToonBase.py
|
||||||
def getExitErrorCode(self):
|
def getExitErrorCode(self):
|
||||||
return 0
|
return 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user