本文整理汇总了Python中launcher.launcher_settings.LauncherSettings.get方法的典型用法代码示例。如果您正苦于以下问题:Python LauncherSettings.get方法的具体用法?Python LauncherSettings.get怎么用?Python LauncherSettings.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launcher.launcher_settings.LauncherSettings
的用法示例。
在下文中一共展示了LauncherSettings.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: center_window
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def center_window(cls, args, env):
# FIXME: does not really belong here (dependency loop)
from launcher.launcher_config import LauncherConfig
from launcher.launcher_settings import LauncherSettings
width = (LauncherConfig.get("window_width") or
LauncherSettings.get("window_width"))
height = (LauncherConfig.get("window_height") or
LauncherSettings.get("window_height"))
try:
width = int(width)
except:
width = 960
try:
height = int(height)
except:
height = 540
from launcher.ui.launcher_window import LauncherWindow
if LauncherWindow.current() is None:
return
main_w, main_h = LauncherWindow.current().get_size()
main_x, main_y = LauncherWindow.current().get_position()
x = main_x + (main_w - width) // 2
y = main_y + (main_h - height) // 2
# FIXME: re-implement without wx
# if windows:
# import wx
# y += wx.SystemSettings_GetMetric(wx.SYS_CAPTION_Y)
env[str("SDL_VIDEO_WINDOW_POS")] = str("{0},{1}".format(x, y))
args.append("--window-x={0}".format(x))
args.append("--window-y={0}".format(y))
示例2: __init__
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def __init__(self, parent):
StatusElement.__init__(self, parent)
self.error_icon = Image("launcher:res/16/error.png")
self.warning_icon = Image("launcher:res/16/warning_3.png")
self.notice_icon = Image("launcher:res/16/information.png")
self.icons = [
self.error_icon,
self.warning_icon,
self.notice_icon,
]
self.coordinates = []
self.warnings = []
self.game_notice = ""
self.variant_notice = ""
self.variant_warning = ""
self.variant_error = ""
self.joy_emu_conflict = ""
self.using_joy_emu = False
self.kickstart_file = ""
self.x_kickstart_file_sha1 = ""
self.update_available = ""
self.__error = ""
self.x_missing_files = ""
self.download_page = ""
self.download_file = ""
self.amiga_model = ""
self.amiga_model_calculated = ""
self.chip_memory = ""
self.chip_memory_calculated = 0
self.outdated_plugins = []
self.custom_config = set()
self.custom_uae_config = set()
self.settings_config_keys = set()
plugin_manager = PluginManager.instance()
for plugin in plugin_manager.plugins():
if plugin.outdated:
self.outdated_plugins.append(plugin.name)
ConfigBehavior(self, [
"x_game_notice", "x_variant_notice", "x_variant_warning",
"x_variant_error", "x_joy_emu_conflict", "amiga_model",
"x_kickstart_file_sha1", "kickstart_file", "download_page",
"download_file", "x_missing_files", "__error",
"chip_memory", "jit_compiler"])
SettingsBehavior(self, ["__update_available"])
LauncherConfig.add_listener(self)
for key in JOYSTICK_KEYS:
self.on_config(key, LauncherConfig.get(key))
for key in LauncherConfig.keys():
if LauncherConfig.is_custom_uae_option(key):
self.on_config(key, LauncherConfig.get(key))
elif LauncherConfig.is_custom_option(key):
self.on_config(key, LauncherConfig.get(key))
LauncherSettings.add_listener(self)
for key in LauncherSettings.keys():
if LauncherConfig.is_config_only_option(key):
self.on_setting(key, LauncherSettings.get(key))
示例3: update_environment_with_centering_info
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def update_environment_with_centering_info(self, env):
# FIXME: does not really belong here (dependency loop)
from launcher.launcher_config import LauncherConfig
from launcher.launcher_settings import LauncherSettings
width = LauncherConfig.get("window_width") or LauncherSettings.get(
"window_width"
)
height = LauncherConfig.get("window_height") or LauncherSettings.get(
"window_height"
)
try:
width = int(width)
except:
width = 960
try:
height = int(height)
except:
height = 540
from launcher.ui.launcherwindow import LauncherWindow
if LauncherWindow.current() is None:
return
main_w, main_h = LauncherWindow.current().get_size()
main_x, main_y = LauncherWindow.current().get_position()
x = main_x + (main_w - width) // 2
y = main_y + (main_h - height) // 2
# FIXME: REMOVE
env["FSGS_WINDOW_X"] = str(x)
env["FSGS_WINDOW_Y"] = str(y)
# FIXME: REMOVE
env["SDL_VIDEO_WINDOW_POS"] = str("{0},{1}".format(x, y))
env["FSGS_WINDOW_POS"] = str("{0},{1}".format(x, y))
env["FSGS_WINDOW_CENTER"] = "{0},{1}".format(
main_x + main_w // 2, main_y + main_h // 2
)
示例4: __init__
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def __init__(self, parent, names):
parent.__settings_enable_behavior = self
self._parent = weakref.ref(parent)
self._names = set(names)
LauncherSettings.add_listener(self)
try:
parent.destroyed.connect(self.on_parent_destroyed)
except AttributeError:
print("WARNING: SettingsBehavior without remove_listener "
"implementation")
for name in names:
# Broadcast initial value
self.on_setting(name, LauncherSettings.get(name))
示例5: update_widgets
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def update_widgets(self):
value = LauncherSettings.get("video_sync")
vblank = value in ["1", "auto", "full", "vblank"]
full = value in ["1", "auto", "full"]
# self.full_sync_checkbox.enable(vblank)
self.sync_method_group.label.enable(vblank)
self.sync_method_group.widget.enable(vblank)
self.sync_method_group.help_button.enable(vblank)
self.sync_method_label.enable(vblank)
# self.smooth_label.enable(vblank)
self.low_latency_group.label.enable(full)
self.low_latency_group.widget.enable(full)
self.low_latency_group.help_button.enable(full)
示例6: load_settings
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [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
for key in LauncherSettings.old_keys:
if app.settings.get(key):
print("[SETTINGS] Removing old key", key)
app.settings.set(key, "")
if fsgs.config.add_from_argv():
print("[CONFIG] Configuration specified via command line")
# Prevent the launcher from loading the last used game
LauncherSettings.set("parent_uuid", "")
elif LauncherSettings.get("config_path"):
if LauncherConfig.load_file(LauncherSettings.get("config_path")):
print("[CONFIG] Loaded last configuration file")
else:
print("[CONFIG] Failed to load last configuration file")
LauncherConfig.load_default_config()
pass
示例7: __init__
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def __init__(self, parent):
fsui.Choice.__init__(self, parent)
# FIXME: include in () what language is currently the automatic one
selected_language = LauncherSettings.get("language")
k = 0
selected_index = 0
for label, language_key, icon_name in LANGUAGE_ITEMS:
self.add_item(label, fsui.Image(
"workspace:res/16/flag-{0}.png".format(icon_name)))
if language_key == selected_language:
selected_index = k
k += 1
if selected_index > 0:
self.set_index(selected_index)
示例8: on_remove_button
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def on_remove_button(self):
path = self.list_view.get_item(self.list_view.get_index())
search_path = LauncherSettings.get("search_path")
search_path = [x.strip() for x in search_path.split(";") if x.strip()]
for i in range(len(search_path)):
if search_path[i].startswith("-"):
if path == search_path[i][1:]:
# Already removed.
break
else:
if search_path[i] == path:
search_path.remove(search_path[i])
break
default_paths = FSGSDirectories.get_default_search_path()
if path in default_paths:
search_path.append("-" + path)
LauncherSettings.set("search_path", ";".join(search_path))
示例9: on_add_button
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def on_add_button(self):
search_path = LauncherSettings.get("search_path")
search_path = [x.strip() for x in search_path.split(";") if x.strip()]
path = fsui.pick_directory(parent=self.get_window())
if path:
for i in range(len(search_path)):
if search_path[i].startswith("-"):
if path == search_path[i][1:]:
search_path.remove(search_path[i])
break
else:
if search_path[i] == path:
# Already added.
break
else:
default_paths = FSGSDirectories.get_default_search_path()
if path not in default_paths:
search_path.append(path)
LauncherSettings.set("search_path", ";".join(search_path))
示例10: expand_path
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def expand_path(cls, path, default_dir=None):
if path and path[0] == "$":
cmp_path = path.upper().replace("\\", "/")
if cmp_path.startswith("$BASE/"):
return cls.join(cls.get_base_dir(), path[6:])
if cmp_path.startswith("$CONFIG/"):
# FIXME: dependency loop, have FS-UAE Launcher register
# this prefix with this class instead
from launcher.launcher_settings import LauncherSettings
config_path = LauncherSettings.get("config_path")
if config_path:
return cls.join(os.path.dirname(config_path), path[8:])
if cmp_path.startswith("$HOME/"):
return cls.join(cls.get_home_dir(), path[6:])
# FIXME: $base_dir is deprecated
if cmp_path.startswith("$BASE_DIR/"):
return cls.join(cls.get_base_dir(), path[10:])
elif not os.path.isabs(path) and default_dir is not None:
return os.path.join(default_dir, path)
return path
示例11: get_search_path
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def get_search_path(cls):
paths = FSGSDirectories.get_default_search_path()
search_path = LauncherSettings.get("search_path")
for p in search_path.split(";"):
p = p.strip()
if not p:
continue
elif p[0] == "-":
p = p[1:]
if p in paths:
paths.remove(p)
else:
if p not in paths:
paths.append(p)
# The Configurations dir is always scanned on startup (whenever
# modification time has changed). If we don't include it here too
# always, the result will be that the configs sometimes appear (on
# startup) and disappear (on scan).
if not FSGSDirectories.get_configurations_dir() in paths:
paths.append(FSGSDirectories.get_configurations_dir())
# Likewise, we force the Kickstarts directory to always be scanned.
if not FSGSDirectories.get_kickstarts_dir() in paths:
paths.append(FSGSDirectories.get_kickstarts_dir())
return paths
示例12: __init__
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def __init__(self, parent):
fsui.Panel.__init__(self, parent)
Skin.set_background_color(self)
self.layout = fsui.HorizontalLayout()
vert_layout = fsui.VerticalLayout()
self.layout.add(vert_layout, fill=True, expand=True)
hor_layout = fsui.HorizontalLayout()
vert_layout.add(hor_layout, fill=True)
label_stand_in = fsui.Panel(self)
tw, th = label_stand_in.measure_text("Games")
label_stand_in.set_min_height(th)
hor_layout.add(label_stand_in, margin_top=10, margin_bottom=10)
hor_layout.add(NewButton(self), margin_left=10, margin_right=10)
game_list_selector = GameListSelector(self)
game_list_selector.set_min_width(250)
game_list_selector.setMaximumWidth(250)
game_list_selector.changed.connect(self.on_game_list_changed)
hor_layout.add(game_list_selector, expand=False, margin_left=10)
self.text_field = fsui.TextField(
self, LauncherSettings.get("config_search"))
self.text_field.on_changed = self.on_search_changed
if VariantsBrowser.use_horizontal_layout():
# window is big enough to use fixed size
# self.text_field.set_min_width(210)
self.text_field.set_min_width(229)
hor_layout.add(
self.text_field, expand=False, margin=10, margin_top=0,
margin_bottom=0)
else:
hor_layout.add(
self.text_field, expand=True, margin=10, margin_top=0,
margin_bottom=0)
# self.refresh_button = IconButton(self, "refresh_button.png")
# self.refresh_button.set_tooltip(
# gettext("Refresh Game Configurations from Online Database"))
# self.refresh_button.activated.connect(self.on_refresh_button)
# hor_layout.add(
# self.refresh_button, margin=10, margin_top=0, margin_bottom=0)
self.configurations_browser = ConfigurationsBrowser(self)
vert_layout.add(
self.configurations_browser, fill=True, expand=3, margin=10)
self.variants_panel = fsui.Panel(self)
vert_layout.add(self.variants_panel, fill=True, expand=False,
margin=10, margin_top=20)
self.variants_panel.layout = fsui.HorizontalLayout()
self.variants_browser = VariantsBrowser(self.variants_panel)
# Do not use fill=True with the default OS X theme at least,
# if you do the item will be rendered with the old Aqua look
self.variants_panel.layout.add(
self.variants_browser, fill=False, expand=True)
# for rating in [1, 4, 5]:
# button = RatingButton(self.variants_panel, rating)
# self.variants_panel.layout.add(button, margin_left=5, fill=True)
self.variants_panel.layout.add(
RatingChoice(self.variants_panel), margin_left=5, fill=True)
self.config_panel = fsui.Panel(self)
vert_layout.add(self.config_panel, fill=True, expand=False,
margin_bottom=10, margin_top=20)
self.config_panel.layout = fsui.VerticalLayout()
self.config_group = ConfigGroup(self.config_panel, new_button=False)
self.config_panel.layout.add(self.config_group, fill=True, expand=True)
LauncherSettings.add_listener(self)
self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))
示例13: start_local_game_amiga
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [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()
示例14: save_config
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [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")
示例15: __init__
# 需要导入模块: from launcher.launcher_settings import LauncherSettings [as 别名]
# 或者: from launcher.launcher_settings.LauncherSettings import get [as 别名]
def __init__(self, parent):
super().__init__(parent)
icon = fsui.Icon("video-settings", "pkg:workspace")
gettext("Video Synchronization Settings")
title = gettext("Synchronization")
subtitle = gettext("Synchronize FS-UAE with your display for "
"smooth video")
self.add_header(icon, title, subtitle)
label = fsui.MultiLineLabel(self, gettext(
"Enabling the following option will synchronize the emulation "
"to the display when the emulation refresh rate matches the"
"screen refresh rate."), 640)
self.layout.add(label, fill=True, margin_top=0)
self.video_sync_group = self.add_option("video_sync")
self.low_latency_group = self.add_option("low_latency_vsync")
# label = fsui.MultiLineLabel(self, gettext(
# "Enabling the following option will prevent tearing from "
# "occurring, but will also use more CPU. Input latency "
# "may become slightly higher."), 640)
# self.layout.add(label, fill=True, margin_top=0)
# self.vblank_checkbox = fsui.HeadingCheckBox(self, gettext(
# "Synchronize buffer swaps with display (prevents tearing)"))
# self.layout.add(self.vblank_checkbox, margin_top=20)
self.sync_method_label = fsui.MultiLineLabel(self, gettext(
"Depending on your OS and OpenGL drivers, synchronizing "
"can use needlessly much CPU (esp. applies to "
"Linux). You can experiment with different sync methods "
"to improve performance."), 640)
self.layout.add(self.sync_method_label, fill=True, margin_top=20)
self.sync_method_group = self.add_option("video_sync_method")
# self.smooth_label = fsui.MultiLineLabel(self, gettext(
# "In order to get really smooth Amiga graphics, you need to "
# "enable the following option, and also make sure your display "
# "is running at 50Hz (for PAL) or 60Hz (for NTSC)."), 640)
# self.layout.add(self.smooth_label, fill=True, margin_top=20)
# self.full_sync_checkbox = fsui.HeadingCheckBox(self, gettext(
# "Also synchronize emulation with display when possible "
# "(smooth scrolling)"))
# self.layout.add(self.full_sync_checkbox, margin_top=20)
self.layout.add_spacer(0, expand=True)
hori_layout = fsui.HorizontalLayout()
self.layout.add(hori_layout, fill=True, margin_top=10)
hori_layout.add(fsui.ImageView(self, fsui.Image(
"launcher:res/16/world_link.png")))
label = fsui.URLLabel(self, gettext(
"How to achieve perfectly smooth scrolling"),
"http://fs-uae.net/perfectly-smooth-scrolling")
hori_layout.add(label, margin_left=6)
text = gettext(
"Synchronizing with the display can in some cases cause "
"increased stuttering and low frame rates (esp. in some Linux "
"desktop environments with compositing enabled).")
link = (" <a href='https://fs-uae.net/video-synchronization-issues'>"
"{0}</a>.".format(gettext("Read more")))
label = fsui.MultiLineLabel(self, text + link, min_width=640)
self.layout.add(label, fill=True, margin_top=20)
LauncherSettings.add_listener(self)
for key in ["video_sync"]:
self.on_setting(key, LauncherSettings.get(key))