本文整理汇总了Python中VFS.isfile方法的典型用法代码示例。如果您正苦于以下问题:Python VFS.isfile方法的具体用法?Python VFS.isfile怎么用?Python VFS.isfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VFS
的用法示例。
在下文中一共展示了VFS.isfile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: deletePlayer
# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isfile [as 别名]
def deletePlayer(player):
_playerDB.execute('DELETE FROM `players` WHERE `name` = ?', [player])
VFS.unlink(_makePlayerIniName(player))
if VFS.isfile('%s/%s.png' % (playerpath, player)):
VFS.unlink('%s/%s.png' % (playerpath, player))
savePlayers()
loadPlayers()
示例2: _getTagLine
# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isfile [as 别名]
def _getTagLine():
import VFS # can't be done at top level due to circular import issues...
# Look for a git repository.
if VFS.isdir("/gameroot/.git"):
# HEAD is in the form "ref: refs/heads/master\n"
headref = VFS.open("/gameroot/.git/HEAD").read()[5:].strip()
if VFS.isfile("/gameroot/.git/" + headref):
# The ref is in the form "sha1-hash\n"
headhash = VFS.open("/gameroot/.git/" + headref).read().strip()
else:
# It's a packed ref.
for line in VFS.open("/gameroot/.git/packed-refs"):
if line.strip().endswith(headref):
headhash = line[:40]
break
shortref = re.sub("^refs/(heads/)?", "", headref)
return "development (git %s %s)" % (shortref, headhash[:7])
# Look for the svn administrative directory.
elif VFS.isdir("/gameroot/src/.svn"):
revision = VFS.open("/gameroot/src/.svn/entries").readlines()[3].strip()
return "development (svn r%s)" % revision
else:
return None
示例3: _getTagLine
# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isfile [as 别名]
def _getTagLine():
import VFS # can't be done at top level due to circular import issues...
# Look for a git repository.
if VFS.isdir('/gameroot/.git'):
shortref = None
headhash = None
# HEAD is in the form "ref: refs/heads/master\n" if a branch is
# checked out, or just the hash if HEAD is detached.
refline = VFS.open('/gameroot/.git/HEAD').read().strip()
if refline[0:5] == "ref: ":
headref = refline[5:]
if VFS.isfile('/gameroot/.git/' + headref):
# The ref is in the form "sha1-hash\n"
headhash = VFS.open('/gameroot/.git/' + headref).read().strip()
else:
# It's a packed ref.
for line in VFS.open('/gameroot/.git/packed-refs'):
if line.strip().endswith(headref):
headhash = line[:40]
break
shortref = re.sub('^refs/(heads/)?', '', headref)
else:
shortref = "(detached)"
headhash = refline
return 'development (git %s %s)' % (shortref or "(unknown)",
headhash and headhash[:7] or "(unknown)")
# Look for the svn administrative directory.
elif VFS.isdir('/gameroot/src/.svn'):
revision = VFS.open('/gameroot/src/.svn/entries').readlines()[3].strip()
return 'development (svn r%s)' % revision
else:
return None
示例4: __init__
# 需要导入模块: import VFS [as 别名]
# 或者: from VFS import isfile [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"))
#.........这里部分代码省略.........