本文整理汇总了Python中fofix.core.Version类的典型用法代码示例。如果您正苦于以下问题:Python Version类的具体用法?Python Version怎么用?Python Version使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Version类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: loadIcons
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: test_version
def test_version(self):
"""Test the complete version format"""
complete_version = Version.version()
version_num = Version.versionNum()
release = Version.revision()
expected_version = "%s %s" % (version_num, release)
self.assertEqual(complete_version, expected_version)
示例3: shown
def shown(self):
self.engine.view.pushLayer(self.menu)
shaders.checkIfEnabled()
if not self.shownOnce:
self.shownOnce = True
if hasattr(sys, 'frozen'):
# Check whether this is a release binary being run from an svn/git
# working copy or whether this is an svn/git binary not being run
# from an corresponding working copy.
currentVcs, buildVcs = None, None
if VFS.isdir('/gameroot/.git'):
currentVcs = 'git'
elif VFS.isdir('/gameroot/src/.svn'):
currentVcs = 'Subversion'
if 'git' in Version.version():
buildVcs = 'git'
elif 'svn' in Version.version():
buildVcs = 'Subversion'
if currentVcs != buildVcs:
if buildVcs is None:
msg = _('This binary release is being run from a %(currentVcs)s working copy. This is not the correct way to run FoFiX from %(currentVcs)s. Please see one of the following web pages to set your %(currentVcs)s working copy up correctly:') + \
'\n\nhttp://code.google.com/p/fofix/wiki/RunningUnderPython26' + \
'\nhttp://code.google.com/p/fofix/wiki/RequiredSourceModules'
else:
msg = _('This binary was built from a %(buildVcs)s working copy but is not running from one. The FoFiX Team will not provide any support whatsoever for this binary. Please see the following site for official binary releases:') + \
'\n\nhttp://code.google.com/p/fofix/'
Dialogs.showMessage(self.engine, msg % {'buildVcs': buildVcs, 'currentVcs': currentVcs})
示例4: __init__
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()
示例5: run
def run(self):
xgettext_cmd = find_command('xgettext')
potfile = os.path.join('..', 'data', 'po', 'messages.pot')
self.spawn([xgettext_cmd,
'--package-name='+Version.PROGRAM_NAME,
'--package-version='+Version.version(),
'--copyright-holder=FoFiX Team',
'-o', potfile] +
['-k' + funcname for funcname in self.FUNCNAMES] +
glob.glob('*.py'))
示例6: run
def run(self):
py_files = glob_recursive('.', '*.py')
xgettext_cmd = find_command('xgettext')
potfile = os.path.join('data', 'po', 'messages.pot')
self.spawn([xgettext_cmd,
'--package-name=' + Version.PROGRAM_NAME,
'--package-version=' + Version.version(),
'--copyright-holder=FoFiX Team',
' --sort-output',
'-o', potfile] +
['-k' + funcname for funcname in self.FUNCNAMES] +
py_files)
示例7: loadImages
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
示例8: 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
示例9: run
def run(self):
xgettext_cmd = find_command("xgettext")
potfile = os.path.join("..", "data", "po", "messages.pot")
self.spawn(
[
xgettext_cmd,
"--package-name=" + Version.PROGRAM_NAME,
"--package-version=" + Version.version(),
"--copyright-holder=FoFiX Team",
"-o",
potfile,
]
+ ["-k" + funcname for funcname in self.FUNCNAMES]
+ glob.glob("*.py")
)
示例10: main
def main(self):
"""Main state loop."""
done = self.task.run()
self.clearScreen()
self.view.render()
if self.debugLayer:
self.debugLayer.render(1.0, True)
self.video.flip()
# Calculate FPS every 2 seconds
if self.clock.fpsTime >= 2000:
# evilynux - Printing on the console with a frozen binary may cause a crash.
self.fpsEstimate = self.clock.get_fps()
if self.show_fps and not Version.isWindowsExe():
print("%.2f fps" % self.fpsEstimate)
return done
示例11: run
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()
示例12: checkIfEnabled
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
示例13: len
from fofix.core.Task import TaskEngine
from fofix.core import cmgl
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':
示例14: Main
while True:
main = Main()
main.run()
if not main.restartRequested:
break
except (KeyboardInterrupt, SystemExit):
raise
except:
log.error("Terminating due to unhandled exception: ")
_logname = os.path.abspath(log.logFile.name)
_errmsg = "%s\n\n%s\n%s\n%s\n%s" % (
_("Terminating due to unhandled exception:"),
traceback.format_exc(),
_("If you make a bug report about this error, please include the contents of the following log file:"),
_logname,
_("The log file already includes the traceback given above."))
if os.name == 'nt':
# If we move to PySDL2 we can replace this with a call to SDL_ShowSimpleMessageBox
import win32api
import win32con
if win32api.MessageBox(0, "%s\n\n%s" % (_errmsg, _("Open the logfile now?")), "%s %s" % (Version.PROGRAM_NAME, Version.version()), win32con.MB_YESNO|win32con.MB_ICONSTOP) == win32con.IDYES:
log.logFile.close()
os.startfile(_logname)
if hasattr(sys, 'frozen'):
sys.exit(1) # don't reraise if py2exe'd so the "Errors occurred" box won't appear after this and confuse the user as to which logfile we actually want
else:
print >>sys.stderr, _errmsg
raise
示例15: VersionResource
py2exe.build_exe.isSystemDLL = isSystemDLL
setup_args.update(
{
"zipfile": "data/library.zip",
"windows": [
{
"script": "FoFiX.py",
"icon_resources": [(1, "./win32/fofix.ico")],
"other_resources": [
(
RT_VERSION,
1,
VersionResource(
# stump: the parameter below must consist only of up to four numerical fields separated by dots
Version.versionNum(),
file_description="Frets on Fire X",
legal_copyright=r"© 2008-2013 FoFiX Team. GNU GPL v2 or later.",
company_name="FoFiX Team",
internal_name="FoFiX.exe",
original_filename="FoFiX.exe",
product_name=Version.PROGRAM_NAME,
# stump: when run from the exe, FoFiX will claim to be "FoFiX v" + product_version
product_version=Version.version(),
).resource_bytes(),
)
],
}
],
}
)