本文整理汇总了Python中Resource类的典型用法代码示例。如果您正苦于以下问题:Python Resource类的具体用法?Python Resource怎么用?Python Resource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Resource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, request, prepcache=True):
"Determine and open cache location, get descriptor backend. "
super(CachingProtocol, self).__init__()
self.request = request
# Track server response
self.__status, self.__message = None, None
if not prepcache:
return
self.cache = Resource.get_cache(request.hostinfo, request.envelope[1])
# Get descriptor storage reference
self.descriptors = Resource.get_backend()
示例2: __init__
def __init__(self, prototype, fileName = None):
"""
@param prototype: The configuration protype mapping
@param fileName: The file that holds this configuration registry
"""
self.prototype = prototype
# read configuration
self.config = MyConfigParser()
if fileName:
if not os.path.isfile(fileName):
path = Resource.getWritableResourcePath()
fileName = os.path.join(path, fileName)
self.config.read(fileName)
self.fileName = fileName
# fix the defaults and non-existing keys
for section, options in prototype.items():
if not self.config.has_section(section):
self.config.add_section(section)
for option in options.keys():
type = options[option].type
default = options[option].default
if not self.config.has_option(section, option):
self.config.set(section, option, str(default))
示例3: serve_descriptor
def serve_descriptor(self, status, protocol, request):
q = urlparse.urlparse( request.url[3] )[4]
url = urlparse.urlparse(urllib.unquote(q[4:]))
if ':' in url[1]:
hostinfo = url[1].split(':')
hostinfo[1] = int(hostinfo[1])
else:
hostinfo = url[1], 80
cache = Resource.get_cache(hostinfo, url[2][1:])
descriptors = Resource.get_backend()
if cache.path in descriptors:
descr = descriptors[cache.path]
self.prepare_response(status,
Params.json_write(descr),
mime='application/json')
else:
self.prepare_response("404 No Data", "No data for %s %s %s %s"%request.url)
示例4: updateStatus
def updateStatus(self):
self.files = []
states = 'modified added removed deleted unknown ignored clean'.split()
self.repository = hg.repository(ui.ui(), self.directory)
status = self.repository.status('.', None, None, True, True, True)
self.changestates = zip(states, status)
for _state, _files in self.changestates:
for _file in _files:
resource = Resource()
resource.setPath(_file)
resource.setState(NSLocalizedString(_state, None))
resource.setSelected(False)
self.files.append(resource)
示例5: main
def main():
playing = None
configFile = None
fullscreen = None
resolution = None
x = None
y = None
theme = None
debug = False
difficulty = None
part = None
mode = 0
nbrplayers = 1
for opt, arg in opts:
if opt in ["--verbose", "-v"]:
Log.quiet = False
if opt in ["--debug", "-d"]:
debug = True
if opt in ["--config", "-c"]:
configFile = arg
if opt in ["--fullscreen", "-f"]:
fullscreen = arg
if opt in ["--resolution", "-r"]:
resolution = arg
if opt in ["--geometry", "-g"]:
r = re.match('([0-9]+x\d+)\+?(\d+)?\+?(\d+)?',arg)
print "geometry tested ",arg
(resolution,x,y) = r.groups()
print "found ",resolution," x ",x," y ",y
if opt in ["--theme", "-t"]:
theme = arg
if opt in ["--song", "-s"]:
playing = arg
if opt in ["--diff", "-l"]:
difficulty = arg
if opt in ["--part", "-p"]:
part = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-n"]:
nbrplayers = int(arg)
# Load the configuration file.
if configFile is not None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.appName() + ".ini")
os.remove(fileName)
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
#Lysdestic - Allow support for manipulating fullscreen via CLI
if fullscreen is not None:
Config.set("video", "fullscreen", fullscreen)
#Lysdestic - Change resolution from CLI
if resolution is not None:
Config.set("video", "resolution", resolution)
if x is not None:
Config.set("video", "x", x)
Config.set("video","fullscreen",False)
if y is not None:
Config.set("video", "y", y)
Config.set("video","fullscreen",False)
#Lysdestic - Alter theme from CLI
if theme is not None:
Config.set("coffee", "themename", theme)
engine = GameEngine(config)
engine.cmdPlay = 0
# Check for a valid invocation of one-shot mode.
if playing is not None:
Log.debug('Validating song directory for one-shot mode.')
library = Config.get("game","base_library")
basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (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." % playing)
engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
playing = None
# Set up one-shot mode if the invocation is valid for it.
if playing is not None:
Log.debug('Entering one-shot mode.')
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
if difficulty is not None:
engine.cmdDiff = int(difficulty)
if part is not None:
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
Config.set("game", "players", nbrplayers)
if nbrplayers == 1:
Config.set("game", "game_mode", mode)
else:
#.........这里部分代码省略.........
示例6: main
def main():
playing = None
configFile = None
fullscreen = None
resolution = None
theme = None
#debug = False
difficulty = None
part = None
mode = 0
nbrplayers = 1
for opt, arg in opts:
if opt in ["--verbose", "-v"]:
Log.quiet = False
if opt in ["--config", "-c"]:
configFile = arg
if opt in ["--fullscreen", "-f"]:
fullscreen = arg
if opt in ["--resolution", "-r"]:
resolution = arg
if opt in ["--theme", "-t"]:
theme = arg
if opt in ["--song", "-s"]:
playing = arg
if opt in ["--part", "-p"]:
part = arg
if opt in ["--diff", "-d", "-l"]:
difficulty = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-n"]:
nbrplayers = int(arg)
# Load the configuration file.
if configFile is not None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
os.remove(fileName)
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
#Lysdestic - Allow support for manipulating fullscreen via CLI
if fullscreen is not None:
Config.set("video", "fullscreen", fullscreen)
#Lysdestic - Change resolution from CLI
if resolution is not None:
Config.set("video", "resolution", resolution)
#Lysdestic - Alter theme from CLI
if theme is not None:
Config.set("coffee", "themename", theme)
engine = GameEngine(config)
engine.cmdPlay = 0
# Check for a valid invocation of one-shot mode.
if playing is not None:
Log.debug('Validating song directory for one-shot mode.')
library = Config.get("game","base_library")
basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (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." % playing)
engine.startupMessages.append(_("Song directory provided ('%s') is not a valid song directory. Starting up FoFiX in standard mode.") % playing)
playing = None
# Set up one-shot mode if the invocation is valid for it.
if playing is not None:
Log.debug('Entering one-shot mode.')
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
if difficulty is not None:
engine.cmdDiff = int(difficulty)
if part is not None:
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
if nbrplayers == 1:
engine.cmdMode = nbrplayers, mode, 0
else:
engine.cmdMode = nbrplayers, 0, mode
encoding = Config.get("game", "encoding")
if encoding is not None:
#stump: XXX: Everything I have seen indicates that this is a
# horrible, horrible hack. Is there another way? Do we even need this?
reload(sys)
sys.setdefaultencoding(encoding)
# Play the intro video if it is present, we have the capability, and
# we are not in one-shot mode.
videoLayer = False
if videoAvailable and not engine.cmdPlay:
# TODO: Parameters to add to theme.ini:
#.........这里部分代码省略.........
示例7: open
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, #
# MA 02110-1301, USA. #
#####################################################################
import sys
import os
import Resource
quiet = True
if os.name == "posix": # evilynux - logfile in ~/.fretsonfire/ for GNU/Linux and MacOS X
logFile = open(os.path.join(Resource.getWritableResourcePath(), "fretsonfire.log"), "w")
else:
logFile = open("fretsonfire.log", "w") #MFH - local logfile!
encoding = "iso-8859-1"
if "-v" in sys.argv:
quiet = False
if os.name == "posix":
labels = {
"warn": "\033[1;33m(W)\033[0m",
"debug": "\033[1;34m(D)\033[0m",
"notice": "\033[1;32m(N)\033[0m",
"error": "\033[1;31m(E)\033[0m",
}
示例8: debugOut
def debugOut(self, engine):
try:
f = open("debug.log", "w+")
except IOError:
# fallback for unix (games dir read-only)
import Resource
# evilynux - Under MacOS X, put the logs in ~/Library/Logs
if( os.uname()[0] == "Darwin" ):
logFile = open(os.path.join(Resource.getWritableResourcePath(),
"..", "..", "Logs", Version.appName(),
"debug.log"), "w+")
else: # GNU/Linux et al.
f = open(os.path.join(Resource.getWritableResourcePath(), 'debug.log'), "w+")
version = Version.version()
currentDir = os.getcwd()
dataDir = Version.dataPath()
translationDir = dataDir + "/translations"
modsDir = dataDir + "/mods"
f.write("Date = %s\n" % datetime.datetime.now())
f.write("\nVersion = %s\n" % version)
f.write("\nOS = %s\n" % os.name)
f.write("\nCurrent Directory = %s\n" % currentDir)
self.directoryList(f, currentDir)
f.write("\nData Directory = %s\n" % dataDir)
self.directoryList(f, dataDir)
zip_path = os.path.join(dataDir, 'library.zip')
# no library.zip on regular unix installation
if os.path.exists(zip_path):
f.write("\nLibrary.zip\n")
zip = zipfile.ZipFile(zip_path, 'r')
for info in zip.infolist():
fileName = info.filename
fileCSize = info.compress_size
fileSize = info.file_size
fileDate = datetime.datetime(*(info.date_time))
f.write("%s, %s, %s, %s\n" % (fileName, fileCSize, fileSize, fileDate))
f.write("\nTranslation Directory = %s\n" % translationDir)
self.directoryList(f, translationDir)
f.write("\nMods Directory = %s\n" % modsDir)
self.directoryList(f, modsDir)
mods = os.listdir(modsDir)
for mod in mods:
modDir = os.path.join(modsDir, mod)
if os.path.isdir(modDir):
f.write("\nMod Directory = %s\n" % modDir)
self.directoryList(f, modDir)
f.write("\nFretsonfire.ini\n")
engine.config.config.write(f)
# No write() in Theme
#f.write("\nTheme.ini\n")
#Theme.write(f, engine.config)
f.write("\nStage.ini\n")
stage = Stage.Stage(self, self.engine.resource.fileName("stage.ini"))
stage.config.write(f)
f.close()
示例9: int
if opt in ["--play", "-p"]:
playing = arg
if opt in ["--diff", "-D"]:
difficulty = arg
if opt in ["--part", "-P"]:
part = arg
# evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-N"]:
nbrplayers = int(arg)
while True:
if configFile != None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.appName() + ".ini")
os.remove(fileName)
config = Config.load(Version.appName() + ".ini", setAsDefault=True)
else:
config = Config.load(configFile, setAsDefault=True)
else:
config = Config.load(Version.appName() + ".ini", setAsDefault=True)
engine = GameEngine(config)
engine.cmdPlay = 0
if playing != None:
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
engine.cmdDiff = int(difficulty)
engine.cmdPart = int(part)
示例10: main
def main():
"""Main thread"""
try:
opts, args = getopt.getopt(sys.argv[1:], "vdc:p:D:P:m:N:", ["verbose", "debug", "config=", "play=", "diff=", "part=", "mode=", "nbrplayers="])
except getopt.GetoptError:
print usage
sys.exit(1)
playing = None
configFile = None
debug = False
difficulty = 0
part = 0
mode = 0
nbrplayers = 1
for opt, arg in opts:
if opt in ["--verbose", "-v"]:
Log.quiet = False
if opt in ["--debug", "-d"]:
debug = True
if opt in ["--config", "-c"]:
configFile = arg
if opt in ["--play", "-p"]:
playing = arg
if opt in ["--diff", "-D"]:
difficulty = arg
if opt in ["--part", "-P"]:
part = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-N"]:
nbrplayers = int(arg)
while True:
if configFile != None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.appName() + ".ini")
os.remove(fileName)
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
engine = GameEngine(config)
engine.cmdPlay = 0
if playing != None:
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
engine.cmdDiff = int(difficulty)
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
Config.set("game", "players", nbrplayers)
Config.set("player0","mode_1p", mode)
Config.set("player1","mode_2p", mode)
if debug == True:
engine.setDebugModeEnabled(not engine.isDebugModeEnabled())
engine.debugLayer.debugOut(engine)
engine.quit()
break
encoding = Config.get("game", "encoding")
if encoding != None:
reload(sys)
sys.setdefaultencoding(encoding)
engine.setStartupLayer(MainMenu(engine))
try:
import psyco
psyco.profile()
except:
Log.warn("Unable to enable psyco.")
try:
while engine.run():
pass
except KeyboardInterrupt:
pass
if engine.restartRequested:
Log.notice("Restarting.")
engine.audio.close()
try:
# Determine whether were running from an exe or not
if hasattr(sys, "frozen"):
if os.name == "nt":
os.execl("FretsOnFire.exe", "FretsOnFire.exe", *sys.argv[1:])
elif sys.frozen == "macosx_app":
import string
import subprocess
appname = string.join(string.split(sys.executable, '/')[:-1], '/')
appname = appname+"/Frets on Fire"
subprocess.Popen(`appname`, shell=True)
else:
os.execl("./FretsOnFire", "./FretsOnFire", *sys.argv[1:])
else:
if os.name == "nt":
#.........这里部分代码省略.........
示例11: main
def main():
"""Main thread"""
try:
opts, args = getopt.getopt(sys.argv[1:], "vdc:f:r:t:s:l:p:m:n:", ["verbose", "debug", "config=", "fullscreen=", "resolution=", "theme=", "song=", "diff=", "part=", "mode=", "nbrplayers="])
except getopt.GetoptError:
print usage
sys.exit(1)
playing = None
configFile = None
fullscreen = None
resolution = None
theme = None
debug = False
difficulty = None
part = None
mode = 0
nbrplayers = 1
for opt, arg in opts:
if opt in ["--verbose", "-v"]:
Log.quiet = False
if opt in ["--debug", "-d"]:
debug = True
if opt in ["--config", "-c"]:
configFile = arg
if opt in ["--fullscreen", "-f"]:
fullscreen = arg
if opt in ["--resolution", "-r"]:
resolution = arg
if opt in ["--theme", "-t"]:
theme = arg
if opt in ["--song", "-s"]:
playing = arg
if opt in ["--diff", "-l"]:
difficulty = arg
if opt in ["--part", "-p"]:
part = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-n"]:
nbrplayers = int(arg)
while 1:
if configFile != None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.appName() + ".ini")
os.remove(fileName)
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.appName() + ".ini", setAsDefault = True)
#Lysdestic - Allow support for manipulating fullscreen via CLI
if fullscreen != None:
Config.set("video", "fullscreen", fullscreen)
#Lysdestic - Change resolution from CLI
if resolution != None:
Config.set("video", "resolution", resolution)
#Lysdestic - Alter theme from CLI
if theme != None:
Config.set("coffee", "themename", theme)
if playing != None:
library = Config.get("game","base_library")
basefolder = os.path.join(Version.dataPath(),library,"songs",playing)
if not (os.path.exists(os.path.join(basefolder, "song.ini")) and (os.path.exists(os.path.join(basefolder, "notes.mid")) or os.path.exists(os.path.join(basefolder, "notes-unedited.mid"))) and (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." % playing)
playing = None
engine = GameEngine(config)
engine.cmdPlay = 0
if playing != None:
Config.set("game", "selected_library", "songs")
Config.set("game", "selected_song", playing)
engine.cmdPlay = 1
if difficulty is not None:
engine.cmdDiff = int(difficulty)
if part is not None:
engine.cmdPart = int(part)
#evilynux - Multiplayer and mode selection support
Config.set("game", "players", nbrplayers)
if nbrplayers == 1:
Config.set("game", "game_mode", mode)
else:
Config.set("game", "game_mode", 0)
Config.set("game", "multiplayer_mode", mode)
if debug == True:
engine.setDebugModeEnabled(not engine.isDebugModeEnabled())
engine.debugLayer.debugOut(engine)
engine.quit()
break
encoding = Config.get("game", "encoding")
#.........这里部分代码省略.........
示例12: int
if opt in ["--song", "-s"]:
playing = arg
if opt in ["--part", "-p"]:
part = arg
if opt in ["--diff", "-d", "-l"]:
difficulty = arg
#evilynux - Multiplayer and mode selection support
if opt in ["--mode", "-m"]:
mode = int(arg)
if opt in ["--nbrplayers", "-n"]:
nbrplayers = int(arg)
# Load the configuration file.
if configFile is not None:
if configFile.lower() == "reset":
fileName = os.path.join(Resource.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".ini")
os.remove(fileName)
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
else:
config = Config.load(configFile, setAsDefault = True)
else:
config = Config.load(Version.PROGRAM_UNIXSTYLE_NAME + ".ini", setAsDefault = True)
#Lysdestic - Allow support for manipulating fullscreen via CLI
if fullscreen is not None:
Config.set("video", "fullscreen", fullscreen)
#Lysdestic - Change resolution from CLI
if resolution is not None:
Config.set("video", "resolution", resolution)
示例13: main
def main(self):
logging.info("Incubator started... " + self.start_time.strftime('%Y-%m-%d %H:%M:%S'))
self.send_notification("Incubator started")
self.ssr.set_point(self.config.get_temp())
# Start roller
self.roller.set_day(self.config.get_day())
self.roller.start()
web = Web.Web(self)
web.start()
lcd = Lcd()
temp_sensor = Resource.create_temp_sensor()
htu21d = Resource.create_humidity_sensor()
# Start SSR service
self.ssr.set_value(0)
self.ssr.start()
# Start buttons and relays
# self.io_handler.start()
i = 0
state = State()
state.set_day(self.get_days_from_start())
http_sender = HttpSender.HttpSender()
while self._running:
state.update_ts()
state.set_temp1(temp_sensor.read_temp())
pid = self.ssr.update(state.get_temp1())
state.set_pid(pid)
#if state.temp1 > 38.5:
# self.send_notification("High temp alert, {} gr".format(state.temp1))
if i % 10 == 0:
# Read humidity and temp each 10 seconds
try:
state.set_temp2(htu21d.read_temperature())
state.set_humidity(htu21d.read_humidity())
except:
self.send_notification("Failed to read htu21d")
self.ventilation.set_state(state)
state.set_humidity_level(self.ventilation.get_output_level())
http_sender.send("A123", state)
if i >= 30:
# Set new temp from config file
self.config.reload()
self.ssr.set_point(self.config.get_temp())
self.ssr.set_k(self.config.get_k())
self.ssr.set_i(self.config.get_i())
self.ventilation.set_point(self.get_humidity())
state.set_day(self.get_days_from_start())
if self.config.get_day() != state.get_day():
self.config.set_day(state.get_day())
self.config.save()
self.roller.set_day(state.get_day())
self.log_incubator_state(self.config, state)
# update web page
web.update(state, self.config)
i = 0
lcd.update(state, self.roller.get_minutes_from_last_roll())
sys.stdout.flush()
time.sleep(1)
i += 1
self.shutdown()
示例14: open
import sys
import os
import Resource
import Version
import traceback
import time
import warnings
## Whether to output log entries to stdout in addition to the logfile.
quiet = True
## File object representing the logfile.
if os.name == "posix": # evilynux - logfile in ~/.fofix/ for GNU/Linux and MacOS X
# evilynux - Under MacOS X, put the logs in ~/Library/Logs
if os.uname()[0] == "Darwin":
logFile = open(os.path.join(Resource.getWritableResourcePath(),
"..", "..", "Logs",
Version.PROGRAM_UNIXSTYLE_NAME + ".log"), "w")
else: # GNU/Linux et al.
logFile = open(os.path.join(Resource.getWritableResourcePath(), Version.PROGRAM_UNIXSTYLE_NAME + ".log"), "w")
else:
logFile = open(Version.PROGRAM_UNIXSTYLE_NAME + ".log", "w") #MFH - local logfile!
## Character encoding to use for logging.
encoding = "iso-8859-1"
if "-v" in sys.argv or "--verbose" in sys.argv:
quiet = False
## Labels for different priorities, as output to the logfile.
labels = {
示例15: _
Config.define("player", "leftymode", int, 0, text = _("Lefty Mode"), options = {0: _("Off"), 1: _("On")})
Config.define("player", "drumflip", int, 0, text = _("Drum Flip"), options = {0: _("Off"), 1: _("On")})
Config.define("player", "two_chord_max", int, 0, text = _("Two-Chord Max"), options = {0: _("Off"), 1: _("On")})
Config.define("player", "assist_mode", int, 0, text = _("Assist Mode"), options = {0: _("Off"), 1: _("Easy Assist"), 2: _("Medium Assist")})
Config.define("player", "auto_kick", int, 0, text = _("Auto Kick"), options = {0: _("Off"), 1: _("On")})
Config.define("player", "controller", int, 0)
controlpath = os.path.join("data","users","controllers")
playerpath = os.path.join("data","users","players")
if not hasattr(sys,"frozen"):
controlpath = os.path.join("..",controlpath)
playerpath = os.path.join("..",playerpath)
#stump: permission fix for read-only system-wide installation
if not os.path.isfile(os.path.join(playerpath, 'FoFiX-players.cache')):
baseuserpath = os.path.join(Resource.getWritableResourcePath(), 'users')
newcontrolpath = os.path.join(baseuserpath, 'controllers')
newplayerpath = os.path.join(baseuserpath, 'players')
for old, new in [(controlpath, newcontrolpath), (playerpath, newplayerpath)]:
if not os.path.isdir(new):
os.makedirs(new)
for f in os.listdir(old):
shutil.copy(os.path.join(old, f), os.path.join(new, f))
controlpath = newcontrolpath
playerpath = newplayerpath
control0 = None
control1 = None
control2 = None
control3 = None
controlDict = {}