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


Python core.Config类代码示例

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


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

示例1: SetAllSoundFxObjectVolumes

 def SetAllSoundFxObjectVolumes(self, volume = None):   #MFH - single function to go through all sound objects (and iterate through all sound lists) and set object volume to the given volume
     #MFH TODO - set every sound object's volume here...
     if volume is None:
         self.sfxVolume = Config.get("audio", "SFX_volume")
         self.crowdVolume = Config.get("audio", "crowd_volume")
         volume = self.sfxVolume
     self.starDingSound.setVolume(volume)
     self.bassDrumSound.setVolume(volume)
     self.T1DrumSound.setVolume(volume)
     self.T2DrumSound.setVolume(volume)
     self.T3DrumSound.setVolume(volume)
     self.CDrumSound.setVolume(volume)
     for s in self.acceptSounds:
         s.setVolume(volume)
     for s in self.cancelSounds:
         s.setVolume(volume)
     self.rockSound.setVolume(volume)
     self.starDeActivateSound.setVolume(volume)
     self.starActivateSound.setVolume(volume)
     self.battleUsedSound.setVolume(volume)
     self.rescueSound.setVolume(volume)
     self.coOpFailSound.setVolume(volume)
     self.crowdSound.setVolume(self.crowdVolume)
     self.starReadySound.setVolume(volume)
     self.clapSound.setVolume(volume)
     self.failSound.setVolume(volume)
     self.starSound.setVolume(volume)
     self.startSound.setVolume(volume)
     self.selectSound1.setVolume(volume)
     self.selectSound2.setVolume(volume)
     self.selectSound3.setVolume(volume)
开发者ID:ajs124,项目名称:fofix,代码行数:31,代码来源:Data.py

示例2: init

def init(engine):
    # define configuration keys for all available mods
    for m in getAvailableMods(engine):
        Config.define("mods", "mod_" + m, bool, False, text = m,  options = {False: _("Off"), True: _("On")})

    # init all active mods
    for m in getActiveMods(engine):
        activateMod(engine, m)
开发者ID:fofix,项目名称:fofix,代码行数:8,代码来源:Mod.py

示例3: init_oneshot

    def init_oneshot(self):
        """ Determine if oneshot mode is valid. """
        # I think this code can be moved elsewhere...
        self.engine.cmdPlay = 0

        # Check for a valid invocation of one-shot mode.
        if self.playing is not None:
            Log.debug("Validating song directory for one-shot mode.")

            library = Config.get("setlist", "base_library")
            basefolder = os.path.join(Version.dataPath(), library, "songs", self.playing)

            if not os.path.exists(os.path.join(basefolder, "song.ini")):

                if not (
                    os.path.exists(os.path.join(basefolder, "notes.mid"))
                    or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))
                ):

                    if not (
                        os.path.exists(os.path.join(basefolder, "song.ogg"))
                        or os.path.exists(os.path.join(basefolder, "guitar.ogg"))
                    ):

                        Log.warn(
                            "Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
                            % self.playing
                        )
                        self.engine.startupMessages.append(
                            _(
                                "Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode."
                            )
                            % self.playing
                        )
                        return

            # Set up one-shot mode
            Log.debug("Entering one-shot mode.")
            Config.set("setlist", "selected_song", playing)

            self.engine.cmdPlay = 1

            if diff is not None:
                self.engine.cmdDiff = int(diff)
            if part is not None:
                self.engine.cmdPart = int(part)

            if players == 1:
                self.engine.cmdMode = players, mode, 0
            else:
                self.engine.cmdMode = players, 0, mode
开发者ID:Linkid,项目名称:fofix,代码行数:51,代码来源:FoFiX.py

示例4: loadControls

def loadControls():
    global controllerDict
    controllers = []
    allcontrollers = VFS.listdir(controlpath)
    default = ["defaultd.ini", "defaultg.ini", "defaultm.ini"]
    for name in allcontrollers:
        if name.lower().endswith(".ini") and len(name) > 4:
            if name in default:
                continue
            controllers.append(name[0:len(name)-4])

    i = len(controllers)
    controllerDict = dict([(str(controllers[n]),controllers[n]) for n in range(0, i)])
    controllerDict["defaultg"] = _("Default Guitar")
    controllerDict["defaultd"] = _("Default Drum")
    defMic = None
    if Microphone.supported:
        controllerDict["defaultm"] = _("Default Microphone")
        defMic = "defaultm"
    tsControl    = _("Controller %d")
    tsControlTip = _("Select the controller for slot %d")
    i = 1
    Config.define("game", "control0",           str,   "defaultg", text = tsControl % 1,                options = controllerDict, tipText = tsControlTip % 1)

    controllerDict[_("None")] = None

    Config.define("game", "control1",           str,   "defaultd", text = tsControl % 2,                options = controllerDict, tipText = tsControlTip % 2)
    Config.define("game", "control2",           str,   defMic,     text = tsControl % 3,                options = controllerDict, tipText = tsControlTip % 3)
    Config.define("game", "control3",           str,   None,       text = tsControl % 4,                options = controllerDict, tipText = tsControlTip % 4)
开发者ID:htvu,项目名称:fofix,代码行数:29,代码来源:Player.py

示例5: setPriority

    def setPriority(self, pid = None, priority = 2):
        """ Set The Priority of a Windows Process.  Priority is a value between 0-5 where
            2 is normal priority.  Default sets the priority of the current
            python process but can take any valid process ID. """

        import win32api, win32process, win32con

        priorityClasses = [win32process.IDLE_PRIORITY_CLASS,
                           win32process.BELOW_NORMAL_PRIORITY_CLASS,
                           win32process.NORMAL_PRIORITY_CLASS,
                           win32process.ABOVE_NORMAL_PRIORITY_CLASS,
                           win32process.HIGH_PRIORITY_CLASS,
                           win32process.REALTIME_PRIORITY_CLASS]

        threadPriorities = [win32process.THREAD_PRIORITY_IDLE,
                            #win32process.THREAD_PRIORITY_ABOVE_IDLE,
                            #win32process.THREAD_PRIORITY_LOWEST,
                            win32process.THREAD_PRIORITY_BELOW_NORMAL,
                            win32process.THREAD_PRIORITY_NORMAL,
                            win32process.THREAD_PRIORITY_ABOVE_NORMAL,
                            win32process.THREAD_PRIORITY_HIGHEST,
                            win32process.THREAD_PRIORITY_TIME_CRITICAL]

        pid = win32api.GetCurrentProcessId()
        tid = win32api.GetCurrentThread()
        handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid)
        win32process.SetPriorityClass(handle, priorityClasses[priority])
        win32process.SetThreadPriority(tid, threadPriorities[priority])
        if Config.get('performance', 'restrict_to_first_processor'):
            win32process.SetProcessAffinityMask(handle, 1)
开发者ID:Linkid,项目名称:fofix,代码行数:30,代码来源:Resource.py

示例6: setUp

    def setUp(self):
        # set config file
        config_file = Version.PROGRAM_UNIXSTYLE_NAME + ".ini"
        self.config = Config.load(config_file, setAsDefault=True)

        # init the game engine
        self.engine = GameEngine(self.config)
开发者ID:fofix,项目名称:fofix,代码行数:7,代码来源:test_gameenginge.py

示例7: activateMod

def activateMod(engine, modName):
    modPath = _getModPath(engine)
    m = os.path.join(modPath, modName)
    t = os.path.join(m, "theme.ini")
    if os.path.isdir(m):
        engine.resource.addDataPath(m)
        if os.path.isfile(t):
            theme = Config.load(t)
            Theme.open(theme)
开发者ID:fofix,项目名称:fofix,代码行数:9,代码来源:Mod.py

示例8: load_config

    def load_config(configPath):
        ''' Load the configuration file. '''
        if configPath is not None:
            if configPath.lower() == "reset":

                # Get os specific location of config file, and remove it.
                fileName = os.path.join(VFS.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
                os.remove(fileName)

                # Recreate it
                config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)

            else:
                # Load specified config file
                config = Config.load(configPath, setAsDefault = True)
        else:
            # Use default configuration file
            config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)

        return config
开发者ID:gitter-badger,项目名称:fofix,代码行数:20,代码来源:FoFiX.py

示例9: __init__

    def __init__(self, dataPath = os.path.join("..", "data")):
        self.resultQueue = Queue()
        self.dataPaths = [dataPath]
        self.loaderSemaphore = BoundedSemaphore(value = 1)
        self.loaders = []

        #myfingershurt: the following should be global, and only done at startup.  Not every damn time a file is loaded.
        self.songPath = []
        self.baseLibrary = Config.get("setlist", "base_library")
        #evilynux - Support for songs in ~/.fretsonfire/songs (GNU/Linux and MacOS X)
        if self.baseLibrary == "None" and os.name == "posix":
            path = os.path.expanduser("~/." + Version.PROGRAM_UNIXSTYLE_NAME)
            if os.path.isdir(path):
                self.baseLibrary = path
                Config.set("setlist", "base_library", path)

        if self.baseLibrary and os.path.isdir(self.baseLibrary):
            self.songPath = [self.baseLibrary]

        self.logLoadings = Config.get("game", "log_loadings")
开发者ID:Linkid,项目名称:fofix,代码行数:20,代码来源:Resource.py

示例10: run

 def run(self):
     self.semaphore.acquire()
     game_priority = Config.get("performance", "game_priority")
     # Reduce priority on posix
     if os.name == "posix":
         # evilynux - Beware, os.nice _decreases_ priority, hence the reverse logic
         os.nice(5 - game_priority)
     elif os.name == "nt":
         self.setPriority(priority = game_priority)
     self.load()
     self.semaphore.release()
     self.resultQueue.put(self)
开发者ID:Linkid,项目名称:fofix,代码行数:12,代码来源:Resource.py

示例11: __init__

    def __init__(self):
        global args
        self.args = args

        self.playing = self.args['song']
        self.configFile = self.args['config']
        self.fullscreen = self.args['fullscreen']
        self.resolution = self.args['resolution']
        self.theme = self.args['theme']
        self.diff = self.args['diff']
        self.part = self.args['part']
        self.mode = self.args['mode']
        self.players = self.args['players']

        self.config = self.load_config(self.configFile)

        #Lysdestic - Allow support for manipulating fullscreen via CLI
        if self.fullscreen is not None:
            Config.set("video", "fullscreen", self.fullscreen)

        #Lysdestic - Change resolution from CLI
        if self.resolution is not None:
            Config.set("video", "resolution", self.resolution)

        #Lysdestic - Alter theme from CLI
        if self.theme is not None:
            Config.set("coffee", "themename", self.theme)

        self.engine = GameEngine(self.config)

        self.init_oneshot()

        self.videoLayer = False
        self.restartRequested = False
开发者ID:gitter-badger,项目名称:fofix,代码行数:34,代码来源:FoFiX.py

示例12: __init__

    def __init__(self):

        # get args
        self.args = _cmd_args
        self.configFile = self.args['config']
        self.fullscreen = self.args['fullscreen']
        self.resolution = self.args['resolution']
        self.theme = self.args['theme']

        # load config
        self.config = self.load_config(self.configFile)

        # allow support for manipulating fullscreen via CLI
        if self.fullscreen is not None:
            Config.set("video", "fullscreen", self.fullscreen)

        # change resolution from CLI
        if self.resolution is not None:
            Config.set("video", "resolution", self.resolution)

        # alter theme from CLI
        if self.theme is not None:
            Config.set("coffee", "themename", self.theme)

        self.engine = GameEngine(self.config)

        self.videoLayer = False
        self.restartRequested = False
开发者ID:fofix,项目名称:fofix,代码行数:28,代码来源:FoFiX.py

示例13: __init__

    def __init__(self, name, number):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            log.debug("Player class init (Player.py)...")

        self.name     = name

        self.reset()
        self.keyList     = None

        self.progressKeys = []
        self.drums        = []
        self.keys         = []
        self.soloKeys     = []
        self.soloShift    = None
        self.soloSlide    = False
        self.actions      = []
        self.yes          = []
        self.no           = []
        self.conf         = []
        self.up           = []
        self.down         = []
        self.left         = []
        self.right        = []
        self.controller   = -1
        self.controlType  = -1

        self.guitarNum    = None
        self.number       = number

        self.bassGrooveEnabled = False
        self.currentTheme = 1

        self.lefty       = _playerDB.execute('SELECT `lefty` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.twoChordMax = _playerDB.execute('SELECT `twochord` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.drumflip    = _playerDB.execute('SELECT `drumflip` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.assistMode  = _playerDB.execute('SELECT `assist` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.autoKick    = _playerDB.execute('SELECT `autokick` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.neck        = _playerDB.execute('SELECT `neck` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.neckType    = _playerDB.execute('SELECT `necktype` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self.whichPart   = _playerDB.execute('SELECT `part` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self._upname      = _playerDB.execute('SELECT `upname` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        self._difficulty  = _playerDB.execute('SELECT `difficulty` FROM `players` WHERE `name` = ?', [self.name]).fetchone()[0]
        #MFH - need to store selected practice mode and start position here
        self.practiceMode = False
        self.practiceSpeed = 1.0
        self.practiceSection = None
        self.startPos = 0.0

        self.hopoFreq = None
开发者ID:htvu,项目名称:fofix,代码行数:51,代码来源:Player.py

示例14: setUp

    def setUp(self):
        # set config file
        config_file = Version.PROGRAM_UNIXSTYLE_NAME + ".ini"
        self.config = Config.load(config_file, setAsDefault=True)

        # set choices
        choices = [
            ("Choice 1", my_callback),
        ]

        # init the engine
        engine = GameEngine(self.config)

        # init the menu
        self.menu = Menu(engine, choices)
开发者ID:fofix,项目名称:fofix,代码行数:15,代码来源:test_menu.py

示例15: savePlayers

def savePlayers():
    for pref in _playerDB.execute('SELECT * FROM `players` WHERE `changed` = 1').fetchall():
        try:
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
        except:
            c = VFS.open(_makePlayerIniName(str(pref[0])), "w")
            c.close()
            c = Config.load(VFS.resolveWrite(_makePlayerIniName(str(pref[0]))), type = 2)
            c.set("player","leftymode",int(pref[1]))
            c.set("player","drumflip",int(pref[2]))
            c.set("player","auto_kick",int(pref[3]))
            c.set("player","assist_mode",int(pref[4]))
            c.set("player","two_chord_max",int(pref[5]))
            c.set("player","necktype",int(pref[6]))
            c.set("player","neck",str(pref[7]))
            c.set("player","part",int(pref[8]))
            c.set("player","difficulty",int(pref[9]))
            c.set("player","name",str(pref[10]))
            c.set("player","controller",int(pref[11]))
            del c
            _playerDB.execute('UPDATE `players` SET `changed` = 0 WHERE `name` = ?', [pref[0]])
    _playerDB.execute('UPDATE `players` SET `loaded` = 0')
    _playerDB.commit()
开发者ID:htvu,项目名称:fofix,代码行数:36,代码来源:Player.py


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