本文整理汇总了Python中panda3d.core.PandaSystem类的典型用法代码示例。如果您正苦于以下问题:Python PandaSystem类的具体用法?Python PandaSystem怎么用?Python PandaSystem使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PandaSystem类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: checkPandaVersionOutOfDate
def checkPandaVersionOutOfDate(self, minDay, minMonth, minYear):
""" Checks if the panda build is out of date, so users don't complain
about stuff not working, because they simply didn't update """
built = PandaSystem.getBuildDate()
formated = datetime.datetime.strptime(built, "%b %d %Y %H:%M:%S")
required = datetime.datetime(minYear, minMonth, minDay, 12, 00)
if formated < required:
print "ERROR: Your Panda3D Build is out of date. Update to the latest"
print "git build in order to use the pipeline: "
print "https://github.com/panda3d/panda3d"
sys.exit(0)
# Check version
versionMinMinor = 9
versionMinMajor = 1
versionMismatch = False
if PandaSystem.getMajorVersion() < versionMinMajor:
versionMismatch = True
elif PandaSystem.getMinorVersion() < versionMinMinor:
versionMismatch = True
if versionMismatch:
print "ERROR: Your current panda build (", PandaSystem.getVersionString(), ") is"
print "not supported! The minimum required build is", str(versionMinMajor) + "." + str(versionMinMinor) + ".0"
sys.exit(0)
示例2: interrogate
def interrogate():
""" Runs interrogate over the source directory """
# Collect source files and convert them to a relative path
all_sources = find_sources(".")
# Create the interrogate command
cmd = [join(get_panda_bin_path(), 'interrogate')]
if VERBOSE_LVL == 1:
cmd += ["-v"]
elif VERBOSE_LVL == 2:
cmd += ["-vv"]
cmd += ["-fnames", "-string", "-refcount", "-assert", "-python-native"]
cmd += ["-S" + get_panda_include_path() + "/parser-inc"]
cmd += ["-S" + get_panda_include_path() + "/"]
# Add all subdirectories
for pth in listdir("."):
if isdir(pth):
cmd += ["-I" + pth]
cmd += ["-srcdir", "."]
cmd += ["-oc", "interrogate_wrapper.cpp"]
cmd += ["-od", "interrogate.in"]
cmd += ["-module", MODULE_NAME]
cmd += ["-library", MODULE_NAME]
if PandaSystem.get_major_version() > 1 or PandaSystem.get_minor_version() > 9:
# Add nomangle option, but only for recent builds
cmd += ["-nomangle"]
if PandaSystem.get_major_version() == 1 and PandaSystem.get_minor_version() < 10:
# Old interrogate options cant handle volatile
cmd += ["-Dvolatile="]
# Defines required to parse the panda source
defines = ["INTERROGATE", "CPPPARSER", "__STDC__=1", "__cplusplus=201103L"]
if get_compiler_name() == "MSC":
defines += ["__inline", "_X86_", "WIN32_VC", "WIN32", "_WIN32"]
if is_64_bit():
defines += ["WIN64_VC", "WIN64", "_WIN64"]
# NOTE: this 1600 value is the version number for VC2010.
defines += ["_MSC_VER=1600", '"__declspec(param)="', "__cdecl", "_near",
"_far", "__near", "__far", "__stdcall"]
if get_compiler_name() == "GCC":
defines += ['__attribute__\(x\)=']
if is_64_bit():
defines += ['_LP64']
else:
defines += ['__i386__']
for define in defines:
cmd += ["-D" + define]
cmd += all_sources
try_execute(*cmd, verbose=VERBOSE_LVL != 0)
示例3: __init__
def __init__(self, outdated_parameter=None):
""" Creates a new pipeline with a given showbase instance. This should
be done before intializing the ShowBase, the pipeline will take care of
that. """
RPObject.__init__(self)
if outdated_parameter is not None:
self.fatal("The render pipeline no longer takes the ShowBase argument "
"as constructor parameter. Please have a look at the "
"00-Loading the pipeline sample to see how to initialize "
"the pipeline properly.")
self.debug("Using Python {}.{} with architecture {}".format(
sys.version_info.major, sys.version_info.minor, PandaSystem.get_platform()))
self.debug("Using Panda3D {} built on {}".format(
PandaSystem.get_version_string(), PandaSystem.get_build_date()))
if PandaSystem.get_git_commit():
self.debug("Using git commit {}".format(PandaSystem.get_git_commit()))
else:
self.debug("Using custom Panda3D build")
self.mount_mgr = MountManager(self)
self.settings = {}
self._pre_showbase_initialized = False
self._first_frame = None
self.set_default_loading_screen()
# Check for the right Panda3D version
if not self._check_version():
self.fatal("Your Panda3D version is outdated! Please update to the newest \n"
"git version! Checkout https://github.com/panda3d/panda3d to "
"compile panda from source, or get a recent buildbot build.")
示例4: dummyAppRunner
def dummyAppRunner(tokens = [], argv = None):
""" This function creates a dummy global AppRunner object, which
is useful for testing running in a packaged environment without
actually bothering to package up the application. Call this at
the start of your application to enable it.
It places the current working directory under /mf, as if it were
mounted from a packed multifile. It doesn't convert egg files to
bam files, of course; and there are other minor differences from
running in an actual packaged environment. But it can be a useful
first-look sanity check. """
if AppRunnerGlobal.appRunner:
print("Already have AppRunner, not creating a new one.")
return AppRunnerGlobal.appRunner
appRunner = AppRunner()
appRunner.dummy = True
AppRunnerGlobal.appRunner = appRunner
platform = PandaSystem.getPlatform()
version = PandaSystem.getPackageVersionString()
hostUrl = PandaSystem.getPackageHostUrl()
if platform.startswith('win'):
rootDir = Filename(Filename.getUserAppdataDirectory(), 'Panda3D')
elif platform.startswith('osx'):
rootDir = Filename(Filename.getHomeDirectory(), 'Library/Caches/Panda3D')
else:
rootDir = Filename(Filename.getHomeDirectory(), '.panda3d')
appRunner.rootDir = rootDir
appRunner.logDirectory = Filename(rootDir, 'log')
# Of course we will have the panda3d application loaded.
appRunner.addPackageInfo('panda3d', platform, version, hostUrl)
appRunner.tokens = tokens
appRunner.tokenDict = dict(tokens)
if argv is None:
argv = sys.argv
appRunner.argv = argv
appRunner.altHost = appRunner.tokenDict.get('alt_host', None)
appRunner.p3dInfo = None
appRunner.p3dPackage = None
# Mount the current directory under the multifileRoot, as if it
# were coming from a multifile.
cwd = ExecutionEnvironment.getCwd()
vfs = VirtualFileSystem.getGlobalPtr()
vfs.mount(cwd, appRunner.multifileRoot, vfs.MFReadOnly)
appRunner.initPackedAppEnvironment()
return appRunner
示例5: getAllPackages
def getAllPackages(self, includeAllPlatforms = False):
""" Returns a list of all available packages provided by this
host. """
result = []
items = sorted(self.packages.items())
for key, platforms in items:
if self.perPlatform or includeAllPlatforms:
# If we maintain a different answer per platform,
# return all of them.
pitems = sorted(platforms.items())
for pkey, package in pitems:
result.append(package)
else:
# If we maintain a host for the current platform
# only (e.g. a client copy), then return only the
# current platform, or no particular platform.
package = platforms.get(PandaSystem.getPlatform(), None)
if not package:
package = platforms.get(None, None)
if package:
result.append(package)
return result
示例6: _analyze_system
def _analyze_system(self):
""" Prints information about the system used, including information
about the used Panda3D build. Also checks if the Panda3D build is out
of date. """
self.debug("Using Python {}.{} with architecture {}".format(
sys.version_info.major, sys.version_info.minor, PandaSystem.get_platform()))
self.debug("Using Panda3D {} built on {}".format(
PandaSystem.get_version_string(), PandaSystem.get_build_date()))
if PandaSystem.get_git_commit():
self.debug("Using git commit {}".format(PandaSystem.get_git_commit()))
else:
self.debug("Using custom Panda3D build")
if not self._check_version():
self.fatal("Your Panda3D version is outdated! Please update to the newest \n"
"git version! Checkout https://github.com/panda3d/panda3d to "
"compile panda from source, or get a recent buildbot build.")
示例7: interrogate_module
def interrogate_module():
""" Runs the interrogate module command """
# Create module command
cmd = [join_abs(get_panda_bin_path(), "interrogate_module")]
cmd += ["-python-native"]
if PandaSystem.get_major_version() > 1 or PandaSystem.get_minor_version() > 9:
# Older panda3d versions don't have this
cmd += ["-import", "panda3d.core"]
cmd += ["-module", MODULE_NAME]
cmd += ["-library", MODULE_NAME]
cmd += ["-oc", "interrogate_module.cpp"]
cmd += ["interrogate.in"]
try_execute(*cmd, verbose=VERBOSE_LVL != 0)
示例8: __init__
def __init__(self, showbase):
""" Creates a new pipeline with a given showbase instance. This should
be done before intializing the ShowBase, the pipeline will take care of
that. """
DebugObject.__init__(self, "RenderPipeline")
self.debug("Using Python {} with architecture {}".format(
sys.version_info.major, PandaSystem.get_platform()))
self._showbase = showbase
self._mount_mgr = MountManager(self)
self._settings = SettingsLoader(self, "Pipeline Settings")
self.set_default_loading_screen()
示例9: __init__
def __init__(self):
""" Creates a new pipeline with a given showbase instance. This should
be done before intializing the ShowBase, the pipeline will take care of
that. If the showbase has been initialized before, have a look at
the alternative initialization of the render pipeline (the first sample)."""
RPObject.__init__(self)
self.debug("Using Python {}.{} with architecture {}".format(
sys.version_info.major, sys.version_info.minor, PandaSystem.get_platform()))
self.debug("Using Panda3D {} built on {}".format(
PandaSystem.get_version_string(), PandaSystem.get_build_date()))
if PandaSystem.get_git_commit():
self.debug("Using git commit {}".format(PandaSystem.get_git_commit()))
else:
self.debug("Using custom Panda3D build")
if not self._check_version():
self.fatal("Your Panda3D version is outdated! Please update to the newest \n"
"git version! Checkout https://github.com/panda3d/panda3d to "
"compile panda from source, or get a recent buildbot build.")
self.mount_mgr = MountManager(self)
self.settings = {}
self._pre_showbase_initialized = False
self._first_frame = None
self.set_loading_screen_image("/$$rp/data/gui/loading_screen_bg.txo")
示例10: run
def run():
global outputCodeDir
global outputHTMLDir
global directDir
global extensionsDir
global interrogateLib
global codeLibs
global doSqueeze
global deleteSourceAfterSqueeze
global etcPath
global pythonSourcePath
doGetopts()
doErrorCheck()
# Ok, now we can start generating code
if native:
generateNativeWrappers()
else:
from direct.ffi import FFIInterrogateDatabase
db = FFIInterrogateDatabase.FFIInterrogateDatabase(etcPath = etcPath)
db.generateCode(outputCodeDir, extensionsDir)
if doSqueeze:
db.squeezeGeneratedCode(outputCodeDir, deleteSourceAfterSqueeze)
if doHTML:
from direct.directscripts import gendocs
from panda3d.core import PandaSystem
versionString = '%s %s' % (
PandaSystem.getDistributor(), PandaSystem.getVersionString())
gendocs.generate(versionString, etcPath, pythonSourcePath,
outputHTMLDir, HTMLHeader % time.asctime(),
HTMLFooter, '', '.html')
示例11: __init__
def __init__(self, showbase):
""" Creates a new pipeline with a given showbase instance. This should
be done before intializing the ShowBase, the pipeline will take care of
that. """
DebugObject.__init__(self, "RenderPipeline")
self.debug("Using Python {} with architecture {}".format(
sys.version_info.major, PandaSystem.get_platform()))
self._showbase = showbase
self._mount_mgr = MountManager(self)
self._settings = SettingsLoader(self, "Pipeline Settings")
self.set_default_loading_screen()
# Check for the right Panda3D version
if not self._check_version():
self.fatal("Your Panda3D version is too old! Please update to a newer "
" version! (You need a development version of panda).")
示例12: handleCommand
def handleCommand(self, command):
if command is None:
# hack for Ctrl-Break
self.spewInProgress = False
self.console.addLine("*** break ***")
self.console.allowEditing(True)
return
command = command.strip()
if not command:
return
tokens = [x.strip() for x in command.split(' ')]
command = tokens[0].lower()
if command == 'help':
self.console.addLines([
"Sorry, this is utter fakery.",
"You won't get much more",
"out of this simulation unless",
"you program it yourself. :)"
])
elif command == 'dir':
self.console.addLines([
"Directory of C:\\:",
"HELP COM 72 05-06-2015 14:07",
"DIR COM 121 05-06-2015 14:11",
"SPEW COM 666 05-06-2015 15:02",
" 2 Files(s) 859 Bytes.",
" 0 Dirs(s) 7333 Bytes free.",
""])
elif command == 'cls':
self.console.cls()
elif command == 'echo':
self.console.addLine(' '.join(tokens[1:]))
elif command == 'ver':
self.console.addLine('Panda DOS v0.01 in Panda3D ' + PandaSystem.getVersionString())
elif command == 'spew':
self.startSpew()
elif command == 'exit':
self.console.setPrompt("System is shutting down NOW!")
self.terminateMonitor()
else:
self.console.addLine("command not found")
示例13: analyze
def analyze(self):
""" Analyzes the user system. This should help debugging when the user
shares his log. """
print "System analyzer:"
def stat(name, *args):
print " ", str(name).ljust(20, " "), "=", ''.join([str(i) for i in args])
stat("System", sys.platform, " / ", os.name)
stat("Bitness", 8 * struct.calcsize("P"))
stat("Panda3D-Build Date", PandaSystem.getBuildDate())
stat("Panda3D-Compiler", PandaSystem.getCompiler())
stat("Panda3D-Distributor", PandaSystem.getDistributor())
stat("Panda3D-Version", PandaSystem.getVersionString())
stat("Panda3D-GITCommit", PandaSystem.getGitCommit())
stat("Panda3D-Platform", PandaSystem.getPlatform())
stat("Panda3D-Official?", PandaSystem.isOfficialVersion())
示例14: getPackage
def getPackage(self, name, version, platform = None):
""" Returns a PackageInfo that matches the indicated name and
version and the indicated platform or the current runtime
platform, if one is provided by this host, or None if not. """
assert self.hasContentsFile
platforms = self.packages.get((name, version or None), {})
if platform is not None:
# In this case, we are looking for a specific platform
# only.
return platforms.get(platform or None, None)
# We are looking for one matching the current runtime
# platform. First, look for a package matching the current
# platform exactly.
package = platforms.get(PandaSystem.getPlatform(), None)
# If not found, look for one matching no particular platform.
if not package:
package = platforms.get(None, None)
return package
示例15: __init__
def __init__(self):
DirectObject.__init__(self)
# We direct both our stdout and stderr objects onto Panda's
# Notify stream. This ensures that unadorned print statements
# made within Python will get routed into the log properly.
stream = StreamWriter(Notify.out(), False)
sys.stdout = stream
sys.stderr = stream
# This is set true by dummyAppRunner(), below.
self.dummy = False
# These will be set from the application flags when
# setP3DFilename() is called.
self.allowPythonDev = False
self.guiApp = False
self.interactiveConsole = False
self.initialAppImport = False
self.trueFileIO = False
self.respectPerPlatform = None
self.verifyContents = self.P3DVCNone
self.sessionId = 0
self.packedAppEnvironmentInitialized = False
self.gotWindow = False
self.gotP3DFilename = False
self.p3dFilename = None
self.p3dUrl = None
self.started = False
self.windowOpened = False
self.windowPrc = None
self.http = None
if hasattr(core, 'HTTPClient'):
self.http = core.HTTPClient.getGlobalPtr()
self.Undefined = Undefined
self.ConcreteStruct = ConcreteStruct
# This is per session.
self.nextScriptId = 0
# TODO: we need one of these per instance, not per session.
self.instanceId = None
# The root Panda3D install directory. This is filled in when
# the instance starts up.
self.rootDir = None
# The log directory. Also filled in when the instance starts.
self.logDirectory = None
# self.superMirrorUrl, if nonempty, is the "super mirror" URL
# that should be contacted first before trying the actual
# host. This is primarily used for "downloading" from a
# locally-stored Panda3D installation. This is also filled in
# when the instance starts up.
self.superMirrorUrl = None
# A list of the Panda3D packages that have been loaded.
self.installedPackages = []
# A list of the Panda3D packages that in the queue to be
# downloaded.
self.downloadingPackages = []
# A dictionary of HostInfo objects for the various download
# hosts we have imported packages from.
self.hosts = {}
# The altHost string that is in effect from the HTML tokens,
# if any, and the dictionary of URL remapping: orig host url
# -> alt host url.
self.altHost = None
self.altHostMap = {}
# The URL from which Panda itself should be downloaded.
self.pandaHostUrl = PandaSystem.getPackageHostUrl()
# Application code can assign a callable object here; if so,
# it will be invoked when an uncaught exception propagates to
# the top of the TaskMgr.run() loop.
self.exceptionHandler = None
# Managing packages for runtime download.
self.downloadingPackages = []
self.downloadTask = None
# The mount point for the multifile. For now, this is always
# the current working directory, for convenience; but when we
# move to multiple-instance sessions, it may have to be
# different for each instance.
self.multifileRoot = str(ExecutionEnvironment.getCwd())
# The "main" object will be exposed to the DOM as a property
# of the plugin object; that is, document.pluginobject.main in
# JavaScript will be appRunner.main here. This may be
# replaced with a direct reference to the JavaScript object
#.........这里部分代码省略.........