本文整理汇总了Python中fsbc.settings.Settings.instance方法的典型用法代码示例。如果您正苦于以下问题:Python Settings.instance方法的具体用法?Python Settings.instance怎么用?Python Settings.instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fsbc.settings.Settings
的用法示例。
在下文中一共展示了Settings.instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: use_audio_frequency
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def use_audio_frequency(self):
if Settings.instance()["audio_frequency"]:
try:
return int(Settings.instance()["audio_frequency"])
except ValueError:
pass
return 48000
示例2: app_main
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def app_main():
FSGSDirectories.initialize()
Settings.instance().load()
print("")
print("Directories:")
print("* base_dir =", FSGSDirectories.get_base_dir())
print("* cache_dir =", FSGSDirectories.get_cache_dir())
print("* cdroms_dir =", FSGSDirectories.get_cdroms_dir())
print("* configurations_dir =", FSGSDirectories.get_configurations_dir())
print("* controllers_dir =", FSGSDirectories.get_controllers_dir())
print("* covers_dir =", FSGSDirectories.get_covers_dir())
print("* data_dir =", FSGSDirectories.get_data_dir())
print("* downloads_dir =", FSGSDirectories.downloads_dir())
print("* floppies_dir =", FSGSDirectories.get_floppies_dir())
print("* hard_drives_dir =", FSGSDirectories.get_hard_drives_dir())
# print("* images_dir =", FSGSDirectories.get_images_dir())
print("* kickstarts_dir =", FSGSDirectories.get_kickstarts_dir())
print("* launcher_dir =", FSGSDirectories.get_launcher_dir())
print("* logs_dir =", FSGSDirectories.get_logs_dir())
print("* plugins_dir =", FSGSDirectories.get_plugins_dir())
# print("* portable_dir =", FSGSDirectories.portable_dir())
print("* save_states_dir =", FSGSDirectories.get_save_states_dir())
print("* screenshots_dir =", FSGSDirectories.get_screenshots_dir())
print("* screenshots_output_dir =", FSGSDirectories.screenshots_output_dir())
print("* themes_dir =", FSGSDirectories.get_themes_dir())
print("* titles_dir =", FSGSDirectories.get_titles_dir())
print("* whdload_dir =", FSGSDirectories.get_whdload_dir())
print("")
示例3: show_auto
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def show_auto(self):
if fullscreen():
geometry = screen_geometry()
self.set_fullscreen(True, geometry)
Settings.instance().set("__cursor_x", geometry[2])
Settings.instance().set("__cursor_y", geometry[3])
elif maximized():
x, y, w, h = screen_geometry()
self.set_maximized(True, (x, y, 960, 540))
else:
super().show()
示例4: prepare
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def prepare(self):
print("AmigaRunner.prepare")
# self.temp_dir = self.fsgs.temp_dir("amiga")
# self.change_handler = GameChangeHandler(self.temp_dir)
# self.firmware_dir = self.prepare_firmware("Amiga Firmware")
# config = self.fsgs.config.copy()
model = self.config["amiga_model"]
if model.startswith("CD32"):
platform = "CD32"
elif model == "CDTV":
platform = "CDTV"
else:
platform = "Amiga"
# name = Settings.get("config_name")
# name = self.fsgs.game.name
# uuid = Config.get("x_game_uuid")
# uuid = None
from fsgs.SaveStateHandler import SaveStateHandler
save_state_handler = SaveStateHandler(
self.fsgs, self.get_name(), platform)
self.config["joystick_port_0"] = self.ports[1].device_id or ""
self.config["joystick_port_1"] = self.ports[0].device_id or ""
self.launch_handler = LaunchHandler(
self.fsgs, self.get_name(), self.config, save_state_handler)
# self.change_handler.init(self.fsgs.get_game_state_dir(),
# ignore=["*.uss", "*.sdf"])
# self.launch_handler.config["joystick_port_0"] = \
# self.inputs[1].device_id
# self.launch_handler.config["joystick_port_1"] = \
# self.inputs[0].device_id
if self.use_fullscreen():
self.launch_handler.config["fullscreen"] = "1"
if not self.launch_handler.config.get("fullscreen_mode", ""):
# Check if fullscreen mode is overridden by temporary setting.
if Settings.instance()["__fullscreen_mode"]:
self.launch_handler.config["fullscreen_mode"] = \
Settings.instance()["__fullscreen_mode"]
else:
self.launch_handler.config["fullscreen"] = "0"
self.launch_handler.prepare()
示例5: __init__
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def __init__(self, fsgs):
self.fsgs = fsgs
self.args = []
self.env = {}
self.emulator = "no-emulator"
self.config = defaultdict(str)
for key, value in Settings.instance().values.items():
# FIXME: re-enable this check?
# if key in Config.config_keys:
# print("... ignoring config key from settings:", key)
# continue
self.config[key] = value
for key, value in self.fsgs.config.items():
self.config[key] = value
self.ports = []
for port_info in self.PORTS:
port = Port(port_info["description"])
port.types = port_info["types"]
self.ports.append(port)
self.__vsync = False
self.__game_temp_file = None
self.temp_root = TemporaryItem(
root=None, prefix="fsgs-", suffix="tmp", dir=True)
# self.cwd = self.create_temp_dir("cwd")
# self.home = self.cwd
# Default current working directory for the emulator.
self.cwd = self.temp_dir("cwd")
# Fake home directory for the emulator.
self.home = self.temp_dir("home")
示例6: maximized
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def maximized():
if check_argument("window") == "1":
return False
value = check_argument("maximize")
if not value:
value = Settings.instance().get("arcade_maximized")
return value != "0"
示例7: load_settings
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def load_settings(cls):
if cls.settings_loaded:
return
cls.settings_loaded = True
settings = Settings.instance()
settings.load()
path = settings.path
# path = app.get_settings_path()
print("loading last config from " + repr(path))
if not os.path.exists(path):
print("settings file does not exist")
# noinspection PyArgumentList
cp = ConfigParser(interpolation=None)
try:
cp.read([path])
except Exception as e:
print(repr(e))
return
config = {}
try:
keys = cp.options("config")
except NoSectionError:
keys = []
for key in keys:
config[key] = fs.from_utf8_str(cp.get("config", key))
for key, value in config.items():
print("loaded", key, value)
fsgs.config.values[key] = value
# FIXME: When the last loaded config was a game database config, any
# options loaded via argv will be overwritten when the game config
# is loaded from the database. We should be able to prevent this...
fsgs.config.add_from_argv()
示例8: monitor
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def monitor():
value = check_argument("monitor")
if not value:
value = Settings.instance().get("monitor")
if not value:
value = "middle-left"
return value
示例9: use_audio_frequency
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def use_audio_frequency(self):
if self.options[Option.AUDIO_FREQUENCY]:
try:
return int(Settings.instance()[Option.AUDIO_FREQUENCY])
except ValueError:
pass
return 48000
示例10: update_texture
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def update_texture(self):
# TODO: Ideally, this class should listen for settings changes.
if Settings.instance()["keep_aspect"] == "0":
texture = Texture.stretch
else:
texture = Texture.aspect
self.normal_texture = texture
self.selected_texture = texture
示例11: use_fullscreen
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def use_fullscreen(self):
# FIXME: not a very nice hack to hard-code application name here...
if Application.instance():
if Application.instance().name == "fs-uae-arcade":
return True
if Settings.instance()["fullscreen"] == "0":
return False
return True
示例12: screenshots_output_dir
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def screenshots_output_dir(cls):
path = Settings.instance()["screenshots_output_dir"]
if not path:
path = cls.portable_dir("screenshots_output_dir")
if not path:
path = os.path.join(get_documents_dir(), "Screenshots")
if not os.path.exists(path):
os.makedirs(path)
return path
示例13: init_options
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def init_options(self):
for key, value in Settings.instance().values.items():
# FIXME: re-enable this check?
# if key in Config.config_keys:
# print("... ignoring config key from settings:", key)
# continue
self.options[key] = value
for key, value in self.fsgc.config.items():
self.options[key] = value
示例14: fullscreen
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def fullscreen():
# If we have explicitly used --window as arguments, do
# not enable fullscreen regardless of settings.
if check_argument("window", ["maximize"]) in ["1", "maximize"]:
return False
# if check_argument("maximize") == "1":
# return False
value = check_argument("fullscreen")
if not value:
value = Settings.instance().get("arcade_fullscreen")
return value != "0"
示例15: openretro_server
# 需要导入模块: from fsbc.settings import Settings [as 别名]
# 或者: from fsbc.settings.Settings import instance [as 别名]
def openretro_server():
server = Settings.instance()["database_server"]
if not server:
server = default_openretro_server_from_file()
if not server:
server = default_openretro_server()
if "://" in server:
scheme, host = server.split("://")
else:
scheme = "http"
host = server
return scheme, host