示例#1
0
 def __init__(self, parent):
     self.parent = weakref.ref(parent)
     LauncherConfig.add_listener(self)
     LauncherSettings.add_listener(self)
     self.dirty = True
     self.do_update()
     parent.destroyed.connect(self.on_parent_destroyed)
    def __init__(self, parent):
        # fsui.VerticalItemView.__init__(self, parent)
        fsui.ItemChoice.__init__(self, parent)

        self.parent_uuid = ""
        self.items = []  # type: list [dict]
        # self.last_variants = LastVariants()

        self.icon = fsui.Image("launcher:/data/fsuae_config_16.png")
        self.adf_icon = fsui.Image("launcher:/data/adf_game_16.png")
        self.ipf_icon = fsui.Image("launcher:/data/ipf_game_16.png")
        self.cd_icon = fsui.Image("launcher:/data/cd_game_16.png")
        self.hd_icon = fsui.Image("launcher:/data/hd_game_16.png")
        # self.missing_icon = fsui.Image(
        #     "launcher:/data/missing_game_16.png")
        self.missing_icon = fsui.Image("launcher:/data/16x16/delete_grey.png")
        self.missing_color = fsui.Color(0xA8, 0xA8, 0xA8)

        self.blank_icon = fsui.Image("launcher:/data/16x16/blank.png")
        self.bullet_icon = fsui.Image("launcher:/data/16x16/bullet.png")

        self.manual_download_icon = fsui.Image(
            "launcher:/data/16x16/arrow_down_yellow.png")
        self.auto_download_icon = fsui.Image(
            "launcher:/data/16x16/arrow_down_green.png")

        self.up_icon = fsui.Image("launcher:/data/16x16/thumb_up_mod.png")
        self.down_icon = fsui.Image("launcher:/data/16x16/thumb_down_mod.png")
        self.fav_icon = fsui.Image("launcher:/data/rating_fav_16.png")

        LauncherSettings.add_listener(self)
        self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))
    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))
 def __init__(self, parent, icons):
     print("FullscreenToggle.__init__")
     super().__init__(parent, icons)
     self.icons = icons
     self.tooltip_text = gettext("Set the initial volume for the emulator")
     self.fullscreen_mode = False
     self.on_setting("volume", app.settings["volume"], initial=True)
     LauncherSettings.add_listener(self)
示例#5
0
 def __init__(self, parent, icons):
     print("FullscreenToggle.__init__")
     super().__init__(parent, icons)
     self.icons = icons
     self.tooltip_text = gettext(
         "Toggle between windowed and full-screen mode")
     self.fullscreen_mode = False
     self.on_setting("fullscreen", app.settings["fullscreen"], initial=True)
     LauncherSettings.add_listener(self)
示例#6
0
 def __init__(self, parent):
     self.windowed_icon = fsui.Image("launcher:res/windowed_16.png")
     self.fullscreen_icon = fsui.Image("launcher:res/fullscreen_16.png")
     fsui.ImageButton.__init__(self, parent, self.windowed_icon)
     self.set_tooltip(
         gettext("Toggle Between Windowed and Full-Screen Mode"))
     self.set_min_width(40)
     self.fullscreen_mode = False
     self.on_setting("fullscreen", app.settings["fullscreen"])
     LauncherSettings.add_listener(self)
示例#7
0
 def __init__(self, parent):
     self.windowed_icon = fsui.Image("launcher:res/windowed_16.png")
     self.fullscreen_icon = fsui.Image("launcher:res/fullscreen_16.png")
     fsui.ImageButton.__init__(self, parent, self.windowed_icon)
     self.set_tooltip(
         gettext("Toggle Between Windowed and Full-Screen Mode")
     )
     self.set_min_width(40)
     self.fullscreen_mode = False
     self.on_setting("fullscreen", app.settings["fullscreen"])
     LauncherSettings.add_listener(self)
    def __init__(self, parent, icons):
        super().__init__(parent, icons)
        self.icons = icons
        self.monitor = ""
        self.tooltip_text = gettext(
            "Monitor to display the emulator on (left, "
            "middle-left, middle-right, right)")

        # self.on_setting("fullscreen", app.settings["fullscreen"], initial=True)
        self.on_setting("monitor", app.settings["monitor"], initial=True)
        LauncherSettings.add_listener(self)
示例#9
0
 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))
 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))
示例#11
0
        def observe(observer, scheduler):
            print(" -- new listener")
            # def listener(key, value):
            #     if key ==
            #     observer.on_next(value)

            # Broadcast initial value
            observer.on_next(LauncherSettings.get(key))
            listener = SettingListener(key, observer)
            # HACK, BECAUSE LauncherSettings do not keep ref
            SettingObservable.listeners.append(listener)
            LauncherSettings.add_listener(listener)

            def dispose():
                SettingObservable.listeners.remove(listener)
                LauncherSettings.remove_listener(listener)

            return Disposable(dispose)
示例#12
0
    def __init__(self, parent):
        fsui.Group.__init__(self, parent)
        self.layout = fsui.HorizontalLayout()

        self.layout2 = fsui.VerticalLayout()
        self.layout.add(self.layout2, fill=True, expand=True)

        layout3 = fsui.HorizontalLayout()
        self.layout2.add(layout3, fill=True, expand=True)

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(130)
        self.default_icon = fsui.Image("launcher:res/folder_16.png")
        layout3.add(self.list_view, expand=True, fill=True)
        layout3.add_spacer(10)

        vlayout = fsui.VerticalLayout()
        layout3.add(vlayout, fill=True)

        add_button = IconButton(self, "add_button.png")
        add_button.set_tooltip(gettext("Add Directory to Search Path"))
        # add_button.disable()
        add_button.activated.connect(self.on_add_button)
        vlayout.add(add_button)
        vlayout.add_spacer(10)

        self.remove_button = IconButton(self, "remove_button.png")
        self.remove_button.set_tooltip(
            gettext("Remove Directory from Search Path")
        )
        self.remove_button.disable()
        self.remove_button.activated.connect(self.on_remove_button)
        vlayout.add(self.remove_button)

        # self.list_view.set_items(self.get_search_path())
        self.repopulate_list()
        self.list_view.on_select_item = self.on_select_item
        LauncherSettings.add_listener(self)
示例#13
0
    def __init__(self, parent):
        fsui.Group.__init__(self, parent)
        self.layout = fsui.HorizontalLayout()

        self.layout2 = fsui.VerticalLayout()
        self.layout.add(self.layout2, fill=True, expand=True)

        layout3 = fsui.HorizontalLayout()
        self.layout2.add(layout3, fill=True, expand=True)

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(130)
        self.default_icon = fsui.Image("launcher:res/folder_16.png")
        layout3.add(self.list_view, expand=True, fill=True)
        layout3.add_spacer(10)

        vlayout = fsui.VerticalLayout()
        layout3.add(vlayout, fill=True)

        add_button = IconButton(self, "add_button.png")
        add_button.set_tooltip(gettext("Add Directory to Search Path"))
        # add_button.disable()
        add_button.activated.connect(self.on_add_button)
        vlayout.add(add_button)
        vlayout.add_spacer(10)

        self.remove_button = IconButton(self, "remove_button.png")
        self.remove_button.set_tooltip(
            gettext("Remove Directory from Search Path"))
        self.remove_button.disable()
        self.remove_button.activated.connect(self.on_remove_button)
        vlayout.add(self.remove_button)

        # self.list_view.set_items(self.get_search_path())
        self.repopulate_list()
        self.list_view.on_select_item = self.on_select_item
        LauncherSettings.add_listener(self)
    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/16x16/world_link.png")))
        label = fsui.URLLabel(
            self, gettext("How to achieve perfectly smooth scrolling"),
            "https://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))
    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))
示例#16
0
    def __init__(self, parent):
        StatusElement.__init__(self, parent)
        self.error_icon = Image("launcher:res/16x16/error.png")
        self.warning_icon = Image("launcher:res/16x16/warning_3.png")
        self.notice_icon = Image("launcher:res/16x16/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.platform = ""
        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",
                "platform",
            ],
        )
        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))
    def __init__(self, parent):
        VerticalItemView.__init__(self, parent, border=False)
        self.items = []
        self.game_icon = Image("launcher:/data/16x16/controller.png")
        self.config_icon = Image("launcher:/data/fsuae_config_16.png")
        LauncherSettings.add_listener(self)
        self.update_search()

        self.manual_download_icon = Image(
            "launcher:/data/16x16/arrow_down_yellow.png")
        self.auto_download_icon = Image(
            "launcher:/data/16x16/arrow_down_green.png")
        self.blank_icon = Image("launcher:/data/16x16/blank.png")
        self.missing_color = Color(0xA8, 0xA8, 0xA8)
        self.unpublished_color = Color(0xCC, 0x00, 0x00)

        self.platform_icons = {}

        self.set_background_color(Color(0x999999))
        self.set_font(Font("Saira Condensed", 17, weight=500))

        self.set_row_height(32)
        get_window(self).activated.connect(self.__on_activated)
        get_window(self).deactivated.connect(self.__on_deactivated)

        self._qwidget.verticalScrollBar().setStyleSheet(f"""
            QScrollBar:vertical {{
                border: 0px;
                /*
                background: #32CC99;
                */
                /*
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #888888, stop: 1 #909090);
                */
                /*
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #848484, stop: 0.0625 #8A8A8A stop: 1 #909090);
                */
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #858585, stop: {1 / (16 - 1)} #8A8A8A stop: 1 #909090);
                width: 16px;
                margin: 0 0 0 0;
            }}
            QScrollBar::handle:vertical {{
                /*
                background: #9d9d9d;
                */
                background: #999999;
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #AAAAAA stop: 1 #999999);
                min-height: 60px;
            }}
            
            QScrollBar::handle:vertical:hover {{
                background: #AAAAAA;   
                background-color: qlineargradient(x1: 0, y1: 0 x2: 1, y2: 0, stop: 0 #B2B2B2 stop: 1 #A0A0A0);
            }}

            QScrollBar::handle:vertical:pressed {{
                background: #777777;
            }}

            QScrollBar::add-line:vertical {{
                border: none;
                background: none;
                width: 0;
                height: 0;
            }}

            QScrollBar::sub-line:vertical {{
                border: none;
                background: none;
                width: 0;
                height: 0;
            }}
            """)
    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"))
示例#19
0
    def __init__(self, parent, cover_on_right=True):
        BottomPanel.__init__(self, parent)
        Skin.set_background_color(self)
        # self.set_background_color((0xdd, 0xdd, 0xdd))

        self.cover_on_right = cover_on_right
        self.requests = None
        self.image = None

        self.layout = fsui.HorizontalLayout()

        # def get_min_height(width):
        #     return Constants.COVER_SIZE[1] + 2 * BORDER
        # self.layout.get_min_height = get_min_height

        self.layout.padding_left = BORDER // 2
        self.layout.padding_right = BORDER // 2
        self.layout.padding_top = BORDER + 2
        self.layout.padding_bottom = Skin.get_bottom_margin()

        self.default_image = fsui.Image("launcher:/data/cover.png")
        # self.default_image.resize(Constants.COVER_SIZE)
        self.cover_overlay = fsui.Image("launcher:/data/cover_overlay.png")
        self.cover_overlay_square = fsui.Image(
            "launcher:/data/cover_overlay_square.png")

        if not self.cover_on_right:
            self.layout.add_spacer(Constants.COVER_SIZE[0])

        # self.panel = fsui.Panel(self)
        # self.panel.set_background_color((0xdd, 0xdd, 0xdd))
        # self.layout.add(self.panel, expand=True, fill=True)

        vert_layout = fsui.VerticalLayout()
        self.layout.add(vert_layout, expand=True, fill=True)
        # self.panel.layout.padding_top = 10
        if self.cover_on_right:
            vert_layout.padding_right = BORDER
        else:
            vert_layout.padding_left = BORDER

        vert_layout.add_spacer(58 + 3)
        hori_layout = fsui.HorizontalLayout()
        vert_layout.add(hori_layout, fill=True)

        hori_layout.add_spacer(0, expand=True)

        self.web_button = WebButton(self)
        hori_layout.add(self.web_button, margin_right=3)

        self.edit_button = EditButton(self)
        hori_layout.add(self.edit_button, margin_right=3)

        # def label_min_width():
        #     return 330
        # self.title_label = fsui.HeadingLabel(self)
        # self.title_label.get_min_width = label_min_width
        # vert_layout.add(self.title_label)

        # self.sub_title_label = fsui.Label(self)
        # self.sub_title_label.get_min_width = label_min_width
        # vert_layout.add(self.sub_title_label)

        self.title = ""
        self.sub_title = ""
        self.year = ""
        self.publisher = ""
        self.developer = ""
        self.companies = ""

        self.image_path = ""

        vert_layout.add_spacer(0, expand=True)

        hori_layout = fsui.HorizontalLayout()
        vert_layout.add(hori_layout, fill=True)

        # for rating in [1, 4, 5]:
        #     button = RatingButton(self, rating)
        #     hori_layout.add(button, margin_right=5, fill=True)

        hori_layout.add_spacer(0, expand=True)
        # self.launch_group = LaunchGroup(self)
        # hori_layout.add(self.launch_group, fill=True)

        if self.cover_on_right:
            self.layout.add_spacer(Constants.COVER_SIZE[0])

        self.image_loader = ImageLoader()
        self.load_info()
        LauncherSettings.add_listener(self)
        config = get_config(self)
        config.add_listener(self)

        for key in [
                "database_url",
                "hol_url",
                "lemon_url",
                "mobygames_url",
                "wikipedia_url",
                "year",
                "publisher",
                "developer",
        ]:
            self.on_config(key, config.get(key))
    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"))
示例#21
0
 def set_settings_handlers(self):
     self.device_choice.on_changed = self.on_device_changed
     LauncherSettings.add_listener(self)