Пример #1
0
    def refresh(cls):
        cls.initialized = False
        cls.init()

        # FIXME: REPLACE WITH EnumerateHelper!!!

        LauncherSignal.broadcast("device_list_updated")
    def __init__(self, parent, port_gui_index):
        super().__init__(parent, [""], read_only=True)
        self.port_gui_index = port_gui_index
        self.port = self.port_gui_index + 1
        self._platform = ""
        self._config_key = ""
        self.device_option_key = ""

        # AmigaEnableBehavior(self.device_choice)
        self.device_values = []
        self.rebuild_device_list()

        config = get_config(self)
        # Must check platform before device option key
        self.on_config(Option.PLATFORM, config.get(Option.PLATFORM))
        self.on_config(
            self.device_option_key,
            config.get(self.device_option_key),
        )
        # self.changed.connect(self.__changed)
        self.set_index(0)

        config.add_listener(self)
        LauncherSignal.add_listener("settings_updated", self)
        LauncherSignal.add_listener("device_list_updated", self)
Пример #3
0
    def refresh(cls):
        cls.initialized = False
        cls.init()

        # FIXME: REPLACE WITH EnumerateHelper!!!

        LauncherSignal.broadcast("device_list_updated")
 def set_config_handlers(self):
     if self.mode_choice is not None:
         self.mode_choice.on_changed = self.on_mode_changed
     self.device_choice.on_changed = self.on_device_changed
     get_config(self).add_listener(self)
     LauncherSignal.add_listener("settings_updated", self)
     LauncherSignal.add_listener("device_list_updated", self)
 def __init__(self):
     self.stop_flag = False
     self.requests = []
     self.requests_lock = threading.Lock()
     self.requests_condition = threading.Condition(self.requests_lock)
     threading.Thread(target=self.image_loader_thread,
                      name="ImageLoaderThread").start()
     LauncherSignal.add_listener("quit", self)
Пример #6
0
        def on_done():
            # FIXME: these should be removed soon
            LauncherSettings.set("last_scan", str(time.time()))
            LauncherSettings.set("__config_refresh", str(time.time()))

            # this must be called from main, since callbacks are broadcast
            # when settings are changed

            LauncherSignal.broadcast("scan_done")
            LauncherConfig.update_kickstart()
Пример #7
0
        def on_done():
            # FIXME: these should be removed soon
            LauncherSettings.set("last_scan", str(time.time()))
            LauncherSettings.set("__config_refresh", str(time.time()))

            # this must be called from main, since callbacks are broadcast
            # when settings are changed

            LauncherSignal.broadcast("scan_done")
            LauncherConfig.update_kickstart()
Пример #8
0
    def __init__(self, parent, title, model):
        self.model = model
        fsui.Group.__init__(self, parent)
        self.layout = fsui.HorizontalLayout()

        self.ok_image = fsui.Image("launcher:res/ok_emblem.png")
        self.na_image = fsui.Image("launcher:res/na_emblem.png")

        self.icon = fsui.ImageView(self, self.na_image)
        self.layout.add(self.icon)

        self.layout.add_spacer(10)
        self.label = fsui.Label(self, title)
        self.layout.add(self.label)
        self.update()
        LauncherSignal.add_listener("scan_done", self)
Пример #9
0
    def __init__(self, parent, title, model):
        self.model = model
        fsui.Group.__init__(self, parent)
        self.layout = fsui.HorizontalLayout()

        self.ok_image = fsui.Image("launcher:res/ok_emblem.png")
        self.na_image = fsui.Image("launcher:res/na_emblem.png")

        self.icon = fsui.ImageView(self, self.na_image)
        self.layout.add(self.icon)

        self.layout.add_spacer(10)
        self.label = fsui.Label(self, title)
        self.layout.add(self.label)
        self.update()
        LauncherSignal.add_listener("scan_done", self)
Пример #10
0
 def _update_thread_function(cls):
     if System.windows:
         platform = "windows"
     elif System.macos:
         platform = "macosx"
     elif System.linux:
         platform = "linux"
     else:
         platform = "other"
     url = f"https://fs-uae.net/{cls.series()}/latest-{platform}"
     r = requests.get(url)
     r.raise_for_status()
     version_str = r.text.strip()
     print("Latest version available:", version_str)
     print("Current version:", VERSION)
     result = Version.compare(version_str, VERSION)
     print("Update check result: ", result)
     if result > 0 and version_str != "9.9.9":
         web_url = "https://fs-uae.net/{0}/download/".format(cls.series())
         LauncherSignal.broadcast("update_available", version_str, web_url)
         # FIXME: Thread safety...
         # FIXME: Use above signal instead
         LauncherSettings.set("__update_available", version_str)
Пример #11
0
 def __closed(self):
     LauncherSignal.broadcast("settings_updated")
Пример #12
0
 def refresh(cls):
     cls.initialized = False
     cls.init()
     LauncherSignal.broadcast("device_list_updated")
Пример #13
0
 def on_destroy(self):
     LauncherSignal.remove_listener("scan_done", self)
Пример #14
0
 def on_destroy(self):
     print("on_destroy")
     LauncherConfig.remove_listener(self)
     LauncherSignal.remove_listener("settings_updated", self)
     LauncherSignal.remove_listener("device_list_updated", self)
Пример #15
0
 def on_destroy(self):
     # FIXME: Is this being run?
     print("LauncherWindow.on_destroy")
     LauncherSignal.remove_listener("scan_done", self)
     LauncherSignal.remove_listener("setting", self)
Пример #16
0
    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)
Пример #17
0
 def on_destroy(self):
     LauncherSignal.remove_listener("scan_done", self)
 def on_destroy(self):
     print("InputSelector.on_destroy")
     get_config(self).remove_listener(self)
     LauncherSignal.remove_listener("settings_updated", self)
     LauncherSignal.remove_listener("device_list_updated", self)
     super().on_destroy()
 def __init__(self):
     self.cache = {}
     LauncherSignal.add_listener("quit", self)
 def on_destroy(self):
     config = get_config(self)
     config.remove_listener(self)
     LauncherSignal.remove_listener("settings_updated", self)
     LauncherSignal.remove_listener("device_list_updated", self)
     super().on_destroy()
Пример #21
0
 def __closed(self):
     LauncherSignal.broadcast("settings_updated")