本文整理汇总了Python中launcher.launcher_config.LauncherConfig.set方法的典型用法代码示例。如果您正苦于以下问题:Python LauncherConfig.set方法的具体用法?Python LauncherConfig.set怎么用?Python LauncherConfig.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launcher.launcher_config.LauncherConfig
的用法示例。
在下文中一共展示了LauncherConfig.set方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_model_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_model_changed(self):
print("ModelGroup.on_model_change\n")
index = self.model_choice.get_index()
model = self.model_ids[index]
if model == "A500":
# The default model (A500) can be specified with the empty string
model = ""
LauncherConfig.set("amiga_model", model)
示例2: on_ext_rom_type_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_ext_rom_type_changed(self):
index = self.ext_rom_type_choice.get_index()
if index == 0:
if LauncherConfig.get("kickstart_ext_file") == "":
return
LauncherConfig.set("kickstart_ext_file", "")
else:
LauncherConfig.set("kickstart_ext_file",
LauncherConfig.get("x_kickstart_ext_file"))
LauncherConfig.update_kickstart()
示例3: function
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def function():
if progress == "__run__":
self.cancel_button.disable()
# Hide dialog after 1.5 seconds. The reason for delaying it
# is to avoid "confusing" flickering if/when the dialog is
# only shown for a split second.
# fsui.call_later(1500, hide_function)
LauncherConfig.set(
"__progress", gettext("Running: Emulator"))
else:
self.sub_title_label.set_text(progress)
LauncherConfig.set(
"__progress", "Preparing: {}".format(progress))
示例4: set_rating_for_variant
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def set_rating_for_variant(variant_uuid, rating):
# FIXME: Do asynchronously, add to queue
client = OGDClient()
result = client.rate_variant(variant_uuid, like=rating)
like_rating = result.get("like", 0)
work_rating = result.get("work", 0)
database = Database.instance()
cursor = database.cursor()
cursor.execute(
"DELETE FROM rating WHERE game_uuid = ?", (variant_uuid,))
cursor.execute(
"INSERT INTO rating (game_uuid, work_rating, like_rating) "
"VALUES (?, ?, ?)", (variant_uuid, work_rating, like_rating))
database.commit()
LauncherConfig.set("variant_rating", str(like_rating))
示例5: start_local_game_other
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def start_local_game_other(cls):
database_name = LauncherConfig.get("__database")
variant_uuid = LauncherConfig.get("variant_uuid")
assert variant_uuid
fsgs.game.set_from_variant_uuid(database_name, variant_uuid)
platform_handler = PlatformHandler.create(fsgs.game.platform.id)
runner = platform_handler.get_runner(fsgs)
task = RunnerTask(runner)
from .ui.launcher_window import LauncherWindow
dialog = LaunchDialog(
LauncherWindow.current(), gettext("Launching Game"), task)
dialog.show()
LauncherConfig.set("__running", "1")
task.start()
示例6: on_sub_model_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_sub_model_changed(self):
print("ModelGroup.on_sub_model_change\n")
if self.sub_model_updating:
print("sub model list is currently updating")
return
index = self.sub_model_choice.get_index()
# if index == 0:
# # The default model (A500) can be specified with the empty string
# model = ""
# else:
model = self.model_ids[self.model_choice.get_index()]
sub_model = self.sub_model_ids[index]
if sub_model:
LauncherConfig.set("amiga_model", model + "/" + sub_model)
else:
LauncherConfig.set("amiga_model", model)
if Amiga.is_cd_based(LauncherConfig):
FloppyManager.clear_all()
else:
CDManager.clear_all()
示例7: __closed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def __closed(self):
LauncherConfig.set("__running", "")
self.cancel()
return False
示例8: __setitem__
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def __setitem__(self, key, value):
LauncherConfig.set(key, value)
示例9: on_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_changed(self):
LauncherConfig.set(Option.SAVE_DISK, "" if self.is_checked() else "0")
示例10: start_local_game_amiga
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def start_local_game_amiga(cls):
# make sure x_kickstart_file is initialized
LauncherConfig.set_kickstart_from_model()
# if not Config.get("x_kickstart_file"): # or not \
# # os.path.exists(Config.get("kickstart_file")):
# fsui.show_error(
# gettext("No kickstart found for this model. Use the 'Import "
# "Kickstarts' function from the menu."))
# return
cs = Amiga.get_model_config(
LauncherConfig.get("amiga_model"))["ext_roms"]
if len(cs) > 0:
# extended kickstart ROM is needed
if not LauncherConfig.get("x_kickstart_ext_file"):
fsui.show_error(
gettext("No extended kickstart found for this model. "
"Try 'scan' function."))
return
config = LauncherConfig.copy()
prepared_config = cls.prepare_config(config)
model = LauncherConfig.get("amiga_model")
if model.startswith("CD32"):
platform = "CD32"
elif model == "CDTV":
platform = "CDTV"
else:
platform = "Amiga"
name = LauncherSettings.get("config_name")
uuid = LauncherConfig.get("x_game_uuid")
from fsgs.SaveStateHandler import SaveStateHandler
save_state_handler = SaveStateHandler(fsgs, name, platform, uuid)
from fsgs.amiga.LaunchHandler import LaunchHandler
launch_handler = LaunchHandler(fsgs, name, prepared_config,
save_state_handler)
from .ui.launcher_window import LauncherWindow
task = AmigaLaunchTask(launch_handler)
# dialog = LaunchDialog(MainWindow.instance, launch_handler)
dialog = LaunchDialog(
LauncherWindow.current(), gettext("Launching FS-UAE"), task)
dialog.show()
def on_show_license_information(license_text):
unused(license_text)
# FIXME: don't depend on wx here
# noinspection PyUnresolvedReferences
# import wx
# license_dialog = wx.MessageDialog(
# dialog, license_text, _("Terms of Use"),
# wx.OK | wx.CANCEL | wx.CENTRE)
# license_dialog.CenterOnParent()
# result = license_dialog.ShowModal()
# return result == wx.ID_OK
# FIXME
return True
fsgs.file.on_show_license_information = on_show_license_information
LauncherConfig.set("__running", "1")
task.start()
示例11: on_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_changed():
val = text_field.get_text()
LauncherConfig.set(key, val.strip())
示例12: on_config_name_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_config_name_changed(self):
text = self.config_name_field.get_text().strip()
LauncherSettings.set("config_name", text)
LauncherConfig.set("__changed", "1")
示例13: on_accuracy_changed
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def on_accuracy_changed(self):
index = self.accuracy_choice.get_index()
if index == 0:
LauncherConfig.set("accuracy", "")
else:
LauncherConfig.set("accuracy", str(1 - index))
示例14: save_config
# 需要导入模块: from launcher.launcher_config import LauncherConfig [as 别名]
# 或者: from launcher.launcher_config.LauncherConfig import set [as 别名]
def save_config():
print("SaveButton.save_config")
database = Database.get_instance()
name = LauncherSettings.get("config_name").strip()
if not name:
print("no config_name")
# FIXME: notify user
return
file_name = name + ".fs-uae"
path = os.path.join(
FSGSDirectories.get_configurations_dir(), file_name)
with io.open(path, "w", encoding="UTF-8") as f:
f.write("# FS-UAE configuration saved by FS-UAE Launcher\n")
f.write("# Last saved: {0}\n".format(
datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S")))
f.write("\n[fs-uae]\n")
keys = sorted(fsgs.config.values.keys())
for key in keys:
value = LauncherConfig.get(key)
if key.startswith("__"):
continue
if key in LauncherConfig.no_save_keys_set:
continue
# elif key == "joystick_port_2_mode" and value == "nothing":
# continue
# elif key == "joystick_port_3_mode" and value == "nothing":
# continue
if value == LauncherConfig.default_config.get(key, ""):
continue
if value:
f.write("{0} = {1}\n".format(key, value))
# scanner = ConfigurationScanner()
# search = ConfigurationScanner.create_configuration_search(name)
# name = scanner.create_configuration_name(name)
# print("adding", path)
# # deleting the path from the database first in case it already exists
# database.delete_configuration(path=path)
# database.delete_file(path=path)
# database.add_file(path=path)
# database.add_configuration(
# path=path, uuid="", name=name, scan=0, search=search)
file_database = FileDatabase.get_instance()
scanner = ConfigurationScanner()
print("[save config] adding config", path)
file_database.delete_file(path=path)
with open(path, "rb") as f:
sha1 = hashlib.sha1(f.read()).hexdigest()
file_database.add_file(path=path, sha1=sha1)
game_id = database.add_game(
path=path, name=scanner.create_configuration_name(name))
database.update_game_search_terms(
game_id, scanner.create_search_terms(name))
database.commit()
file_database.commit()
LauncherSettings.set("__config_refresh", str(time.time()))
# Settings.set("config_changed", "0")
LauncherConfig.set("__changed", "0")