当前位置: 首页>>代码示例>>Python>>正文


Python Log.notice方法代码示例

本文整理汇总了Python中fofix.core.Log.notice方法的典型用法代码示例。如果您正苦于以下问题:Python Log.notice方法的具体用法?Python Log.notice怎么用?Python Log.notice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在fofix.core.Log的用法示例。


在下文中一共展示了Log.notice方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: keyName

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
 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"
开发者ID:Linkid,项目名称:fofix,代码行数:30,代码来源:Player.py

示例2: finishGame

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
 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)
开发者ID:GabrieleNunez,项目名称:fofix,代码行数:10,代码来源:GameEngine.py

示例3: __init__

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
    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()
开发者ID:Wolferacing,项目名称:fofix,代码行数:60,代码来源:Rockmeter.py

示例4: load

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
    def load(self, target = None, name = None, function = lambda: None, synch = False, onLoad = None, onCancel = None):

        if self.logLoadings == 1:
            Log.notice("Loading %s.%s %s" % (target.__class__.__name__, name, synch and "synchronously" or "asynchronously"))

        l = Loader(target, name, function, self.resultQueue, self.loaderSemaphore, onLoad = onLoad, onCancel = onCancel)
        if synch:
            l.load()
            return l.finish()
        else:
            self.loaders.append(l)
            l.start()
            return l
开发者ID:Linkid,项目名称:fofix,代码行数:15,代码来源:Resource.py

示例5: fileName

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
    def fileName(self, *name, **args):

        #myfingershurt: the following should be global, and only done at startup.  Not every damn time a file is loaded.
        songPath = self.songPath

        if not args.get("writable", False):
            for dataPath in self.dataPaths + songPath:
                readOnlyPath = os.path.join(dataPath, *name)
                # If the requested file is in the read-write path and not in the
                # read-only path, use the existing read-write one.
                if os.path.isfile(readOnlyPath):
                    return readOnlyPath
                elif os.path.isdir(readOnlyPath):
                    return readOnlyPath
                readWritePath = os.path.join(getWritableResourcePath(), *name)
                if os.path.isfile(readWritePath):
                    return readWritePath
            return readOnlyPath
        else:
            for dataPath in [self.dataPaths[-1]] + songPath:
                readOnlyPath = os.path.join(dataPath, *name)
                if not (os.path.isfile(readOnlyPath) or os.path.isdir(readOnlyPath)):
                    continue
                try:
                    # First see if we can write to the original file
                    if os.access(readOnlyPath, os.W_OK):
                        return readOnlyPath
                    # If the original file does not exist, see if we can write to its directory
                    if not os.path.isfile(readOnlyPath) and os.access(os.path.dirname(readOnlyPath), os.W_OK):
                        pass
                except:
                    raise
                # If the resource exists in the read-only path, make a copy to the
                # read-write path.
                readWritePath = os.path.join(getWritableResourcePath(), *name)
                if not os.path.isfile(readWritePath) and os.path.isfile(readOnlyPath):
                    Log.notice("Copying '%s' to writable data directory." % "/".join(name))
                    try:
                        os.makedirs(os.path.dirname(readWritePath))
                    except:
                        pass
                    shutil.copy(readOnlyPath, readWritePath)
                    self.makeWritable(readWritePath)
                # Create directories if needed
                if not os.path.isdir(readWritePath) and os.path.isdir(readOnlyPath):
                    Log.notice("Creating writable directory '%s'." % "/".join(name))
                    os.makedirs(readWritePath)
                    self.makeWritable(readWritePath)
                return readWritePath
            return readOnlyPath
开发者ID:Linkid,项目名称:fofix,代码行数:52,代码来源:Resource.py

示例6: finish

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
    def finish(self):
        if self.canceled:
            if self.onCancel:
                self.onCancel()
            return

        if self.logLoadings == 1:
            Log.notice("Loaded %s.%s in %.3f seconds" % (self.target.__class__.__name__, self.name, self.time))

        if self.exception:
            raise self.exception[0], self.exception[1], self.exception[2]
        if self.target and self.name:
            setattr(self.target, self.name, self.result)
        if self.onLoad:
            self.onLoad(self.result)
        return self.result
开发者ID:Linkid,项目名称:fofix,代码行数:18,代码来源:Resource.py

示例7: run

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
 def run(self, ticks):
     while self.mic.get_read_available() > 1024:
         try:
             chunk = self.mic.read(1024)
         except IOError as e:
             if e.args[1] == pyaudio.paInputOverflowed:
                 Log.notice('Microphone: ignoring input buffer overflow')
                 chunk = '\x00' * 4096
             else:
                 raise
         if self.passthroughStream is not None:
             self.passthroughQueue.append(chunk)
         self.analyzer.input(np.frombuffer(chunk, dtype=np.float32))
         self.analyzer.process()
         pk = self.analyzer.getPeak()
         if self.detectTaps:
             if pk > self.tapThreshold and pk > self.lastPeak + 5.0:
                 self.tapStatus = True
         self.lastPeak = pk
开发者ID:Linkid,项目名称:fofix,代码行数:21,代码来源:Microphone.py

示例8: run

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [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()
开发者ID:Linkid,项目名称:fofix,代码行数:42,代码来源:FoFiX.py

示例9: getImgDrawing

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
 def getImgDrawing(self, fileName, openImage=True):
     imgDrawing = None
     for dataPath in self.resource.dataPaths:
         fileName1 = os.path.join(dataPath, fileName)
         if self.logLoadings == 1:
             if openImage:
                 Log.notice("Trying to load image: %s" % fileName1)
             else:
                 Log.notice("Checking image: %s" % fileName1)
         #check if fileName1 exists (has extension)
         if os.path.exists(fileName1):
             if openImage == True:
                 try:
                     imgDrawing = ImgDrawing(self.svg, fileName1)
                     return imgDrawing
                 except IOError:
                     Log.warn("Unable to load image file: %s" % fileName1)
                 except OverflowError:
                     Log.warn("Unable to read image file: %s" % fileName1)
             else:
                 return True
         else:
             #find extension
             fileName1 = os.path.splitext(fileName1)[0]
             files = glob.glob('%s.*' % fileName1)
             if openImage == True:
                 for i in range(len(files)):
                     try:
                         imgDrawing = ImgDrawing(self.svg, files[i])
                         return imgDrawing
                     except IOError:
                         Log.warn("Unable to load image file: %s" % files[i])
             elif len(files) > 0:
                 return True
     #image not found
     if self.logImageNotFound:
         Log.debug("Image not found: %s" % fileName)
     return False
开发者ID:ajs124,项目名称:fofix,代码行数:40,代码来源:Data.py

示例10: __init__

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [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.")
开发者ID:Linkid,项目名称:fofix,代码行数:66,代码来源:Input.py

示例11: restart

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
 def restart(self):
     Log.notice("Restarting.")
     self.engine.audio.close()
     self.restartRequested = True
开发者ID:Linkid,项目名称:fofix,代码行数:6,代码来源:FoFiX.py

示例12: load

# 需要导入模块: from fofix.core import Log [as 别名]
# 或者: from fofix.core.Log import notice [as 别名]
    def load(self, libraryName, songName, practiceMode = False):
        if self.scene.coOpType:
            rm = os.path.join("themes", self.themename, "rockmeter_coop.ini")
        elif self.scene.battle or self.scene.battleGH:
            rm = os.path.join("themes", self.themename, "rockmeter_profaceoff.ini")
        elif self.scene.gamePlayers > 1:
            rm = os.path.join("themes", self.themename, "rockmeter_faceoff.ini")
        else:
            rm = os.path.join("themes", self.themename, "rockmeter.ini")

        if os.path.exists(os.path.join("..", "data", rm)):
            rockmeter = self.engine.resource.fileName(rm)
        else:
            rockmeter = self.engine.resource.fileName(os.path.join("themes", self.themename, "rockmeter.ini"))

        self.rockmeter = Rockmeter.Rockmeter(self.scene, rockmeter, self.scene.coOpType)

        # evilynux - Fixes a self.background not defined crash
        self.background = None
        #MFH - new background stage logic:
        if self.mode == 2:   #blank / no stage
            self.songStage = 0
            self.rotationMode = 0
        elif practiceMode:   #check for existing practice stage; always disable stage rotation here
            self.songStage = 0
            self.rotationMode = 0
            self.mode = 1
            #separated practice stages for the instruments by k.i.d
            if self.scene.instruments[0].isDrum:
                background = "practicedrum"
            elif self.scene.instruments[0].isBassGuitar:
                background = "practicebass"
            else:
                background = "practice"
            if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"backgrounds",background)):
                #MFH - must first fall back on the old practice.png before forcing blank stage mode!
                if not self.engine.loadImgDrawing(self, "background", os.path.join("themes",self.themename,"backgrounds","practice")):
                    Log.warn("No practice stage, falling back on a forced Blank stage mode") # evilynux
                    self.mode = 2    #if no practice stage, just fall back on a forced Blank stage mode

        elif self.songStage == 1:    #check for song-specific background
            test = True
            if not self.engine.loadImgDrawing(self, "background", os.path.join(libraryName, songName, "background")):
                Log.notice("No song-specific stage found") # evilynux
                test = False
            if test:  #does a song-specific background exist?
                self.rotationMode = 0
                self.mode = 1
            else:
                self.songStage = 0

        #MFH - now, after the above logic, we can run the normal stage mode logic
        #      only worrying about checking for Blank, song-specific and
        #      practice stage modes
        if self.mode != 2 and self.mode != 3 and self.songStage == 0 and not practiceMode: #still need to load stage(s)
            #myfingershurt: assign this first
            if self.mode == 1:   #just use Default.png
                if not self.engine.loadImgDrawing(self, "background", os.path.join(self.path, "default")):
                    Log.warn("No default stage; falling back on a forced Blank stage mode") # evilynux
                    self.mode = 2    #if no practice stage, just fall back on a forced Blank stage mode

            ##This checks how many Stage-background we have to select from
            if self.mode == 0 and self.rotationMode == 0:  #MFH: just display a random stage
                files = []
                fileIndex = 0
                allfiles = os.listdir(self.pathfull)
                for name in allfiles:
                    if os.path.splitext(name)[0].lower() != "practice" and os.path.splitext(name)[0].lower() != "practicedrum" and os.path.splitext(name)[0].lower() != "practicebass" and name != ".svn":
                        Log.debug("Valid background found, index (" + str(fileIndex) + "): " + name)
                        files.append(name)
                        fileIndex += 1
                    else:
                        Log.debug("Practice background filtered: " + name)

                # evilynux - improved error handling, fallback to blank background if no background are found
                if fileIndex == 0:
                    Log.warn("No valid stage found!")
                    self.mode = 2;
                else:
                    i = random.randint(0,len(files)-1)
                    filename = files[i]
            ##End check number of Stage-backgrounds
                    if not self.engine.loadImgDrawing(self, "background", os.path.join(self.path, filename)):
                        self.mode = 2;

            elif self.rotationMode > 0 and self.mode != 2:
                files = []
                fileIndex = 0

                if self.animatedFolder == "Random": #Select one of the subfolders under stages\ to animate randomly
                    numAniStageFolders = len(self.engine.stageFolders)
                    if numAniStageFolders > 0:
                        self.animatedFolder = random.choice(self.engine.stageFolders)
                    else:
                        self.animatedFolder = "Normal"

                elif self.animatedFolder == "None":
                    self.mode = 2

                if self.animatedFolder != "Normal" and self.mode != 2: #just use the base Stages folder for rotation
#.........这里部分代码省略.........
开发者ID:ajs124,项目名称:fofix,代码行数:103,代码来源:Stage.py


注:本文中的fofix.core.Log.notice方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。