本文整理汇总了Python中fofix.core.Log.error方法的典型用法代码示例。如果您正苦于以下问题:Python Log.error方法的具体用法?Python Log.error怎么用?Python Log.error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.core.Log
的用法示例。
在下文中一共展示了Log.error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadVideo
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def loadVideo(self, libraryName, songName):
vidSource = None
if self.songStage == 1:
songBackgroundVideoPath = os.path.join(libraryName, songName, "background.ogv")
if os.path.isfile(songBackgroundVideoPath):
vidSource = songBackgroundVideoPath
loop = False
else:
Log.warn("Video not found: %s" % songBackgroundVideoPath)
if vidSource is None:
vidSource = os.path.join(self.pathfull, "default.ogv")
loop = True
if not os.path.isfile(vidSource):
Log.warn("Video not found: %s" % vidSource)
Log.warn("Falling back to default stage mode.")
self.mode = 1 # Fallback
return
try: # Catches invalid video files or unsupported formats
Log.debug("Attempting to load video: %s" % vidSource)
self.vidPlayer = VideoLayer(self.engine, vidSource,
mute = True, loop = loop)
self.engine.view.pushLayer(self.vidPlayer)
except (IOError, VideoPlayerError):
self.mode = 1
Log.error("Failed to load song video (falling back to default stage mode):")
示例2: getOptions
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def getOptions(self, section, option):
"""
Read the preset options of a configuration key.
@param section: Section name
@param option: Option name
@return: Tuple of Key list and Values list
"""
try:
options = self.prototype[section][option].options.values()
keys = self.prototype[section][option].options.keys()
type = self.prototype[section][option].type
except KeyError:
Log.error("Config key %s.%s not defined while reading %s." % (section, option, self.fileName))
raise
optionList = []
if type != None:
for i in range(len(options)):
value = _convertValue(keys[i], type)
optionList.append(value)
return optionList, options
示例3: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self, name = None, target = GL_TEXTURE_2D, useMipmaps = True):
# Delete all pending textures
try:
func, args = cleanupQueue[0]
del cleanupQueue[0]
func(*args)
except IndexError:
pass
except Exception, e: #MFH - to catch "did you call glewInit?" crashes
Log.error("Texture.py texture deletion exception: %s" % e)
示例4: keyPressed
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def keyPressed(self, key, unicode):
if key == pygame.K_LALT:
self.altStatus = True
elif key == pygame.K_RETURN and self.altStatus:
if not self.engine.toggleFullscreen():
Log.error("Unable to toggle fullscreen mode.")
return True
elif key == pygame.K_d and self.altStatus:
self.engine.setDebugModeEnabled(not self.engine.isDebugModeEnabled())
return True
elif key == pygame.K_g and self.altStatus and self.engine.isDebugModeEnabled():
self.engine.debugLayer.gcDump()
return True
示例5: getTipText
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def getTipText(self, section, option):
"""
Return the tip text for a configuration key.
@param section: Section name
@param option: Option name
@return: Tip Text String
"""
try:
text = self.prototype[section][option].tipText
except KeyError:
Log.error("Config key %s.%s not defined while reading %s." % (section, option, self.fileName))
raise
return text
示例6: getDefault
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def getDefault(self, section, option):
"""
Read the default value of a configuration key.
@param section: Section name
@param option: Option name
@return: Key value
"""
try:
type = self.prototype[section][option].type
default = self.prototype[section][option].default
except KeyError:
Log.error("Config key %s.%s not defined while reading %s." % (section, option, self.fileName))
raise
value = _convertValue(default, type)
return value
示例7: run
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def run(self):
# Perhapse this could be implemented in a better way...
# Play the intro video if it is present, we have the capability, and
# we are not in one-shot mode.
if not self.engine.cmdPlay:
themename = Config.get("coffee", "themename")
vidSource = os.path.join(Version.dataPath(), "themes", themename, "menu", "intro.ogv")
if os.path.isfile(vidSource):
try:
vidPlayer = VideoLayer(self.engine, vidSource, cancellable=True)
except (IOError, VideoPlayerError):
Log.error("Error loading intro video:")
else:
vidPlayer.play()
self.engine.view.pushLayer(vidPlayer)
self.videoLayer = True
self.engine.ticksAtStart = pygame.time.get_ticks()
while not vidPlayer.finished:
self.engine.run()
self.engine.view.popLayer(vidPlayer)
self.engine.view.pushLayer(MainMenu(self.engine))
if not self.videoLayer:
self.engine.setStartupLayer(MainMenu(self.engine))
# Run the main game loop.
try:
self.engine.ticksAtStart = pygame.time.get_ticks()
while self.engine.run():
pass
except KeyboardInterrupt:
Log.notice("Left mainloop due to KeyboardInterrupt.")
# don't reraise
# Restart the program if the engine is asking that we do so.
if self.engine.restartRequested:
self.restart()
# evilynux - MainMenu class already calls this - useless?
self.engine.quit()
示例8: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self, context, ImgData):
self.ImgData = None
self.texture = None
self.context = context
self.cache = None
self.filename = ImgData
# Detect the type of data passed in
if isinstance(ImgData, file):
self.ImgData = ImgData.read()
elif isinstance(ImgData, basestring):
self.texture = Texture(ImgData)
elif isinstance(ImgData, Image.Image): # stump: let a PIL image be passed in
self.texture = Texture()
self.texture.loadImage(ImgData)
# Make sure we have a valid texture
if not self.texture:
if isinstance(ImgData, basestring):
e = "Unable to load texture for %s." % ImgData
else:
e = "Unable to load texture for SVG file."
Log.error(e)
raise RuntimeError(e)
self.pixelSize = self.texture.pixelSize # the size of the image in pixels (from texture)
self.position = [0.0, 0.0] # position of the image in the viewport
self.scale = [1.0, 1.0] # percentage scaling
self.angle = 0 # angle of rotation (degrees)
self.color = (1.0, 1.0, 1.0, 1.0) # glColor rgba
self.rect = (0, 1, 0, 1) # texture mapping coordinates
self.shift = -0.5 # horizontal alignment
self.vshift = -0.5 # vertical alignment
self.path = self.texture.name # path of the image file
self.texArray = np.zeros((4, 2), dtype=np.float32)
self.createTex()
示例9: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self, name = None, target = GL_TEXTURE_2D, useMipmaps = True):
# Delete all pending textures
try:
func, args = cleanupQueue[0]
del cleanupQueue[0]
func(*args)
except IndexError:
pass
except Exception as e: #MFH - to catch "did you call glewInit?" crashes
Log.error("Texture.py texture deletion exception: %s" % e)
self.texture = glGenTextures(1)
self.texEnv = GL_MODULATE
self.glTarget = target
self.framebuffer = None
self.useMipmaps = useMipmaps
self.setDefaults()
self.name = name
if name:
self.loadFile(name)
示例10: set
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def set(self, section, option, value):
"""
Set the value of a configuration key.
@param section: Section name
@param option: Option name
@param value: Value name
"""
try:
prototype[section][option]
except KeyError:
Log.error("Config key %s.%s not defined while writing %s." % (section, option, self.fileName))
raise
if not self.config.has_section(section):
self.config.add_section(section)
self.config.set(section, option, utf8(value))
f = open(self.fileName, "w")
self.config.write(f, self.type)
f.close()
示例11: loadImgDrawing
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def loadImgDrawing(self, target, name, fileName, textureSize = None):
"""
Load an SVG drawing synchronously.
@param target: An object that will own the drawing
@param name: The name of the attribute the drawing will be assigned to
@param fileName: The name of the file in the data directory
@param textureSize: Either None or (x, y), in which case the file will
be rendered to an x by y texture
@return: L{ImgDrawing} instance
"""
imgDrawing = self.getImgDrawing(fileName)
if not imgDrawing:
if target and name:
setattr(target, name, None)
else:
Log.error("Image not found: " + fileName)
return None
if target:
drawing = self.resource.load(target, name, lambda: imgDrawing, synch = True)
else:
drawing = imgDrawing
return drawing
示例12: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self, engine, songName = None):
self.engine = engine
self.time = 0.0
self.offset = 0.5 # akedrou - this seems to fix the delay issue, but I'm not sure why. Return here!
self.speedDiv = 20000.0
self.speedDir = 1.0
self.doneList = []
self.themename = Config.get("coffee", "themename")
nf = self.engine.data.font
ns = 0.002
bs = 0.001
hs = 0.003
c1 = (1, 1, .5, 1)
c2 = (1, .75, 0, 1)
self.text_size = nf.getLineSpacing(scale = hs)
#akedrou - Translatable Strings:
self.bank = {}
self.bank['intro'] = [_("Frets on Fire X is a progression of MFH-mod,"),
_("which was built on Alarian's mod,"),
_("which was built on UltimateCoffee's Ultimate mod,"),
_("which was built on RogueF's RF_mod 4.15,"),
_("which was, of course, built on Frets on Fire 1.2.451,"),
_("which was created by Unreal Voodoo")]
self.bank['noOrder'] = [_("No particular order")]
self.bank['accessOrder']= [_("In order of project commit access")]
self.bank['coders'] = [_("Active Coders")]
self.bank['otherCoding']= [_("Programming")]
self.bank['graphics'] = [_("Graphic Design")]
self.bank['3d'] = [_("3D Textures")]
self.bank['logo'] = [_("FoFiX Logo Design")]
self.bank['hollowmind'] = [_("Hollowmind Necks")]
self.bank['themes'] = [_("Included Themes")]
self.bank['shaders'] = [_("Shaders")]
self.bank['sounds'] = [_("Sound Design")]
self.bank['translators']= [_("Translators")]
self.bank['honorary'] = [_("Honorary Credits")]
self.bank['codeHonor'] = [_("Without whom this game would not exist")]
self.bank['giveThanks'] = [_("Special Thanks to")]
self.bank['community'] = [_("nwru and all of the community at fretsonfire.net")]
self.bank['other'] = [_("Other Contributors:")]
self.bank['tutorial'] = [_("Jurgen FoF tutorial inspired by adam02"),
_("Drum test song tutorial by Heka"),
_("Drum Rolls practice tutorial by venom426")]
self.bank['disclaimer'] = [_("If you have contributed to this game and are not credited,"),
_("please let us know what and when you contributed.")]
self.bank['thanks'] = [_("Thank you for your contribution.")]
self.bank['oversight'] = [_("Please keep in mind that it is not easy to trace down and"),
_("credit every single person who contributed; if your name is"),
_("not included, it was not meant to slight you."),
_("It was an oversight.")]
# evilynux - Theme strings
self.bank['themeCreators'] = [_("%s theme credits:") % self.themename]
self.bank['themeThanks'] = [_("%s theme specific thanks:") % self.themename]
# Languages
self.bank['french'] = [_("French")]
self.bank['french90'] = [_("French (reform 1990)")]
self.bank['german'] = [_("German")]
self.bank['italian'] = [_("Italian")]
self.bank['piglatin'] = [_("Pig Latin")]
self.bank['portuguese-b'] = [_("Portuguese (Brazilian)")]
self.bank['russian'] = [_("Russian")]
self.bank['spanish'] = [_("Spanish")]
self.bank['swedish'] = [_("Swedish")]
self.videoLayer = False
self.background = None
vidSource = os.path.join(Version.dataPath(), 'themes', self.themename, \
'menu', 'credits.ogv')
if os.path.isfile(vidSource):
try:
self.vidPlayer = VideoLayer(self.engine, vidSource, mute = True, loop = True)
except (IOError, VideoPlayerError):
Log.error('Error loading credits video:')
else:
self.vidPlayer.play()
self.engine.view.pushLayer(self.vidPlayer)
self.videoLayer = True
if not self.videoLayer and \
not self.engine.loadImgDrawing(self, 'background', os.path.join('themes', self.themename, 'menu', 'credits.png')):
self.background = None
if not self.engine.loadImgDrawing(self, 'topLayer', os.path.join('themes', self.themename, 'menu', 'creditstop.png')):
self.topLayer = None
space = Text(nf, hs, c1, "center", " ")
self.credits = [
Picture(self.engine, "fofix_logo.png", .10),
Text(nf, ns, c1, "center", "%s" % Version.version()), space]
# evilynux: Main FoFiX credits (taken from CREDITS).
self.parseText("CREDITS")
self.credits.extend([space, space, space])
# evilynux: Theme credits (taken from data/themes/<theme name>/CREDITS).
self.parseText(os.path.join('data', 'themes', self.themename, 'CREDITS'))
self.credits.extend( [
#.........这里部分代码省略.........
示例13: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self, engine):
self.engine = engine
self.logClassInits = Config.get("game", "log_class_inits")
if self.logClassInits == 1:
Log.debug("MainMenu class init (MainMenu.py)...")
self.time = 0.0
self.nextLayer = None
self.visibility = 0.0
self.active = False
self.showStartupMessages = False
self.gfxVersionTag = Config.get("game", "gfx_version_tag")
self.chosenNeck = Config.get("game", "default_neck")
exists = 0
if engine.loadImgDrawing(self, "ok", os.path.join("necks",self.chosenNeck+".png")):
exists = 1
elif engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_"+self.chosenNeck+".png")):
exists = 1
#MFH - fallback logic now supports a couple valid default neck filenames
#MFH - check for Neck_1
if exists == 0:
if engine.loadImgDrawing(self, "ok", os.path.join("necks","Neck_1.png")):
Config.set("game", "default_neck", "1")
Log.warn("Default chosen neck not valid; fallback Neck_1.png forced.")
exists = 1
#MFH - check for defaultneck
if exists == 0:
if engine.loadImgDrawing(self, "ok", os.path.join("necks","defaultneck.png")):
Log.warn("Default chosen neck not valid; fallback defaultneck.png forced.")
Config.set("game", "default_neck", "defaultneck")
exists = 1
else:
Log.error("Default chosen neck not valid; fallbacks Neck_1.png and defaultneck.png also not valid!")
#Get theme
self.theme = self.engine.data.theme
self.themeCoOp = self.engine.data.themeCoOp
self.themename = self.engine.data.themeLabel
self.useSoloMenu = self.engine.theme.use_solo_submenu
allowMic = True
self.menux = self.engine.theme.menuPos[0]
self.menuy = self.engine.theme.menuPos[1]
self.rbmenu = self.engine.theme.menuRB
#MFH
self.main_menu_scale = self.engine.theme.main_menu_scaleVar
self.main_menu_vspacing = self.engine.theme.main_menu_vspacingVar
if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"menu","mainbg.png")):
self.background = None
self.engine.loadImgDrawing(self, "BGText", os.path.join("themes",self.themename,"menu","maintext.png"))
self.engine.loadImgDrawing(self, "optionsBG", os.path.join("themes",self.themename,"menu","optionsbg.png"))
self.engine.loadImgDrawing(self, "optionsPanel", os.path.join("themes",self.themename,"menu","optionspanel.png"))
#racer: added version tag
if self.gfxVersionTag or self.engine.theme.versiontag:
if not self.engine.loadImgDrawing(self, "version", os.path.join("themes",self.themename,"menu","versiontag.png")):
if not self.engine.loadImgDrawing(self, "version", "versiontag.png"): #falls back on default versiontag.png in data\ folder
self.version = None
else:
self.version = None
#myfingershurt: random main menu music function, menu.ogg and menuXX.ogg (any filename with "menu" as the first 4 letters)
self.files = None
filepath = self.engine.getPath(os.path.join("themes",self.themename,"sounds"))
if os.path.isdir(filepath):
self.files = []
allfiles = os.listdir(filepath)
for name in allfiles:
if os.path.splitext(name)[1] == ".ogg":
if string.find(name,"menu") > -1:
self.files.append(name)
if self.files:
i = random.randint(0,len(self.files)-1)
filename = self.files[i]
sound = os.path.join("themes",self.themename,"sounds",filename)
self.menumusic = True
engine.menuMusic = True
self.song = Audio.Music(self.engine.resource.fileName(sound))
self.song.setVolume(self.engine.config.get("audio", "menu_volume"))
self.song.play(0) #no loop
else:
self.menumusic = False
self.opt_text_color = self.engine.theme.opt_text_colorVar
self.opt_selected_color = self.engine.theme.opt_selected_colorVar
#.........这里部分代码省略.........
示例14: len
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
##Alarian: Get unlimited themes by foldername
themepath = os.path.join(Version.dataPath(), "themes")
themes = []
defaultTheme = None #myfingershurt
allthemes = os.listdir(themepath)
for name in allthemes:
if os.path.exists(os.path.join(themepath,name,"notes","notes.png")):
themes.append(name)
if name == "MegaLight V4":
defaultTheme = name
i = len(themes)
if i == 0:
if os.name == 'posix':
Log.error("No valid theme found!\n" +
"Make sure theme files are properly cased " +
"e.g. notes.png works, Notes.png doesn't\n")
else:
Log.error("No valid theme found!")
sys.exit(1)
if defaultTheme is None:
defaultTheme = themes[0] #myfingershurt
#myfingershurt: default theme must be an existing one!
Config.define("coffee", "themename", str, defaultTheme, text = _("Theme"), options = dict([(str(themes[n]),themes[n]) for n in range(0, i)]), tipText = _("Sets the overall graphical feel of the game. You can find and download many more at fretsonfire.net"))
##Alarian: End Get unlimited themes by foldername
Player.loadControls()
示例15: __init__
# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import error [as 别名]
def __init__(self):
self.logClassInits = Config.get("game", "log_class_inits")
if self.logClassInits == 1:
Log.debug("Input class init (Input.py)...")
Task.__init__(self)
self.mouse = pygame.mouse
self.mouseListeners = []
self.keyListeners = []
self.systemListeners = []
self.priorityKeyListeners = []
self.controls = Controls()
self.activeGameControls = []
self.p2Nav = self.controls.p2Nav
self.type1 = self.controls.type[0]
self.keyCheckerMode = Config.get("game","key_checker_mode")
self.disableKeyRepeat()
self.gameGuitars = 0
self.gameDrums = 0
self.gameMics = 0
self.gameBots = 0
# Initialize joysticks
pygame.joystick.init()
self.joystickNames = {}
self.joystickAxes = {}
self.joystickHats = {}
self.joysticks = [pygame.joystick.Joystick(id) for id in range(pygame.joystick.get_count())]
for j in self.joysticks:
j.init()
self.joystickNames[j.get_id()] = j.get_name()
self.joystickAxes[j.get_id()] = [0] * j.get_numaxes()
self.joystickHats[j.get_id()] = [(0, 0)] * j.get_numhats()
Log.debug("%d joysticks found." % len(self.joysticks))
# Enable music events
Audio.Music.setEndEvent(MusicFinished)
#Audio.Music.setEndEvent() #MFH - no event required?
# Custom key names
self.getSystemKeyName = pygame.key.name
pygame.key.name = self.getKeyName
self.midi = []
if haveMidi:
pygame.midi.init()
for i in range(pygame.midi.get_count()):
interface, name, is_input, is_output, is_opened = pygame.midi.get_device_info(i)
Log.debug("Found MIDI device: %s on %s" % (name, interface))
if not is_input:
Log.debug("MIDI device is not an input device.")
continue
try:
self.midi.append(pygame.midi.Input(i))
Log.debug("Device opened as device number %d." % len(self.midi))
except pygame.midi.MidiException:
Log.error("Error opening device for input.")
if len(self.midi) == 0:
Log.debug("No MIDI input ports found.")
else:
Log.notice("MIDI input support is not available; install at least pygame 1.9 to get it.")