本文整理汇总了Python中fofix.core.Config.get方法的典型用法代码示例。如果您正苦于以下问题:Python Config.get方法的具体用法?Python Config.get怎么用?Python Config.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.core.Config
的用法示例。
在下文中一共展示了Config.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SetAllSoundFxObjectVolumes
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
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)
示例2: setPriority
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
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)
示例3: __init__
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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")
示例4: run
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
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)
示例5: __init__
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
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
示例6: init_oneshot
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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
示例7: deleteControl
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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()
示例8: checkIfEnabled
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
def checkIfEnabled(self):
if Config.get("video","shader_use"):
if self.enabled:
self.turnon = True
else:
self.set(os.path.join(Version.dataPath(), "shaders"))
else:
self.turnon = False
if self.turnon:
for i in self.shaders.keys():
try:
value = Config.get("video","shader_"+i)
if value != "None":
if value == "theme":
if isTrue(Config.get("theme","shader_"+i).lower()):
value = i
else:
continue
self.assigned[i] = value
except KeyError:
continue
return True
return False
示例9: setNewKeyMapping
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
def setNewKeyMapping(engine, config, section, option, key):
oldKey = config.get(section, option)
config.set(section, option, key)
keyCheckerMode = Config.get("game", "key_checker_mode")
if key == "None" or key is None:
return True
b = isKeyMappingOK(config, option)
if b != 0:
if keyCheckerMode > 0:
from fofix.game.Dialogs import Dialogs
Dialogs.showMessage(engine, _("This key conflicts with the following keys: %s") % str(b))
if keyCheckerMode == 2: #enforce no conflicts!
config.set(section, option, oldKey)
return False
return True
示例10: SetAllSoundFxObjectVolumes
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
def SetAllSoundFxObjectVolumes(self, volume=None):
"""
Go through all ``Sound`` objects and set object volume to the given
volume.
:param volume: set this volume to the sound object
"""
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)
示例11: updateHandicapValue
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
def updateHandicapValue(self):
self.handicapValue = 100.0
slowdown = Config.get("audio","speed_factor")
earlyHitHandicap = 1.0 #self.earlyHitWindowSizeHandicap #akedrou - replace when implementing handicap.
for j in range(len(HANDICAPS)):
if (self.handicap>>j)&1 == 1:
if j == 1: #scalable
if slowdown != 1:
if slowdown < 1:
cut = (100.0**slowdown)/100.0
else:
cut = (100.0*slowdown)/100.0
self.handicapValue *= cut
if earlyHitHandicap != 1.0:
self.handicapValue *= earlyHitHandicap
else:
self.handicapValue *= HANDICAPS[j]
示例12: run
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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()
示例13: __init__
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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
Music.setEndEvent(MusicFinished)
#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.info("MIDI input support is not available; install at least pygame 1.9 to get it.")
示例14: refreshBaseLib
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [as 别名]
def refreshBaseLib(self):
self.baseLibrary = Config.get("setlist", "base_library")
if self.baseLibrary and os.path.isdir(self.baseLibrary):
self.songPath = [self.baseLibrary]
示例15: renameControl
# 需要导入模块: from fofix.core import Config [as 别名]
# 或者: from fofix.core.Config import get [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()