本文整理汇总了Python中fofix.core.Log类的典型用法代码示例。如果您正苦于以下问题:Python Log类的具体用法?Python Log怎么用?Python Log使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: disableScreensaver
def disableScreensaver(self):
if os.name == 'nt':
# See the DisableScreensaver and RestoreScreensaver functions in
# modules/video_output/msw/common.c in the source code for VLC.
import win32gui
import win32con
import atexit
Log.debug('Disabling screensaver.')
old_lowpowertimeout = win32gui.SystemParametersInfo(win32con.SPI_GETLOWPOWERTIMEOUT)
if old_lowpowertimeout != 0:
atexit.register(lambda: win32gui.SystemParametersInfo(win32con.SPI_SETLOWPOWERTIMEOUT, old_lowpowertimeout))
win32gui.SystemParametersInfo(win32con.SPI_SETLOWPOWERTIMEOUT, 0)
old_powerofftimeout = win32gui.SystemParametersInfo(win32con.SPI_GETPOWEROFFTIMEOUT)
if old_powerofftimeout != 0:
atexit.register(lambda: win32gui.SystemParametersInfo(win32con.SPI_SETPOWEROFFTIMEOUT, old_powerofftimeout))
win32gui.SystemParametersInfo(win32con.SPI_SETPOWEROFFTIMEOUT, 0)
old_screensavetimeout = win32gui.SystemParametersInfo(win32con.SPI_GETSCREENSAVETIMEOUT)
if old_screensavetimeout != 0:
atexit.register(lambda: win32gui.SystemParametersInfo(win32con.SPI_SETSCREENSAVETIMEOUT, old_screensavetimeout))
win32gui.SystemParametersInfo(win32con.SPI_SETSCREENSAVETIMEOUT, 0)
else:
Log.debug('Screensaver disabling is not implemented on this platform.')
示例2: __init__
def __init__(self, engine, controlnum, samprate=44100):
Task.__init__(self)
self.engine = engine
self.controlnum = controlnum
devnum = self.engine.input.controls.micDevice[controlnum]
if devnum == -1:
devnum = None
self.devname = pa.get_default_input_device_info()['name']
else:
self.devname = pa.get_device_info_by_index(devnum)['name']
self.mic = pa.open(samprate, 1, pyaudio.paFloat32, input=True, input_device_index=devnum, start=False)
self.analyzer = pypitch.Analyzer(samprate)
self.mic_started = False
self.lastPeak = 0
self.detectTaps = True
self.tapStatus = False
self.tapThreshold = -self.engine.input.controls.micTapSensitivity[controlnum]
self.passthroughQueue = []
passthroughVolume = self.engine.input.controls.micPassthroughVolume[controlnum]
if passthroughVolume > 0.0:
Log.debug('Microphone: creating passthrough stream at %d%% volume' % round(passthroughVolume * 100))
self.passthroughStream = Audio.MicrophonePassthroughStream(engine, self)
self.passthroughStream.setVolume(passthroughVolume)
else:
Log.debug('Microphone: not creating passthrough stream')
self.passthroughStream = None
示例3: popLayer
def popLayer(self, layer):
Log.debug("View: Pop: %s" % layer.__class__.__name__)
if layer in self.incoming:
self.incoming.remove(layer)
if layer in self.layers and layer not in self.outgoing:
self.outgoing.append(layer)
示例4: keyName
def keyName(value):
if value in CONTROL1:
name = "Controller 1"
control = CONTROL1
n = 0
elif value in CONTROL2:
name = "Controller 2"
control = CONTROL2
n = 1
elif value in CONTROL3:
name = "Controller 3"
control = CONTROL3
n = 2
else:
name = "Controller 4"
control = CONTROL4
n = 3
for j in range(20):
if value == control[j]:
if self.type[n] == 2:
return name + " " + drumkey4names[j]
elif self.type[n] == 3:
return name + " " + drumkey5names[j]
else:
return name + " " + guitarkeynames[j]
else:
Log.notice("Key value not found.")
return "Error"
示例5: loadVideo
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):")
示例6: getOptions
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
示例7: getAvailableMods
def getAvailableMods(engine):
modPath = _getModPath(engine)
try:
dirList = os.listdir(modPath)
except OSError:
Log.warn("Could not find mods directory")
return []
return [m for m in dirList if os.path.isdir(os.path.join(modPath, m)) and not m.startswith(".")]
示例8: finishGame
def finishGame(self):
if not self.world:
Log.notice("GameEngine.finishGame called before World created.")
return
self.world.finishGame()
self.world = None
self.gameStarted = False
self.view.pushLayer(self.mainMenu)
示例9: __init__
def __init__(self, guitarScene, configFileName, coOp = False):
self.scene = guitarScene
self.engine = guitarScene.engine
self.layers = {} #collection of all the layers in the rockmeter
self.layersForRender = {} #collection of layers that are rendered separate from any group
self.layerGroups = {} #collection of layer groups
self.sharedLayerGroups = {}
self.sharedLayers = {} #these layers are for coOp use only
self.sharedLayersForRender = {}
self.sharedGroups = {}
self.coOp = coOp
self.config = LinedConfigParser()
self.config.read(configFileName)
self.themename = self.engine.data.themeLabel
try:
themepath = os.path.join(Version.dataPath(), "themes", self.themename)
fp, pathname, description = imp.find_module("CustomRMLayers",[themepath])
self.customRMLayers = imp.load_module("CustomRMLayers", fp, pathname, description)
except ImportError:
self.customRMLayers = None
Log.notice("Custom Rockmeter layers are not available")
# Build the layers
for i in range(Rockmeter._layerLimit):
types = [
"Image",
"Text",
"Circle",
"Custom"
]
for t in types:
self.section = "layer%d:%s" % (i, t)
if not self.config.has_section(self.section):
continue
else:
if t == types[1]:
self.createFont(self.section, i)
elif t == types[2]:
self.createCircle(self.section, i)
elif t == types[3]:
self.createCustom(self.section, i)
else:
self.createImage(self.section, i)
break
for i in range(Rockmeter._groupLimit):
self.section = "Group%d" % i
if not self.config.has_section(self.section):
continue
else:
self.createGroup(self.section, i)
self.reset()
示例10: start
def start(self):
if not self.mic_started:
self.mic_started = True
self.mic.start_stream()
self.engine.addTask(self, synchronized=False)
Log.debug('Microphone: started %s' % self.devname)
if self.passthroughStream is not None:
Log.debug('Microphone: starting passthrough stream')
self.passthroughStream.play()
示例11: stop
def stop(self):
if self.mic_started:
if self.passthroughStream is not None:
Log.debug('Microphone: stopping passthrough stream')
self.passthroughStream.stop()
self.engine.removeTask(self)
self.mic.stop_stream()
self.mic_started = False
Log.debug('Microphone: stopped %s' % self.devname)
示例12: getSoundObjectList
def getSoundObjectList(self, soundPath, soundPrefix, numSounds, soundExtension = ".ogg"): #MFH
Log.debug("{0}1{2} - {0}{1}{2} found in {3}".format(soundPrefix, numSounds, soundExtension, soundPath))
sounds = []
for i in xrange(1, numSounds+1):
filePath = os.path.join(soundPath, "%s%d%s" % (soundPrefix, i, soundExtension) )
soundObject = Sound(self.resource.fileName(filePath))
sounds.append(soundObject)
return sounds
示例13: __init__
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)
示例14: loadLibrary
def loadLibrary(self):
Log.debug("Loading libraries in %s" % self.library)
self.loaded = False
self.tiersPresent = False
if self.splash:
Dialogs.changeLoadingSplashScreenText(self.engine, self.splash, _("Browsing Collection..."))
else:
self.splash = Dialogs.showLoadingSplashScreen(self.engine, _("Browsing Collection..."))
self.loadStartTime = time.time()
self.engine.resource.load(self, "libraries", lambda: Song.getAvailableLibraries(self.engine, self.library), onLoad = self.loadSongs, synch = True)
示例15: showTutorial
def showTutorial(self):
# evilynux - Make sure tutorial exists before launching
tutorialpath = self.engine.tutorialFolder
if not os.path.isdir(self.engine.resource.fileName(tutorialpath)):
Log.debug("No folder found: %s" % tutorialpath)
Dialogs.showMessage(self.engine, _("No tutorials found!"))
return
self.engine.startWorld(1, None, 0, 0, tutorial = True)
self.launchLayer(lambda: Lobby(self.engine))