本文整理汇总了Python中fofix.core.Version.dataPath方法的典型用法代码示例。如果您正苦于以下问题:Python Version.dataPath方法的具体用法?Python Version.dataPath怎么用?Python Version.dataPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fofix.core.Version
的用法示例。
在下文中一共展示了Version.dataPath方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadIcons
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
def loadIcons(self):
#begin to load images...
self.itemIcons = {}
if os.path.isdir(os.path.join(Version.dataPath(),"themes",self.themename,"setlist")):
self.engine.data.loadAllImages(self, os.path.join("themes",self.themename,"setlist"))
if os.path.isdir(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","icon")):
self.itemIcons = self.engine.data.loadAllImages(None, os.path.join("themes",self.themename,"setlist","icon"), prefix="")
示例2: __init__
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [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()
示例3: loadImages
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
def loadImages(self):
self.loadIcons()
#mesh...
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","item.dae")):
self.engine.resource.load(self, "itemMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","item.dae")), synch = True)
else:
self.itemMesh = None
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","library.dae")):
self.engine.resource.load(self, "libraryMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","library.dae")), synch = True)
else:
self.libraryMesh = None
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","label.dae")):
self.engine.resource.load(self, "label", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","label.dae")), synch = True)
else:
self.label = None
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","library_label.dae")):
self.engine.resource.load(self, "libraryLabel", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","library_label.dae")), synch = True)
else:
self.libraryLabel = None
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","tier.dae")):
self.engine.resource.load(self, "tierMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","tier.dae")), synch = True)
else:
self.tierMesh = self.libraryMesh
if os.path.exists(os.path.join(Version.dataPath(),"themes",self.themename,"setlist","list.dae")):
self.engine.resource.load(self, "listMesh", lambda: Mesh(self.engine.resource.fileName("themes",self.themename,"setlist","list.dae")), synch = True)
else:
self.listMesh = self.libraryMesh
示例4: init_oneshot
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [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
示例5: run
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [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()
示例6: checkIfEnabled
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [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
示例7: __init__
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
def __init__(self, engine, songName = None):
self.engine = engine
self.time = 0.0
self.offset = 0.5 # akedrou - this seems to fix the delay issue, but I'm not sure why. Return here!
self.speedDiv = 20000.0
self.speedDir = 1.0
self.doneList = []
self.themename = Config.get("coffee", "themename")
nf = self.engine.data.font
ns = 0.002
bs = 0.001
hs = 0.003
c1 = (1, 1, .5, 1)
c2 = (1, .75, 0, 1)
self.text_size = nf.getLineSpacing(scale = hs)
#akedrou - Translatable Strings:
self.bank = {}
self.bank['intro'] = [_("Frets on Fire X is a progression of MFH-mod,"),
_("which was built on Alarian's mod,"),
_("which was built on UltimateCoffee's Ultimate mod,"),
_("which was built on RogueF's RF_mod 4.15,"),
_("which was, of course, built on Frets on Fire 1.2.451,"),
_("which was created by Unreal Voodoo")]
self.bank['noOrder'] = [_("No particular order")]
self.bank['accessOrder']= [_("In order of project commit access")]
self.bank['coders'] = [_("Active Coders")]
self.bank['otherCoding']= [_("Programming")]
self.bank['graphics'] = [_("Graphic Design")]
self.bank['3d'] = [_("3D Textures")]
self.bank['logo'] = [_("FoFiX Logo Design")]
self.bank['hollowmind'] = [_("Hollowmind Necks")]
self.bank['themes'] = [_("Included Themes")]
self.bank['shaders'] = [_("Shaders")]
self.bank['sounds'] = [_("Sound Design")]
self.bank['translators']= [_("Translators")]
self.bank['honorary'] = [_("Honorary Credits")]
self.bank['codeHonor'] = [_("Without whom this game would not exist")]
self.bank['giveThanks'] = [_("Special Thanks to")]
self.bank['community'] = [_("nwru and all of the community at fretsonfire.net")]
self.bank['other'] = [_("Other Contributors:")]
self.bank['tutorial'] = [_("Jurgen FoF tutorial inspired by adam02"),
_("Drum test song tutorial by Heka"),
_("Drum Rolls practice tutorial by venom426")]
self.bank['disclaimer'] = [_("If you have contributed to this game and are not credited,"),
_("please let us know what and when you contributed.")]
self.bank['thanks'] = [_("Thank you for your contribution.")]
self.bank['oversight'] = [_("Please keep in mind that it is not easy to trace down and"),
_("credit every single person who contributed; if your name is"),
_("not included, it was not meant to slight you."),
_("It was an oversight.")]
# evilynux - Theme strings
self.bank['themeCreators'] = [_("%s theme credits:") % self.themename]
self.bank['themeThanks'] = [_("%s theme specific thanks:") % self.themename]
# Languages
self.bank['french'] = [_("French")]
self.bank['french90'] = [_("French (reform 1990)")]
self.bank['german'] = [_("German")]
self.bank['italian'] = [_("Italian")]
self.bank['piglatin'] = [_("Pig Latin")]
self.bank['portuguese-b'] = [_("Portuguese (Brazilian)")]
self.bank['russian'] = [_("Russian")]
self.bank['spanish'] = [_("Spanish")]
self.bank['swedish'] = [_("Swedish")]
self.videoLayer = False
self.background = None
vidSource = os.path.join(Version.dataPath(), 'themes', self.themename, \
'menu', 'credits.ogv')
if os.path.isfile(vidSource):
try:
self.vidPlayer = VideoLayer(self.engine, vidSource, mute = True, loop = True)
except (IOError, VideoPlayerError):
Log.error('Error loading credits video:')
else:
self.vidPlayer.play()
self.engine.view.pushLayer(self.vidPlayer)
self.videoLayer = True
if not self.videoLayer and \
not self.engine.loadImgDrawing(self, 'background', os.path.join('themes', self.themename, 'menu', 'credits.png')):
self.background = None
if not self.engine.loadImgDrawing(self, 'topLayer', os.path.join('themes', self.themename, 'menu', 'creditstop.png')):
self.topLayer = None
space = Text(nf, hs, c1, "center", " ")
self.credits = [
Picture(self.engine, "fofix_logo.png", .10),
Text(nf, ns, c1, "center", "%s" % Version.version()), space]
# evilynux: Main FoFiX credits (taken from CREDITS).
self.parseText("CREDITS")
self.credits.extend([space, space, space])
# evilynux: Theme credits (taken from data/themes/<theme name>/CREDITS).
self.parseText(os.path.join('data', 'themes', self.themename, 'CREDITS'))
self.credits.extend( [
#.........这里部分代码省略.........
示例8: __init__
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
def __init__(self, config = None):
Log.debug("GameEngine class init (GameEngine.py)...")
self.mainMenu = None #placeholder for main menu object - to prevent reinstantiation
self.currentScene = None
self.versionString = version #stump: other version stuff moved to allow full version string to be retrieved without instantiating GameEngine
self.uploadVersion = "%s-4.0" % Version.PROGRAM_NAME #akedrou - the version passed to the upload site.
self.dataPath = Version.dataPath()
Log.debug(self.versionString + " starting up...")
Log.debug("Python version: " + sys.version.split(' ')[0])
Log.debug("Pygame version: " + str(pygame.version.ver) )
Log.debug("PyOpenGL version: " + OpenGL.__version__)
Log.debug("Numpy version: " + np.__version__)
Log.debug("PIL version: " + Image.VERSION)
Log.debug("sys.argv: " + repr(sys.argv))
Log.debug("os.name: " + os.name)
Log.debug("sys.platform: " + sys.platform)
if os.name == 'nt':
import win32api
Log.debug("win32api.GetVersionEx(1): " + repr(win32api.GetVersionEx(1)))
elif os.name == 'posix':
Log.debug("os.uname(): " + repr(os.uname()))
"""
Constructor.
@param config: L{Config} instance for settings
"""
self.tutorialFolder = "tutorials"
if not config:
config = Config.load()
self.config = config
fps = self.config.get("video", "fps")
self.fps = fps
self.running = True
self.clock = FpsTimer()
self.tickDelta = 0
self.task = TaskEngine(self)
# Compatiblity task management
self.addTask = self.task.addTask
self.removeTask = self.task.removeTask
self.pauseTask = self.task.pauseTask
self.resumeTask = self.task.resumeTask
self.title = self.versionString
self.restartRequested = False
# evilynux - Check if theme icon exists first, then fallback on FoFiX icon.
themename = self.config.get("coffee", "themename")
themeicon = os.path.join(Version.dataPath(), "themes", themename, "icon.png")
fofixicon = os.path.join(Version.dataPath(), "fofix_icon.png")
icon = None
if os.path.exists(themeicon):
icon = themeicon
elif os.path.exists(fofixicon):
icon = fofixicon
self.video = Video(self.title, icon)
if self.config.get("video", "disable_screensaver"):
self.video.disableScreensaver()
self.audio = Audio()
self.fpsEstimate = 0
self.priority = self.config.get("engine", "highpriority")
self.show_fps = self.config.get("video", "show_fps")
self.advSettings = self.config.get("game", "adv_settings")
self.restartRequired = False
self.quicksetRestart = False
self.quicksetPerf = self.config.get("quickset", "performance")
self.scrollRate = self.config.get("game", "scroll_rate")
self.scrollDelay = self.config.get("game", "scroll_delay")
Log.debug("Initializing audio.")
frequency = self.config.get("audio", "frequency")
bits = self.config.get("audio", "bits")
stereo = self.config.get("audio", "stereo")
bufferSize = self.config.get("audio", "buffersize")
self.audio.open(frequency = frequency, bits = bits, stereo = stereo, bufferSize = bufferSize)
self.cmdPlay = 0
self.cmdMode = None
self.cmdDiff = None
self.cmdPart = None
self.gameStarted = False
self.world = None
self.audioSpeedFactor = 1.0
Log.debug("Initializing video.")
#myfingershurt: ensuring windowed mode starts up in center of the screen instead of cascading positions:
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'
#.........这里部分代码省略.........
示例9: len
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
from fofix.core import Config
from fofix.core import ConfigDefs
from fofix.core import Version
from fofix.core import Player
from fofix.core import Log
from fofix.core import Mod
from fofix.game import Dialogs
from fofix.game.World import World
from fofix.game.Debug import DebugLayer
# evilynux - Grab name and version from Version class.
version = "%s v%s" % ( Version.PROGRAM_NAME, Version.version() )
##Alarian: Get unlimited themes by foldername
themepath = os.path.join(Version.dataPath(), "themes")
themes = []
defaultTheme = None #myfingershurt
allthemes = os.listdir(themepath)
for name in allthemes:
if os.path.exists(os.path.join(themepath,name,"notes","notes.png")):
themes.append(name)
if name == "MegaLight V4":
defaultTheme = name
i = len(themes)
if i == 0:
if os.name == 'posix':
Log.error("No valid theme found!\n" +
"Make sure theme files are properly cased " +
"e.g. notes.png works, Notes.png doesn't\n")
示例10: getAvailableLanguages
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [as 别名]
def getAvailableLanguages():
return [os.path.basename(l).capitalize().replace(".mo", "").replace("_", " ") for l in glob.glob(os.path.join(Version.dataPath(), "translations", "*.mo"))]
示例11: __init__
# 需要导入模块: from fofix.core import Version [as 别名]
# 或者: from fofix.core.Version import dataPath [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()
#.........这里部分代码省略.........