def __init__(self, parent):
        BottomPanel.__init__(self, parent)
        Skin.set_background_color(self)
        self.layout = fsui.HorizontalLayout()
        self.image_loader = ImageLoader()

        def get_min_width():
            return 0
        # def get_min_height():
        #     return Constants.SCREEN_SIZE[1] + 2 * BORDER
        self.layout.get_min_width = get_min_width
        # 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:res/screenshot.png")
        # self.default_image.resize(Constants.SCREEN_SIZE)
        self.screenshot_overlay = fsui.Image(
            "launcher:res/screenshot_overlay.png")

        self.images = [self.default_image for _ in range(6)]
        self.image_paths = ["" for _ in range(6)]
        self.requests = [None for _ in range(6)]

        self.x_offset = 0

        if LauncherSettings.get("config_base"):
            # self.load_images(Settings.get("config_base"))
            self.load_images()
        LauncherSettings.add_listener(self)
示例#2
0
    def __init__(self, parent):
        # fsui.VerticalItemView.__init__(self, parent, border=(not Skin.fws()))
        fsui.VerticalItemView.__init__(self, parent, border=False)
        self.items = []
        self.game_icon = fsui.Image("launcher:res/16/controller.png")
        self.config_icon = fsui.Image("launcher:res/fsuae_config_16.png")

        self.manual_download_icon = fsui.Image(
            "launcher:res/16/arrow_down_yellow.png")
        self.auto_download_icon = fsui.Image(
            "launcher:res/16/arrow_down_green.png")
        self.blank_icon = fsui.Image("launcher:res/16/blank.png")
        self.missing_color = fsui.Color(0xa8, 0xa8, 0xa8)
        self.platform_icons = {}

        from workspace.ui.theme import Theme
        theme = Theme.instance()
        self.set_row_height(28)
        # self.list_view.set_background_color(fsui.Color(0xeb, 0xeb, 0xeb))
        self.setStyleSheet("""
        QListView {{
            background-color: {0};
            outline: none;
        }}
        QListView::item {{
            padding-left: 6px;
            border: 0px;
        }}
        QListView::item:selected {{
            background-color: {1};
        }}
        """.format(theme.sidebar_background.to_hex(),
                   theme.selection_background.to_hex()))
示例#3
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)
示例#4
0
 def __init__(self, parent):
     self.window_icon = fsui.Image("launcher:res/16/fullscreen_window.png")
     self.fullscreen_icon = fsui.Image(
         "launcher:res/16/fullscreen_fullscreen.png")
     self.desktop_icon = fsui.Image(
         "launcher:res/16/fullscreen_desktop.png")
     super().__init__(parent, self.desktop_icon)
     self.set_tooltip(gettext(
         "Change fullscreen mode (desktop, fullscreen, window)"))
     self.set_min_width(40)
     self.fullscreen_mode = "desktop"
     SettingsBehavior(self, ["fullscreen", "fullscreen_mode"])
示例#5
0
 def __init__(self, parent):
     self.left_icon = fsui.Image("launcher:res/16/monitor_left.png")
     self.middle_left_icon = fsui.Image(
         "launcher:res/16/monitor_middle_left.png")
     self.middle_right_icon = fsui.Image(
         "launcher:res/16/monitor_middle_right.png")
     self.right_icon = fsui.Image("launcher:res/16/monitor_right.png")
     super().__init__(parent, self.middle_left_icon)
     self.set_tooltip(
         gettext("Monitor to display FS-UAE on (left, "
                 "middle-left, middle-right, right)"))
     self.set_min_width(40)
     self.monitor = ""
     SettingsBehavior(self, ["fullscreen", "monitor"])
示例#6
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)
示例#7
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("joystick-settings", "pkg:workspace")
        # gettext("Joystick Settings")
        title = gettext("Controllers")
        subtitle = gettext(
            "Configure joysticks and set preferred joystick " "devices"
        )
        self.add_header(icon, title, subtitle)

        label = fsui.Label(
            self, gettext("Double-click a controller to configure it:")
        )
        self.layout.add(label, margin_bottom=10)

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(140)
        self.list_view.item_activated.connect(self.on_joystick_activated)
        image = fsui.Image("workspace:res/16x16/gamepad.png")
        for device_name in DeviceManager.get_joystick_names():
            if DeviceManager.is_joystick(device_name):
                self.list_view.add_item(device_name, icon=image)
        self.layout.add(self.list_view, fill=True, expand=True)

        self.layout.add_spacer(20)
        self.pref_group = PreferredJoysticksGroup(self)
        self.layout.add(self.pref_group, fill=True)

        # For reset to defaults function
        self.options_on_page.add(Option.PRIMARY_JOYSTICK)
        self.options_on_page.add(Option.SECONDARY_JOYSTICK)
示例#8
0
    def __init__(self, parent=None):
        title = gettext("Log Out from Your OAGD.net Account")
        super().__init__(parent, title, minimizable=False, maximizable=False)
        self.set_icon(fsui.Icon("password", "pkg:workspace"))

        self.layout = fsui.VerticalLayout()
        self.layout.set_padding(20, 20, 20, 20)

        heading_layout = fsui.HorizontalLayout()
        self.layout.add(heading_layout)
        heading_layout.add(fsui.ImageView(
            self, fsui.Image("workspace:res/48/password.png")))
        heading_layout.add_spacer(20)
        heading_layout_2 = fsui.VerticalLayout()
        heading_layout.add(
            heading_layout_2, expand=True, fill=False, valign=0.5)
        heading_layout_2.add(fsui.HeadingLabel(
            self, gettext("Log Out from Your OAGD.net Account")))
        heading_layout_2.add_spacer(2)
        heading_layout_2.add(fsui.Label(
            self, gettext("While logged out you will not get "
                          "database updates")))

        self.layout.add_spacer(20)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        self.created_label = fsui.Label(self, "")
        hori_layout.add(self.created_label, expand=True)
        hori_layout.add_spacer(20)

        self.logout_button = fsui.Button(self, gettext("Log Out"))
        # self.logout_button.disable()
        self.logout_button.activated.connect(self.on_logout_activated)
        hori_layout.add(self.logout_button)
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("joystick-settings", "pkg:workspace")
        # gettext("Joystick Settings")
        title = gettext("Joysticks & Gamepads")
        subtitle = gettext("Configure joysticks and set preferred joystick "
                           "devices")
        self.add_header(icon, title, subtitle)

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(140)
        self.list_view.item_activated.connect(self.on_joystick_activated)
        image = fsui.Image("workspace:res/16/gamepad.png")
        for device_name in DeviceManager.get_joystick_names():
            if DeviceManager.is_joystick(device_name):
                self.list_view.add_item(device_name, icon=image)
        self.layout.add(self.list_view, fill=True, expand=True)

        label = fsui.Label(
            self,
            gettext("Double-click a device entry to configure it (map "
                    "joystick buttons)."))
        self.layout.add(label, margin_top=10)

        self.layout.add_spacer(20)
        self.pref_group = PreferredJoysticksGroup(self)
        self.layout.add(self.pref_group, fill=True)
    def __init__(self, parent):
        fsui.VerticalItemView.__init__(self, parent)
        self.items = []
        self.game_icon = fsui.Image("launcher:res/16/controller.png")
        self.config_icon = fsui.Image("launcher:res/fsuae_config_16.png")
        LauncherSettings.add_listener(self)
        self.update_search()

        self.manual_download_icon = fsui.Image(
            "launcher:res/16/arrow_down_yellow.png")
        self.auto_download_icon = fsui.Image(
            "launcher:res/16/arrow_down_green.png")
        self.blank_icon = fsui.Image("launcher:res/16/blank.png")
        self.missing_color = fsui.Color(0xa8, 0xa8, 0xa8)

        self.platform_icons = {}
示例#11
0
 def __init__(self):
     self.nw = fsui.Image("pkg://workspace.ui/data/window-shadow-nw.png")
     self.n = fsui.Image("pkg://workspace.ui/data/window-shadow-n.png")
     self.ne = fsui.Image("pkg://workspace.ui/data/window-shadow-ne.png")
     self.e = fsui.Image("pkg://workspace.ui/data/window-shadow-e.png")
     self.se = fsui.Image("pkg://workspace.ui/data/window-shadow-se.png")
     self.s = fsui.Image("pkg://workspace.ui/data/window-shadow-s.png")
     self.sw = fsui.Image("pkg://workspace.ui/data/window-shadow-sw.png")
     self.w = fsui.Image("pkg://workspace.ui/data/window-shadow-w.png")
    def __init__(self, parent):
        fsui.Group.__init__(self, parent)

        self.layout = fsui.VerticalLayout()
        label = fsui.HeadingLabel(self,
                                  gettext("Available Kickstart Versions"))
        self.layout.add(label, margin_bottom=10)

        icon_layout = fsui.HorizontalLayout()
        self.layout.add(icon_layout, fill=True)

        icon_layout.add_spacer(20)
        image = fsui.Image("launcher:/data/kickstart.png")
        self.image_view = fsui.ImageView(self, image)
        icon_layout.add(self.image_view, valign=0.0, margin_right=10)

        vert_layout = fsui.VerticalLayout()
        icon_layout.add(vert_layout, fill=True, expand=True)

        vert_layout.add_spacer(0)

        label = fsui.Label(
            self,
            gettext("You should have kickstart files for "
                    "each Amiga model you want to use:"),
        )
        vert_layout.add(label, margin_bottom=0)

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

        self.kickstart_groups = []

        column_layout = fsui.VerticalLayout()
        hori_layout.add(column_layout, expand=True, fill=True, margin=10)

        self.add_kickstart_group(column_layout, "Amiga 1000", "A1000")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Amiga 500", "A500")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Amiga 500+", "A500+")

        column_layout = fsui.VerticalLayout()
        hori_layout.add(column_layout, expand=True, fill=True, margin=10)

        self.add_kickstart_group(column_layout, "Amiga 600", "A600")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Amiga 1200", "A1200")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Amiga 3000", "A3000")

        column_layout = fsui.VerticalLayout()
        hori_layout.add(column_layout, expand=True, fill=True, margin=10)

        self.add_kickstart_group(column_layout, "Amiga 4000", "A4000/040")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Amiga CD32", "CD32")
        column_layout.add_spacer(10)
        self.add_kickstart_group(column_layout, "Commodore CDTV", "CDTV")
    def __init__(self, parent, import_type=0):
        fsui.Group.__init__(self, parent)
        self.type = import_type
        self.path = ""

        self.layout = fsui.VerticalLayout()
        if self.type == self.AMIGA_FOREVER:
            title = gettext("Import From Amiga Forever CD/DVD")
        else:
            title = gettext("Import Kickstarts and ROMs")
        label = fsui.HeadingLabel(self, title)
        self.layout.add(label, margin_bottom=10)

        icon_layout = fsui.HorizontalLayout()
        self.layout.add(icon_layout, fill=True)
        icon_layout.add_spacer(20)
        if self.type == self.AMIGA_FOREVER:
            image = fsui.Image("launcher:/data/amiga_forever_group.png")
        else:
            image = fsui.Image("launcher:/data/kickstart.png")
        self.image_view = fsui.ImageView(self, image)
        icon_layout.add(self.image_view, valign=0.0, margin_right=10)

        vert_layout = fsui.VerticalLayout()
        icon_layout.add(vert_layout, fill=True, expand=True)

        if self.type == self.AMIGA_FOREVER:
            text = gettext("If you own Amiga Forever, select the drive/folder "
                           'and click "{0}"').format(gettext("Import"))
        else:
            text = gettext("Select a folder containing Amiga kickstart files "
                           'and click "{0}"').format(gettext("Import"))
        label = fsui.Label(self, text)
        vert_layout.add(label, margin_bottom=10)

        hori_layout = fsui.HorizontalLayout()
        vert_layout.add(hori_layout, fill=True, margin=0)
        self.text_field = fsui.TextField(self, "", read_only=True)
        hori_layout.add(self.text_field, expand=True)
        self.browse_button = fsui.Button(self, gettext("Browse"))
        self.browse_button.activated.connect(self.on_browse)
        hori_layout.add(self.browse_button, margin_left=10)
        self.import_button = fsui.Button(self, gettext("Import"))
        self.import_button.activated.connect(self.on_import)
        self.import_button.set_enabled(False)
        hori_layout.add(self.import_button, margin_left=10)
示例#14
0
 def __init__(self, parent, name):
     fsui.ImageView.__init__(self, parent,
                             fsui.Image("launcher:res/16x16/warning_2.png"))
     setattr(self, "on_{0}_config".format(name), self.on_config)
     ConfigBehavior(self, [name])
     text = gettext(
         "Option {name} is overridden by current configuration".format(
             name=name))
     self.set_tool_tip(text)
示例#15
0
    def __init__(self, parent, title, task, *, gscontext):
        print("LaunchDialog parent =", parent)
        self.gscontext = gscontext

        self.has_parent = parent is not None
        self.no_gui = "--no-gui" in sys.argv
        super().__init__(parent, title, maximizable=False)
        self.layout = fsui.VerticalLayout()

        self.layout.add_spacer(400, 20)

        hor_layout = fsui.HorizontalLayout()
        self.layout.add(hor_layout, fill=True)

        hor_layout.padding_right = 20
        hor_layout.add_spacer(20)

        image = fsui.Image("launcher:/data/fs_uae_group.png")
        self.image_view = fsui.ImageView(self, image)
        hor_layout.add(self.image_view, valign=0.0)
        hor_layout.add_spacer(20)

        ver_layout = fsui.VerticalLayout()
        hor_layout.add(ver_layout, fill=True, expand=True)
        self.title_label = fsui.HeadingLabel(self, title)
        ver_layout.add(self.title_label, fill=True)

        ver_layout.add_spacer(6)
        self.sub_title_label = fsui.Label(self, gettext("Preparing..."))
        ver_layout.add(self.sub_title_label, fill=True)

        self.layout.add_spacer(20)

        hor_layout = fsui.HorizontalLayout()
        self.layout.add(hor_layout, fill=True)

        hor_layout.add_spacer(20, expand=True)
        self.cancel_button = fsui.Button(self, gettext("Cancel"))
        self.cancel_button.activated.connect(self.on_cancel_button)
        hor_layout.add(self.cancel_button)
        hor_layout.add_spacer(20)

        self.layout.add_spacer(20)
        self.set_size(self.layout.get_min_size())
        self.center_on_parent()

        self.was_closed = False
        self.task = task
        self.task.progressed.connect(self.on_progress)
        self.task.finished.connect(self.on_complete)
        self.task.failed.connect(self.on_error)

        self.closed.connect(self.__closed)
示例#16
0
    def _add_page(self, book, instance, icon_name, title, tooltip):
        book.add_page(instance)
        if icon_name:
            icon = fsui.Image("launcher:res/{0}.png".format(icon_name))
        else:
            icon = None

        def function():
            book.set_page(instance)

        if icon:
            self.add_tab(function, icon, title, tooltip)
        return instance
示例#17
0
    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)
示例#18
0
    def __init__(self, parent=None):
        title = gettext("Log Out from Your OpenRetro Account")
        super().__init__(parent, title, minimizable=False, maximizable=False)
        self.theme = WorkspaceTheme.instance()
        self.layout = fsui.VerticalLayout()
        self.set_icon(fsui.Icon("password", "pkg:workspace"))

        self.layout.set_padding(20, 20, 20, 20)

        heading_layout = fsui.HorizontalLayout()
        self.layout.add(heading_layout)
        heading_layout.add(
            fsui.ImageView(self,
                           fsui.Image("workspace:/data/48/password.png")))
        heading_layout.add_spacer(20)
        heading_layout_2 = fsui.VerticalLayout()
        heading_layout.add(heading_layout_2,
                           expand=True,
                           fill=False,
                           valign=0.5)
        heading_layout_2.add(
            fsui.HeadingLabel(self,
                              gettext("Log Out from Your OpenRetro Account")))
        heading_layout_2.add_spacer(2)
        heading_layout_2.add(
            fsui.Label(
                self,
                gettext("While logged out you will not get "
                        "database updates"),
            ))

        self.layout.add_spacer(20)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        self.created_label = fsui.Label(self, "")
        hori_layout.add(self.created_label, expand=True)
        hori_layout.add_spacer(20)

        self.logout_button = fsui.Button(self, gettext("Log Out"))
        # self.logout_button.set_enabled(False)
        self.logout_button.activated.connect(self.__logout_activated)
        hori_layout.add(self.logout_button)

        if self.window().theme.has_close_buttons:
            self.close_button = CloseButton(self)
            hori_layout.add(self.close_button, fill=True, margin_left=10)
示例#19
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("plugins", "pkg:workspace")
        self.add_header(icon, gettext("Plugins"))

        self.list_view = fsui.ListView(self)
        self.list_view.set_min_height(140)
        # self.list_view.item_activated.connect(self.on_plugin_activated)
        image = fsui.Image("workspace:res/16x16/settings.png")
        plugin_manager = PluginManager.instance()
        for plugin in plugin_manager.plugins():
            text = "{0} ({1})".format(plugin.name, plugin.version)
            if plugin.outdated:
                text += " - " + gettext("This plugin is outdated").upper()
            print("[PLUGINS] {0}".format(text))
            self.list_view.add_item(text, icon=image)
        self.layout.add(self.list_view, fill=True, expand=True)
示例#20
0
    def __init__(self, parent=None):
        super().__init__(
            title=gettext("OpenRetro logout"),
            minimizable=False,
            maximizable=False,
        )
        # self.theme = WorkspaceTheme.instance()
        # self.layout = fsui.VerticalLayout()
        self.set_icon(fsui.Icon("password", "pkg:workspace"))

        with FlexContainer(
                parent=self,
                style={
                    "backgroundColor": "#bbbbbb",
                    "gap": 20,
                    "padding": 20,
                    "paddingBottom": 10,
                },
        ):
            with VerticalFlexContainer(style={"flexGrow": 1, "gap": 5}):
                Label(
                    gettext("Log out from your OpenRetro.org account"),
                    style={"fontWeight": "bold"},
                )
                Label(
                    gettext(
                        "While logged out you will not get database updates"))
            ImageView(fsui.Image("workspace:/data/48/password.png"))
        with FlexContainer(
                parent=self,
                style={
                    "backgroundColor": "#bbbbbb",
                    "gap": 10,
                    "padding": 20,
                    "paddingTop": 10,
                },
        ):
            # Spacer(style={"flexGrow": 1})
            self.errorLabel = Label(style={"flexGrow": 1})
            # FIXME: Set visible via stylesheet instead?
            self.spinner = WidgetSizeSpinner(visible=False)
            self.logoutButton = Button(gettext("Log out"),
                                       onClick=self.onLogoutActivated)
 def get_item_icon(self, index):
     item = self.items[index]
     platform_id = (item[str("platform")] or "").lower()
     if item[str("have")] == 1:
         return self.manual_download_icon
     elif item[str("have")] == 0:
         return self.blank_icon
     elif item[str("have")] == 2:
         return self.auto_download_icon
     elif item[str("have")] == 4:
         if platform_id not in self.platform_icons:
             try:
                 icon = fsui.Image(
                     "launcher:res/16x16/{0}.png".format(platform_id))
             except Exception:
                 icon = self.game_icon
             self.platform_icons[platform_id] = icon
         return self.platform_icons[platform_id]
     else:
         return self.config_icon
    def do_load_image(cls, request):
        cover = request.args.get("is_cover", False)
        if request.path.startswith("sha1:"):
            path = cls.get_cache_path_for_sha1(request, request.path[5:])
        else:
            path = request.path
        if not path:
            return
        print("[IMAGES] Loading", request.path)
        image = fsui.Image(path)
        print(image.size, request.size)
        if request.size is not None:
            dest_size = request.size
            if dest_size[0] == -1:
                # Scale width based on height
                dest_size = (
                    dest_size[1] * image.size[0] / image.size[1],
                    dest_size[1],
                )
        else:
            dest_size = image.size
        if image.size == dest_size:
            request.image = image
            return
        if cover:
            try:
                ratio = image.size[0] / image.size[1]
            except Exception:
                ratio = 1.0
            if 0.85 < ratio < 1.20:
                min_length = min(request.size)
                dest_size = (min_length, min_length)
            double_size = False
        else:
            double_size = True

        if double_size and image.size[0] < 400:
            image.resize((image.size[0] * 2, image.size[1] * 2),
                         fsui.Image.NEAREST)
        image.resize(dest_size)
        request.image = image
示例#23
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)
示例#24
0
    def __init__(self, parent, name):
        super().__init__(parent, paintable=True)
        self.set_background_color(parent.background_color)
        self.set_min_width(40)
        self.set_min_height(40)
        self.hover = False
        self.pressed = False

        if parent.background_color.to_hsl().l >= 0.6:
            # FIXME: static resources / share between instances
            self.image = fsui.Image(
                "pkg://workspace.ui/data/window-{}.png".format(name))
            self.image_hover = fsui.Image(
                "pkg://workspace.ui/data/window-{}-hover.png".format(name))
            self.image_pressed = fsui.Image(
                "pkg://workspace.ui/data/window-{}-pressed.png".format(name))
        else:
            self.image = fsui.Image(
                "pkg://workspace.ui/data/window-{}-dark.png".format(name))
            self.image_hover = fsui.Image(
                "pkg://workspace.ui/data/window-{}-hover.png".format(name))
            self.image_pressed = fsui.Image(
                "pkg://workspace.ui/data/window-{}-pressed.png".format(name))
示例#25
0
    def __init__(self, parent=None):
        title = gettext("HDF Disk Image Creator")
        super().__init__(parent, title=title)
        self.theme = WorkspaceTheme.instance()
        buttons, layout = fsui.DialogButtons.create_with_layout(self)
        if self.window.theme.has_close_buttons:
            buttons.create_close_button()

        self.dialog = None
        self.path = ""

        self.set_icon(fsui.Icon("hd-volume", "pkg:workspace"))

        layout.min_width = 500

        self.icon_header = IconHeader(
            self, fsui.Icon("hd-volume", "pkg:workspace"),
            gettext("HDF Disk Image Creator"),
            gettext("Create a single-partition or partitionable hard "
                    "drive image"))
        layout.add(self.icon_header, fill=True, margin_bottom=20)

        label = fsui.Label(self, gettext("Create disk image of type:"))
        layout.add(label)
        layout.add_spacer(6)
        self.list_view = fsui.ListView(self)
        self.list_view.set_min_width(560)
        self.list_view.set_min_height(60)
        icon = fsui.Image("workspace:res/16x16/hd-volume.png")
        self.list_view.add_item(
            gettext("HDF - Single Partition Hard Disk File"), icon)
        self.list_view.add_item(
            gettext("HDF - Partitionable Hard Drive Image (RDB)"), icon)
        layout.add(self.list_view, expand=True, fill=True)
        self.list_view.item_selected.connect(self.on_item_selected)

        layout.add_spacer(20)
        label = fsui.Label(self, gettext("Filename for the new disk image:"))
        layout.add(label)
        layout.add_spacer(6)
        hori_layout = fsui.HorizontalLayout()
        layout.add(hori_layout, fill=True)
        self.name_field = fsui.TextField(
            self, "", read_only=False)
        hori_layout.add(self.name_field, expand=True)
        text = gettext("Size:")
        label = fsui.Label(self, text)
        hori_layout.add(label, margin_left=20)
        self.size_field = fsui.TextField(self, "")
        self.size_field.set_min_width(60)
        hori_layout.add(self.size_field, expand=False, margin_left=10)
        text = gettext("MB")
        label = fsui.Label(self, text)
        hori_layout.add(label, margin_left=10)

        layout.add_spacer(20)
        label = fsui.Label(self, gettext("Save to directory:"))
        layout.add(label)
        layout.add_spacer(6)
        hori_layout = fsui.HorizontalLayout()
        layout.add(hori_layout, fill=True)
        self.dir_field = fsui.TextField(self, "", read_only=True)
        hori_layout.add(self.dir_field, expand=True)
        self.browse_button = fsui.Button(self, gettext("Browse"))
        self.browse_button.clicked.connect(self.on_browse_clicked)
        hori_layout.add(self.browse_button, margin_left=10)

        self.created_label = fsui.Label(self, "")
        layout.add(self.created_label, fill=True)

        # layout.add_spacer(20)
        # layout.add_spacer(20)
        # hori_layout = fsui.HorizontalLayout()
        # layout.add(hori_layout, fill=True)
        # self.created_label = fsui.Label(self, "")
        # hori_layout.add(self.created_label, expand=True)
        # hori_layout.add_spacer(20)
        self.create_button = fsui.Button(buttons, gettext("Create"))
        # self.create_button.activated.connect(self.on_create_clicked)
        self.create_button.clicked.connect(self.on_create_clicked)
        # hori_layout.add(self.create_button)
        buttons.add_button(self.create_button)

        self.list_view.select_item(0)
        self.update_name_suggestion()
    def __init__(self, parent, cd_mode):
        fsui.Group.__init__(self, parent)
        self.layout = fsui.VerticalLayout()

        self.cd_mode = cd_mode
        if self.cd_mode:
            self.file_key_prefix = "cdrom_image_"
            self.file_key = "cdrom_image_{0}"
            self.sha1_key = "x_cdrom_image_{0}_sha1"
        else:
            self.file_key_prefix = "floppy_image_"
            self.file_key = "floppy_image_{0}"
            self.sha1_key = "x_floppy_image_{0}_sha1"

        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, expand=False, fill=True)
        self.heading_label = fsui.HeadingLabel(self,
                                               gettext("Media Swap List"))
        hori_layout.add(self.heading_label,
                        margin=10,
                        margin_top=20,
                        margin_bottom=20)
        hori_layout.add_spacer(0, expand=True)
        if not self.cd_mode:
            # hori_layout.add(ConfigWidgetFactory().create(
            #     self, Option.SAVE_DISK), margin_right=20)
            hori_layout.add(SaveDiskCheckBox(self), margin_right=20)
        clear_button = IconButton(self, "clear_button.png")
        clear_button.set_tooltip(gettext("Clear List"))
        clear_button.activated.connect(self.on_clear_list)
        hori_layout.add(clear_button, margin_right=10)
        remove_button = IconButton(self, "remove_button.png")
        remove_button.set_tooltip(gettext("Remove Selected Files"))
        remove_button.activated.connect(self.on_remove_button)
        hori_layout.add(remove_button, margin_right=10)
        add_button = IconButton(self, "add_button.png")
        add_button.set_tooltip(gettext("Add Files to List"))
        add_button.activated.connect(self.on_add_button)
        hori_layout.add(add_button, margin_right=10)

        # hori_layout = fsui.HorizontalLayout()
        # self.layout.add(hori_layout, expand=True, fill=True)
        self.list_view = fsui.ListView(self)
        self.list_view.on_activate_item = self.on_activate_item
        if self.cd_mode:
            self.default_icon = fsui.Image("launcher:res/cdrom_16.png")
        else:
            self.default_icon = fsui.Image("launcher:res/floppy_16.png")
        # hori_layout.add(self.list_view, expand=True, fill=True, margin=10)
        self.layout.add(self.list_view,
                        expand=True,
                        fill=True,
                        margin=10,
                        margin_top=0)

        # vert_layout = fsui.VerticalLayout()
        # hori_layout.add(vert_layout, fill=True)

        # add_button = IconButton(self, "add_button.png")
        # add_button.set_tooltip(gettext("Add Files to List"))
        # add_button.activated.connect(self.on_add_button)
        # vert_layout.add(add_button, margin=10)
        #
        # remove_button = IconButton(self, "remove_button.png")
        # remove_button.set_tooltip(gettext("Remove Selected Files"))
        # remove_button.activated.connect(self.on_remove_button)
        # vert_layout.add(remove_button, margin=10)
        #
        # clear_button = IconButton(self, "clear_button.png")
        # clear_button.set_tooltip(gettext("Clear List"))
        # clear_button.activated.connect(self.on_clear_list)
        # vert_layout.add(clear_button, margin=10)

        self.update_list()
        LauncherConfig.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))
示例#28
0
    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:res/fsuae_config_16.png")
        self.adf_icon = fsui.Image("launcher:res/adf_game_16.png")
        self.ipf_icon = fsui.Image("launcher:res/ipf_game_16.png")
        self.cd_icon = fsui.Image("launcher:res/cd_game_16.png")
        self.hd_icon = fsui.Image("launcher:res/hd_game_16.png")
        # self.missing_icon = fsui.Image(
        #     "launcher:res/missing_game_16.png")
        self.missing_icon = fsui.Image("launcher:res/16x16/delete_grey.png")
        self.missing_color = fsui.Color(0xA8, 0xA8, 0xA8)

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

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

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

        LauncherSettings.add_listener(self)
        self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))
示例#29
0
    def __init__(self, parent=None):
        print("LoginWindow, parent =", parent)
        super().__init__(parent, gettext("Log In to Your OAGD.net Account"))
        self.set_icon(fsui.Icon("password", "pkg:workspace"))
        self.theme = WorkspaceTheme.instance()
        self.layout = fsui.VerticalLayout()

        self.layout.set_padding(20, 20, 20, 20)

        heading_layout = fsui.HorizontalLayout()
        self.layout.add(heading_layout)
        heading_layout.add(
            fsui.ImageView(self, fsui.Image("workspace:res/48/password.png")))
        heading_layout.add_spacer(20)
        heading_layout_2 = fsui.VerticalLayout()
        heading_layout.add(heading_layout_2,
                           expand=True,
                           fill=False,
                           valign=0.5)
        heading_layout_2.add(
            fsui.HeadingLabel(self,
                              gettext("Log In to Your OAGD.net Account")))
        heading_layout_2.add_spacer(2)
        heading_layout_2.add(
            fsui.Label(
                self,
                gettext("Logging in will enable the online game database "
                        "and more")))

        self.username_field = fsui.TextField(
            self, app.settings["database_email"].strip())
        self.password_field = fsui.PasswordField(self)
        if self.username_field.get_text():
            self.password_field.focus()

        self.layout.add_spacer(20)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        label = fsui.Label(self, gettext("E-mail:"))
        label.set_min_width(100)
        hori_layout.add(label)
        hori_layout.add_spacer(20)
        # self.username_field.select_all()
        self.username_field.changed.connect(self.on_text_field_changed)
        self.username_field.activated.connect(self.on_username_activated)
        hori_layout.add(self.username_field, expand=True)

        self.layout.add_spacer(10)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        label = fsui.Label(self, gettext("Password:"******"Don't have an account already?"))
        hori_layout.add(label)
        hori_layout.add_spacer(20)
        label = fsui.URLLabel(
            self, gettext("Create an account now"),
            "https://oagd.net/user/register?referrer=fs-uae-launcher")
        hori_layout.add(label, expand=True)

        self.layout.add_spacer(6)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        label = fsui.Label(self, gettext("Forgot your password?"))
        hori_layout.add(label)
        hori_layout.add_spacer(20)
        self.reset_label = fsui.URLLabel(
            self, gettext("Reset password via e-mail"),
            "https://oagd.net/user/reset?referrer=fs-uae-launcher")
        hori_layout.add(self.reset_label, expand=True)

        self.layout.add_spacer(20)
        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        self.created_label = fsui.Label(self, "")
        hori_layout.add(self.created_label, expand=True)
        hori_layout.add_spacer(20)

        self.login_button = fsui.Button(self, gettext("Log In"))
        self.login_button.disable()
        self.login_button.activated.connect(self.on_login_activated)
        hori_layout.add(self.login_button)

        if self.window.theme.has_close_buttons:
            self.close_button = CloseButton(self)
            hori_layout.add(self.close_button, fill=True, margin_left=10)

        self.set_size(self.layout.get_min_size())
        self.center_on_parent()

        if len(self.username_field.text()) == 0:
            self.username_field.focus()
        else:
            self.password_field.focus()
示例#30
0
    def add_column_content(self, column):
        default_page_index = 0
        default_tab_index_offset = 0
        if column == 1:
            if Skin.fws():
                self.add_tab_spacer(5)
                self.add_tab_spacer(64)
            else:
                # if USE_MAIN_MENU:
                icon = fsui.Image("launcher:res/32/main-menu.png")
                self.menu_button = self.add_tab_button(
                    None,
                    icon,
                    gettext("Main Menu"),
                    menu_function=self.open_main_menu,
                    left_padding=5,
                )
            # default_tab_index_offset = 1
            # self.add_tab_spacer(60)
            # else:
            #    self.add_tab_spacer(10)

            # page_index = 0
            self.configurations_panel = self.add_page(
                column,
                ConfigurationsPanel,
                "",
                gettext("Configurations"),
                gettext("Configuration Browser"),
            )

            self.add_tab_spacer(0, expand=True)

        elif column == 2:
            self.new_tab_group()

            self.add_tab_spacer(10)
            self.add_page(
                column,
                MainPanel,
                "32x32/go-home",
                gettext("Config"),
                gettext("Main Configuration Options"),
            )
            self.add_page(
                column,
                FloppiesPanel,
                "32x32/media-floppy",
                gettext("Floppies"),
                gettext("Floppy Drives"),
            )
            self.add_page(
                column,
                CDPanel,
                "32x32/media-optical",
                gettext("CD-ROMs"),
                gettext("CD-ROM Drives"),
            )
            # noinspection SpellCheckingInspection
            self.add_page(
                column,
                HardDrivesPanel,
                "32x32/drive-harddisk",
                gettext("Hard Drives"),
            )
            self.add_scroll_page(
                column,
                RomRamPanel,
                "32x32/application-x-firmware",
                gettext("Hardware"),
                gettext("ROM and RAM"),
            )
            self.add_page(
                column,
                InputPanel,
                "32x32/applications-games",
                gettext("Input"),
                gettext("Input Options"),
            )
            self.add_scroll_page(
                column,
                ExpansionsPanel,
                "32x32/audio-card",
                gettext("Expansions"),
                gettext("Expansions"),
            )
            self.add_scroll_page(
                column,
                AdditionalConfigPanel,
                "32x32/system-shutdown",
                gettext("Additional Configuration"),
                gettext("Additional Configuration"),
            )

            self.add_tab_spacer(0, expand=True)
            self.add_tab_spacer(10)
            self.add_tab_button(
                self.toggle_quick_settings_sidebar,
                fsui.Image("launcher:res/32/quick-settings-sidebar.png"),
                gettext("Toggle quick settings sidebar"),
                right_padding=5,
            )

            # column - 1 is the group id of the tab group
            self.select_tab(default_page_index + default_tab_index_offset,
                            column - 1)
        self.books[column].set_page(default_page_index)