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


Python Config.set方法代码示例

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


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

示例1: init_oneshot

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    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,代码行数:53,代码来源:FoFiX.py

示例2: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    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,代码行数:22,代码来源:Resource.py

示例3: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    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,代码行数:36,代码来源:FoFiX.py

示例4: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    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,代码行数:30,代码来源:FoFiX.py

示例5: deleteControl

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
def deleteControl(control):
    VFS.unlink(_makeControllerIniName(control))
    defaultUsed = -1
    for i in range(4):
        get = Config.get("game", "control%d" % i)
        if get == control:
            if i == 0:
                Config.set("game", "control%d" % i, "defaultg")
                defaultUsed = 0
            else:
                Config.set("game", "control%d" % i, None)
        if get == "defaultg" and defaultUsed > -1:
            Config.set("game", "control%d" % i, None)
    loadControls()
开发者ID:htvu,项目名称:fofix,代码行数:16,代码来源:Player.py

示例6: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [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 = 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

#.........这里部分代码省略.........
开发者ID:arielenter,项目名称:fofix,代码行数:103,代码来源:MainMenu.py

示例7: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    def __init__(self):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            log.debug("Controls class init (Player.py)...")
        self.controls = []
        self.controls.append(Config.get("game", "control0"))
        self.controls.append(Config.get("game", "control1"))
        self.controls.append(Config.get("game", "control2"))
        self.controls.append(Config.get("game", "control3"))
        self.config = []
        self.controlList = []
        self.maxplayers = 0
        self.guitars    = 0
        self.drums      = 0
        self.mics       = 0
        self.overlap    = []

        self.p2Nav = Config.get("game", "p2_menu_nav")
        self.drumNav = Config.get("game", "drum_navigation")

        self.keyCheckerMode = Config.get("game","key_checker_mode")

        if VFS.isfile(_makeControllerIniName(self.controls[0])):
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[0])), type = 1))
            if VFS.isfile(_makeControllerIniName(self.controls[1])) and self.controls[1] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[1])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control1", None)
                self.controls[1] = "None"
            if VFS.isfile(_makeControllerIniName(self.controls[2])) and self.controls[2] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[2])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control2", None)
                self.controls[2] = "None"
            if VFS.isfile(_makeControllerIniName(self.controls[3])) and self.controls[3] != "None":
                self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName(self.controls[3])), type = 1))
            else:
                self.config.append(None)
                Config.set("game", "control3", None)
                self.controls[3] = "None"
        else:
            confM = None
            if Microphone.supported:
                confM = Config.load(VFS.resolveRead(_makeControllerIniName("defaultm")), type = 1)
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName("defaultg")), type = 1))
            self.config.append(Config.load(VFS.resolveRead(_makeControllerIniName("defaultd")), type = 1))
            self.config.append(confM)
            self.config.append(None)
            Config.set("game", "control0", "defaultg")
            Config.set("game", "control1", "defaultd")
            self.controls = ["defaultg", "defaultd"]
            if confM is not None:
                Config.set("game", "control2", "defaultm")
                self.controls.append("defaultm")
            else:
                Config.set("game", "control2", None)
                self.controls.append("None")
            Config.set("game", "control3", None)
            self.controls.append("None")

        self.type       = []
        self.analogKill = []
        self.analogSP   = []
        self.analogSPThresh = []
        self.analogSPSense  = []
        self.analogDrum = [] #FIXME: Analog Drum
        self.analogSlide = []
        self.analogFX   = [] #FIXME: Analog FX
        self.twoChord   = []
        self.micDevice  = []  #stump
        self.micTapSensitivity = []
        self.micPassthroughVolume = []

        self.flags = 0

        for i in self.config:
            if i:
                type = i.get("controller", "type")
                if type == 5:
                    self.mics += 1
                elif type > 1:
                    self.guitars += 1
                else:
                    self.drums += 1
                self.type.append(type)
                self.analogKill.append(i.get("controller", "analog_kill"))
                self.analogSP.append(i.get("controller", "analog_sp"))
                self.analogSPThresh.append(i.get("controller", "analog_sp_threshold"))
                self.analogSPSense.append(i.get("controller", "analog_sp_sensitivity"))
                self.analogDrum.append(i.get("controller", "analog_drum")) #FIXME: Analog Drum
                self.analogSlide.append(i.get("controller", "analog_slide"))
                self.analogFX.append(i.get("controller", "analog_fx")) #FIXME: Analog FX
                self.micDevice.append(i.get("controller", "mic_device"))  #stump
                self.micTapSensitivity.append(i.get("controller", "mic_tap_sensitivity"))
                self.micPassthroughVolume.append(i.get("controller", "mic_passthrough_volume"))
                self.twoChord.append(i.get("controller", "two_chord_max"))
                self.controlList.append(i.get("controller", "name"))
#.........这里部分代码省略.........
开发者ID:htvu,项目名称:fofix,代码行数:103,代码来源:Player.py

示例8: renameControl

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
def renameControl(control, newname):
    VFS.rename(_makeControllerIniName(control), _makeControllerIniName(newname))
    for i in range(4):
        if Config.get("game", "control%d" % i) == control:
            Config.set("game", "control%d" % i, newname)
    loadControls()
开发者ID:htvu,项目名称:fofix,代码行数:8,代码来源:Player.py

示例9: getAvailableLanguages

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
from fofix.core import Config

Config.define("game", "language", str, "")

def getAvailableLanguages():
    return [os.path.basename(l).capitalize().replace(".mo", "").replace("_", " ") for l in glob.glob(os.path.join(Version.dataPath(), "translations", "*.mo"))]

def dummyTranslator(string):
    return unicodify(string)

language = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini").get("game", "language")
_ = dummyTranslator

if language:
    try:
        trFile = os.path.join(Version.dataPath(), "translations", "%s.mo" % language.lower().replace(" ", "_"))
        catalog = gettext.GNUTranslations(open(trFile, "rb"))
        def translate(m):
            return catalog.ugettext(m)
        _ = translate
    except Exception as x:
        log.warn("Unable to select language '%s': %s" % (language, x))
        language = None
        Config.set("game", "language", "")

# Define the config key again now that we have some options for it
langOptions = {"": "English"}
for lang in getAvailableLanguages():
    langOptions[lang] = _(lang)
Config.define("game", "language", str, "", _("Language"), langOptions, tipText = _("Change the game language!"))
开发者ID:ME7ROPOLIS,项目名称:fofix,代码行数:32,代码来源:Language.py

示例10: __init__

# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import set [as 别名]
    def __init__(self, resource, svg):

        self.logClassInits = Config.get("game", "log_class_inits")
        if self.logClassInits == 1:
            Log.debug("Data class init (Data.py)...")
        self.logLoadings = Config.get("game", "log_loadings")

        self.logImageNotFound = Config.get("log", "log_image_not_found")

        self.resource = resource
        self.svg      = svg

        self.sfxVolume    = Config.get("audio", "SFX_volume")
        self.crowdVolume  = Config.get("audio", "crowd_volume")

        #Get theme
        themename = Config.get("coffee", "themename")
        self.themeLabel = themename
        self.themeCoOp  = False

        self.players = None
        self.players = Player.loadPlayers()

        #myfingershurt: check for existence of theme path
        themepath = os.path.join(Version.dataPath(), "themes")
        self.themepath = themepath
        self.path = Version.dataPath()

        if not self.checkImgDrawing(os.path.join("themes",themename,"notes","notes.png")):
            #myfingershurt: here need to ensure an existing theme is selected
            themes = []
            defaultTheme = None           #myfingershurt
            allthemes = os.listdir(themepath)
            for name in allthemes:
                if self.checkImgDrawing(os.path.join("themes",name,"notes","notes.png")):
                    themes.append(name)
                    if name == "MegaLight V4":         #myfingershurt
                        defaultTheme = name     #myfingershurt
            if defaultTheme != "MegaLight V4":     #myfingershurt
                defaultTheme = themes[0]    #myfingershurt
            #not a valid theme if notes.png isn't there!  Force default theme:
            Config.set("coffee", "themename",defaultTheme)
            #re-init Data with new default
            themename = defaultTheme
            self.themeLabel = themename


        if not os.path.exists(os.path.join(Version.dataPath(), "themes", themename, "vocals")):
            self.vocalPath = "vocals"
        else:
            self.vocalPath = os.path.join("themes",themename,"vocals")

        self.theme = 2
        self.themeCoOp = True

        self.fontScreenBottom = 0.75      #from our current viewport's constant 3:4 aspect ratio (which is always stretched to fill the video resolution)

        self.loadPartImages()
        #myfingershurt: multi-OS compatibility file access fixes using os.path.join()
        # load font customization images

        #Worldrave - Use new defined Star3 and star4. Using star1 and star2 as a fallback.

        #MFH - no more custom glyphs, these are wasting memory.
        #MFH - but we do need these star1-4 images anyway.  Leaving them loaded here in the Data object.
        self.loadImgDrawing(self, "star1",   os.path.join("themes",themename,"star1.png"), textureSize = (128, 128))
        self.loadImgDrawing(self, "star2",   os.path.join("themes",themename,"star2.png"), textureSize = (128, 128))

        #MFH - let's not rely on errors here if we don't have to...
        if not self.loadImgDrawing(self, "star3",   os.path.join("themes",themename,"star3.png"), textureSize = (128, 128)):
            self.star3 = self.star1
        if not self.loadImgDrawing(self, "star4",   os.path.join("themes",themename,"star4.png"), textureSize = (128, 128)):
            self.star4 = self.star2


        if self.loadImgDrawing(self, "starPerfect",   os.path.join("themes",themename,"starperfect.png"), textureSize = (128, 128)):
            self.perfectStars = True
            self.maskStars = False
        else:
            self.starPerfect = self.star2
            self.fcStars   = False
            self.starFC     = self.star2
            self.maskStars = True
            self.perfectStars = False

        if self.perfectStars:
            if self.loadImgDrawing(self, "starFC",   os.path.join("themes",themename,"starfc.png"), textureSize = (128, 128)):
                self.fcStars   = True
            else:
                self.starFC = self.starPerfect
                self.fcStars = False

        # load misc images
        self.loadImgDrawing(self, "loadingImage", os.path.join("themes",themename,"loadingbg.png"), textureSize = (256,256))
        self.loadImgDrawing(self, "optionsBG", os.path.join("themes",themename,"menu","optionsbg.png"))
        if self.loadImgDrawing(self, "submenuSelect", os.path.join("themes",themename,"submenuselect.png")):
            subSelectImgW = self.submenuSelect.width1()
            self.submenuSelectFound = True
            self.subSelectWFactor = 640.000/subSelectImgW
            self.subSelectImgH = self.submenuSelect.height1()
#.........这里部分代码省略.........
开发者ID:ajs124,项目名称:fofix,代码行数:103,代码来源:Data.py


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