def app_main(): if "--help" in sys.argv: print(help_text) return print("FS-UAE Arcade {0}".format(VERSION)) print(sys.argv) print(platform.uname()) for i, arg in enumerate(sys.argv): if arg.startswith("--monitor="): sys.argv[i] = "--settings:monitor=" + arg[10:] try: import arcade.arcade_main arcade.arcade_main.main() print("main returned") finally: from fsbc.application import Application application = Application.instance() if application: print("calling Application stop") Application.get().stop() from fsbc.signal import Signal print("sending quit signal") Signal("quit").notify()
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
def app_main(): fsboot.set("fws", "1") # Calculate base dir before we start messing with sys.argv[0] fsboot.base_dir() app = RunApplication() import workspace.shell if len(sys.argv) == 1: workspace.shell.workspace_open("SYS:System/FileManager", ["VOLUMES:"]) else: workspace.shell.workspace_open(sys.argv[1], sys.argv[2:]) app.run() from fsbc.application import Application Application.wait_for_threads()
def app_main(): try: import arcade.arcade_main arcade.arcade_main.main() print("main returned") finally: from fsbc.application import Application application = Application.instance() if application: print("calling Application stop") Application.get().stop() from fsbc.signal import Signal print("sending quit signal") Signal("quit").notify()
def find_executable(cls, executable="fs-uae"): application = Application.instance() if os.path.isdir("../fs-uae/src"): # running FS-UAE Launcher from source directory, we # then want to run the locally compiled fs-uae binary path = "../fs-uae/" + executable if windows: path += ".exe" if os.path.isfile(path): return os.path.abspath(path) raise Exception("Could not find development FS-UAE executable") if windows: exe = os.path.join( application.executable_dir(), executable + ".exe") if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "fs-uae/" + executable + ".exe") if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../" + executable + ".exe") elif macosx: exe = os.path.join(application.executable_dir(), executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../Programs/Mac OS X/FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../FS-UAE Launcher.app/Contents/Resources/" "FS-UAE.app/Contents/MacOS/" + executable) else: print("application executable dir", application.executable_dir()) exe = os.path.join(application.executable_dir(), executable) print("checking", exe) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "..", "bin", executable) print("checking", exe) if not os.path.exists(exe): return executable if not os.path.exists(exe): raise Exception("Could not find {0} executable".format( repr(executable))) return exe
def find_executable(cls, executable="fs-uae"): application = Application.instance() if os.path.isdir("../fs-uae/src"): # running FS-UAE Launcher from source directory, we # then want to run the locally compiled fs-uae binary path = "../fs-uae/" + executable if windows: path += ".exe" if os.path.isfile(path): return os.path.abspath(path) raise Exception("Could not find development FS-UAE executable") if windows: exe = os.path.join(application.executable_dir(), executable + ".exe") if not os.path.exists(exe): exe = os.path.join(application.executable_dir(), "fs-uae/" + executable + ".exe") if not os.path.exists(exe): exe = os.path.join(application.executable_dir(), "../" + executable + ".exe") elif macosx: exe = os.path.join(application.executable_dir(), executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../Programs/Mac OS X/FS-UAE.app/Contents/MacOS/" + executable) if not os.path.exists(exe): exe = os.path.join( application.executable_dir(), "../../../FS-UAE Launcher.app/Contents/Resources/" "FS-UAE.app/Contents/MacOS/" + executable) else: print("application executable dir", application.executable_dir()) exe = os.path.join(application.executable_dir(), executable) print("checking", exe) if not os.path.exists(exe): exe = os.path.join(application.executable_dir(), "..", "bin", executable) print("checking", exe) if not os.path.exists(exe): return executable if not os.path.exists(exe): raise Exception("Could not find {0} executable".format( repr(executable))) return exe
def update_title(self): if Skin.fws(): # Just want to keep "FS-UAE Launcher" in the title return auth = LauncherSettings.get(Option.DATABASE_AUTH) if auth: username = LauncherSettings.get(Option.DATABASE_USERNAME) login_info = username else: login_info = gettext("Not logged in") title = "FS-UAE Launcher {0} ({1})".format( Application.instance().version, login_info) self.set_title(title)
def event_thread(device_name, window_ref): process = FSUAEDeviceHelper.start_with_args( [device_name], stdout=subprocess.PIPE ) # while not self.stopped and \ while not Application.instance().stopping(): # print("stopping?", Application.instance().stopping()) window = window_ref() if window is None: print("window was None") break line = process.stdout.readline() line = line.decode("UTF-8", errors="replace") line = line.strip() parts = line.split(" ") if len(parts) < 2: continue type_ = parts[1] states = parts[2:] update = window.current_state if type_ == "buttons": for i, state in enumerate(states): state = int(state) update["button_{0}".format(i)] = state elif type_ == "axes": for i, state in enumerate(states): state = int(state) update["axis_" + str(i) + "_pos"] = state > 20000 update["axis_" + str(i) + "_neg"] = state < -20000 elif type_ == "hats": for i, state in enumerate(states): state = int(state) update["hat_" + str(i) + "_left"] = state & HAT_LEFT update["hat_" + str(i) + "_right"] = state & HAT_RIGHT update["hat_" + str(i) + "_up"] = state & HAT_UP update["hat_" + str(i) + "_down"] = state & HAT_DOWN # make sure references are freed in every loop iteration, so the # Window will get refcount 0 when it is closed. del update del window process.kill()
def update_title(self): if Skin.fws(): # Just want to keep "FS-UAE Launcher" in the title return auth = LauncherSettings.get(Option.DATABASE_AUTH) if auth: username = LauncherSettings.get(Option.DATABASE_USERNAME) login_info = username else: login_info = gettext("Not logged in") if fsgs_module.product == "OpenRetro": app_name = "OpenRetro Launcher" else: app_name = "FS-UAE Launcher" title = "{} {} ({})".format(app_name, Application.instance().version, login_info) self.set_title(title)
def update_title(self): if Skin.fws(): # Just want to keep "FS-UAE Launcher" in the title return auth = LauncherSettings.get(Option.DATABASE_AUTH) if auth: username = LauncherSettings.get(Option.DATABASE_USERNAME) login_info = username else: login_info = gettext("Not logged in") if fsgs_module.product == "OpenRetro": app_name = "OpenRetro Launcher" else: app_name = "FS-UAE Launcher" title = "{} {} ({})".format( app_name, Application.instance().version, login_info ) self.set_title(title)
def series(cls): if "dev" in Application.instance().version: return "devel" elif "beta" in Application.instance().version: return "beta" return "stable"
def __init__(self, fsgs=None): LauncherWindow._current = weakref.ref(self) # Old name if fsgs is not None: self.fsgs = fsgs else: self.fsgs = default_context() # New name self.gsc = self.fsgs from launcher.launcherapp import LauncherApp LauncherApp.pre_start() border = True maximize = None menu = False if launcher.ui.get_screen_size()[1] <= 768: if fstd.desktop.is_running_gnome_3(): border = False if "--window-border" in sys.argv: border = True maximize = True if Skin.fws(): border = False menu = True if "--no-window-border" in sys.argv: border = False if fsgs_module.product == "OpenRetro": app_name = "OpenRetro Launcher" else: app_name = "FS-UAE Launcher" if Skin.fws(): title = app_name else: title = "{} {}".format(app_name, Application.instance().version) WindowWithTabs.__init__(self, None, title, border=border, menu=menu) icon = self.find_icon() if icon: self.set_icon_from_path(icon) self.main_layout = fsui.VerticalLayout() self.books = [] self.config_browser = None self.configurations_panel = None self.main_menu_close_time = 0 self.main_panel = None self._menu = None self.menu_button = None self.quick_settings_panel = None self.tab_panels = [] self.user_button = None self.user_menu_close_time = 0 self.set_content(self.main_layout) self.column_layout = fsui.HorizontalLayout() self.main_layout.add(self.column_layout, fill=True, expand=True) # left border self.create_column(0, min_width=Skin.get_window_padding_left(), content=False) # left content # if fs_uae_launcher.ui.get_screen_size()[0] > 1024: # left_width = 518 # else: # left_width = 400 # FIXME: adjust left_width = 462 self.create_column(1, min_width=left_width) # right content # right_width = Constants.SCREEN_SIZE[0] * 2 + 21 + 10 + 10 extra_screenshot_width = Constants.SCREEN_SIZE[0] + 21 need_width = 1280 right_width = 518 if self.is_editor_enabled(): # need_width += extra_screen_width pass else: if launcher.ui.get_screen_size()[0] >= need_width: # make room for one more screenshot right_width += extra_screenshot_width pass # right_width = 518 # if Skin.EXTRA_GROUP_MARGIN: # self.main_layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.create_column(2, min_width=right_width, expand=True) # right border self.create_column(3, min_width=Skin.get_window_padding_right(), content=False) # if self.is_editor_enabled(): # from ..editor.EditorGroup import EditorGroup # editor = EditorGroup(self) # self.main_layout.add(editor, fill=True, expand=True, # margin_right=20) # if fs_uae_launcher.ui.get_screen_size()[1] >= 768: # right_margin = 0 if launcher.ui.get_screen_size()[1] >= 720: self.bottom_layout = fsui.HorizontalLayout() self.main_layout.add(self.bottom_layout, fill=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) self.screenshots_panel = ScreenshotsPanel(self) self.bottom_layout.add(self.screenshots_panel, fill=True) self.game_info_panel = GameInfoPanel(self) self.game_info_panel.set_min_width(GAME_INFO_PANEL_MIN_WIDTH) self.bottom_layout.add(self.game_info_panel, fill=True, expand=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) else: self.bottom_layout = None self.screenshots_panel = None # right_margin = -10 - Skin.EXTRA_GROUP_MARGIN # else: # bottom_panel = None # # FIXME: # if bottom_panel is None: # layout.add_spacer(0, Skin.get_bottom_panel_height()) # else: # bottom_panel.set_min_height(Skin.get_bottom_panel_height()) # layout.add(bottom_panel, fill=True, margin_right=right_margin) # elif column == 1: # group = LaunchGroup(self) # layout.add(group, fill=True, margin=10, margin_top=0) # layout.add_spacer(0, 10) self.realize_tabs() # self._menu = self.create_menu() if fsui.System.macosx and fsui.toolkit == "wx": # import wx # self.tools_menu = self.create_menu() # menu_bar = wx.MenuBar() # menu_bar.Append(self.tools_menu._menu, _("Tools")) # self.SetMenuBar(menu_bar) pass self.status_bar = StatusBar(self) self.layout.add(self.status_bar, fill=True) was_maximized = LauncherSettings.get("maximized") == "1" if LauncherSettings.get(Option.LAUNCHER_CONFIG_FEATURE) == "1": if launcher.ui.get_screen_size()[0] > 1300: if launcher.ui.get_screen_size()[1] > 1000: self.layout.min_width = 1280 self.layout.min_height = 720 self.set_size(self.layout.get_min_size()) self.center_on_screen() if was_maximized or maximize: self.maximize() LauncherSignal.add_listener("scan_done", self) LauncherSignal.add_listener("setting", self) self.update_title() self.check_for_update_once() self.implicit_config_handler = ImplicitConfigHandler(self)
def __init__(self, fsgs=None): LauncherWindow._current = weakref.ref(self) # Old name if fsgs is not None: self.fsgs = fsgs else: self.fsgs = default_context() # New name self.gsc = self.fsgs from launcher.fs_uae_launcher import FSUAELauncher FSUAELauncher.pre_start() border = True maximize = None menu = False if launcher.ui.get_screen_size()[1] <= 768: if fstd.desktop.is_running_gnome_3(): border = False if "--window-border" in sys.argv: border = True maximize = True if Skin.fws(): border = False menu = True if "--no-window-border" in sys.argv: border = False if Skin.fws(): title = "FS-UAE Launcher" else: title = "FS-UAE Launcher {0}".format( Application.instance().version) WindowWithTabs.__init__(self, None, title, border=border, menu=menu) icon = self.find_icon() if icon: self.set_icon_from_path(icon) self.tab_panels = [] self.books = [] self._menu = None self.menu_button = None self.main_menu_close_time = 0 self.user_menu_close_time = 0 self.user_button = None self.main_panel = None self.config_browser = None self.main_layout = fsui.VerticalLayout() self.set_content(self.main_layout) self.column_layout = fsui.HorizontalLayout() self.main_layout.add(self.column_layout, fill=True, expand=True) # left border self.create_column( 0, min_width=Skin.get_window_padding_left(), content=False) # left content # if fs_uae_launcher.ui.get_screen_size()[0] > 1024: # left_width = 518 # else: # left_width = 400 # FIXME: adjust left_width = 462 self.create_column(1, min_width=left_width) # right content # right_width = Constants.SCREEN_SIZE[0] * 2 + 21 + 10 + 10 extra_screenshot_width = Constants.SCREEN_SIZE[0] + 21 need_width = 1280 right_width = 518 if self.is_editor_enabled(): # need_width += extra_screen_width pass else: if launcher.ui.get_screen_size()[0] >= need_width: # make room for one more screenshot right_width += extra_screenshot_width pass # right_width = 518 # if Skin.EXTRA_GROUP_MARGIN: # self.main_layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.create_column(2, min_width=right_width, expand=True) # right border self.create_column(3, min_width=Skin.get_window_padding_right(), content=False) # if self.is_editor_enabled(): # from ..editor.EditorGroup import EditorGroup # editor = EditorGroup(self) # self.main_layout.add(editor, fill=True, expand=True, # margin_right=20) # if fs_uae_launcher.ui.get_screen_size()[1] >= 768: # right_margin = 0 if launcher.ui.get_screen_size()[1] >= 720: self.bottom_layout = fsui.HorizontalLayout() self.main_layout.add(self.bottom_layout, fill=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) self.screenshots_panel = ScreenshotsPanel(self) self.bottom_layout.add(self.screenshots_panel, fill=True) self.game_info_panel = GameInfoPanel(self) self.game_info_panel.set_min_width(500) self.bottom_layout.add(self.game_info_panel, fill=True, expand=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) else: self.bottom_layout = None self.screenshots_panel = None # right_margin = -10 - Skin.EXTRA_GROUP_MARGIN # else: # bottom_panel = None # # FIXME: # if bottom_panel is None: # layout.add_spacer(0, Skin.get_bottom_panel_height()) # else: # bottom_panel.set_min_height(Skin.get_bottom_panel_height()) # layout.add(bottom_panel, fill=True, margin_right=right_margin) # elif column == 1: # group = LaunchGroup(self) # layout.add(group, fill=True, margin=10, margin_top=0) # layout.add_spacer(0, 10) self.realize_tabs() # self._menu = self.create_menu() if fsui.System.macosx and fsui.toolkit == 'wx': # import wx # self.tools_menu = self.create_menu() # menu_bar = wx.MenuBar() # menu_bar.Append(self.tools_menu._menu, _("Tools")) # self.SetMenuBar(menu_bar) pass self.status_bar = StatusBar(self) self.layout.add(self.status_bar, fill=True) was_maximized = LauncherSettings.get("maximized") == "1" if LauncherSettings.get(Option.LAUNCHER_CONFIG_FEATURE) == "1": if launcher.ui.get_screen_size()[0] > 1300: if launcher.ui.get_screen_size()[1] > 1000: self.layout.min_width = 1280 self.layout.min_height = 720 self.set_size(self.layout.get_min_size()) self.center_on_screen() if was_maximized or maximize: self.maximize() LauncherSignal.add_listener("scan_done", self) LauncherSignal.add_listener("setting", self) self.update_title() self.check_for_update_once() self.implicit_config_handler = ImplicitConfigHandler(self)