def setDconfigLevel(self, categoryName): from panda3d.core import ConfigVariableString dconfigParam = 'notify-level-' + categoryName cvar = ConfigVariableString(dconfigParam, '') level = cvar.getValue() if not level: cvar2 = ConfigVariableString('default-directnotify-level', 'info') level = cvar2.getValue() if not level: level = 'error' category = self.getCategory(categoryName) if level == 'error': category.setWarning(0) category.setInfo(0) category.setDebug(0) else: if level == 'warning': category.setWarning(1) category.setInfo(0) category.setDebug(0) else: if level == 'info': category.setWarning(1) category.setInfo(1) category.setDebug(0) else: if level == 'debug': category.setWarning(1) category.setInfo(1) category.setDebug(1) else: print 'DirectNotify: unknown notify level: ' + str( level) + ' for category: ' + str(categoryName)
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 config is set. """ # We use ConfigVariableString instead of base.config, in case # we're running before ShowBase has finished initializing; and # we import it directly from libpandaexpress, in case we're # running before libpanda.dll is available. from panda3d.core import ConfigVariableString dconfigParam = ("notify-level-" + categoryName) cvar = ConfigVariableString(dconfigParam, "") level = cvar.getValue() if not level: # see if there's an override of the default config level cvar2 = ConfigVariableString('default-directnotify-level', 'info') level = cvar2.getValue() if not level: level = 'error' category = self.getCategory(categoryName) # Note - this print statement is making it difficult to # achieve "no output unless there's an error" operation - Josh # print ("Setting DirectNotify category: " + categoryName + # " to severity: " + level) 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 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 config is set. """ # We use ConfigVariableString instead of base.config, in case # we're running before ShowBase has finished initializing from panda3d.core import ConfigVariableString dconfigParam = ("notify-level-" + categoryName) cvar = ConfigVariableString(dconfigParam, "") level = cvar.getValue() if not level: # see if there's an override of the default config level cvar2 = ConfigVariableString('default-directnotify-level', 'info') level = cvar2.getValue() if not level: level = 'error' category = self.getCategory(categoryName) # Note - this print statement is making it difficult to # achieve "no output unless there's an error" operation - Josh # print ("Setting DirectNotify category: " + categoryName + # " to severity: " + level) 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))
# ConfigVariableManager.getGlobalPtr().listVariables() import sys from panda3d.core import ConfigVariableString, ConfigVariableManager my_game_server = ConfigVariableString('my-game-server', '127.0.0.1') print('Server specified in config file: ', my_game_server.getValue()) # Allow the user to change servers on the command-line if sys.argv[1] == '--server': my_game_server.setValue(sys.argv[2]) # end if print('Server that we will user: ', my_game_server.getValue()) print(ConfigVariableString("my-game-server")) cvMgr = ConfigVariableManager.get_global_ptr() cvMgr.list_variables()
import sys from panda3d.core import ConfigVariableString, loadPrcFile, loadPrcFileData, ConfigVariableManager config = loadPrcFile("Config.prc") loadPrcFileData('', 'fullscreen true') myGameServer = ConfigVariableString('my-game-server', '127.0.0.1') print('Server specified in config file: ', myGameServer.getValue()) cvMgr = config.getGlobalPtr() cvMgr.listVariables()
from panda3d.core import ConfigVariableString from direct.directnotify.DirectNotify import DirectNotify language = ConfigVariableString('language', 'English') language = language.getValue() notify = DirectNotify().newCategory("OTPLocalizer") def getLanguage(): return language _languageModule = 'otp.otpbase.OTPLocalizer' + language try: exec 'from ' + _languageModule + ' import *' print ":OTPLocalizer: Running in language: %s" % language except: notify.warning("Error, Language %s not found!" % language) notify.warning("Setting language to default (English)") from otp.otpbase.OTPLocalizerEnglish import *