def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("language-settings", "pkg:workspace")
        # gettext("Appearance")
        title = gettext("Language")
        # gettext("Set language and look for FS-UAE applications")
        subtitle = gettext("Set language for FS-UAE applications")
        self.add_header(icon, title, subtitle)

        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        # hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add_spacer(0, expand=True)
        self.language_choice = LanguageSettingChoice(self)
        hori_layout.add(self.language_choice)

        self.layout.add_spacer(20)

        information = ""
        # information = gettext(
        #     "A change of language will only affect applications "
        #     "which are restarted after the change.")
        # information += "\n\n"
        information += gettext(
            "When Automatic is specified, your preferred language is set "
            "based on information from the operating system (or English, "
            "if a supported language is not detected).")
        self.layout.add(
            fsui.MultiLineLabel(self, information, 640))
Ejemplo n.º 2
0
    def __init__(self, parent=None):
        print("RefreshWindow parent =", parent)
        title = gettext("Updating Database")
        super().__init__(parent, title, maximizable=False)
        self.set_icon(fsui.Icon("refresh", "pkg:workspace"))

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

        self.icon_header = IconHeader(self,
                                      fsui.Icon("refresh", "pkg:workspace"),
                                      gettext("Updating Database"), "")
        self.layout.add(self.icon_header, fill=True, margin_bottom=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.stop_button = fsui.Button(self, gettext("Stop"))
        self.stop_button.activated.connect(self.on_abort_activated)
        hori_layout.add(self.stop_button)

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

        self.task = DatabaseRefreshTask()
        self.task.progressed.connect(self.on_progress)
        self.task.failed.connect(self.on_failure)
        self.task.succeeded.connect(self.close)
        self.task.stopped.connect(self.close)
        self.task.start()
Ejemplo n.º 3
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("fs-uae-launcher", "pkg:launcher")
        self.add_header(icon, "{} Launcher".format(fsgs.product))

        if fsboot.get("fws") == "1":
            # We omit the appearance settings, since they have no effect
            # when running under the workspace environment.
            pass
        else:
            self.add_option(Option.LAUNCHER_THEME)
            self.add_option(Option.LAUNCHER_FONT_SIZE)

        self.add_option(Option.LAUNCHER_CLOSE_BUTTONS)

        self.add_section(gettext("Experimental Features"))
        # Netplay feature is now enabled by default
        # self.add_option(Option.NETPLAY_FEATURE)
        if not openretro:
            self.add_option(Option.PLATFORMS_FEATURE)
        # self.add_option(Option.LAUNCHER_CONFIG_FEATURE)
        # self.add_option(Option.LAUNCHER_SETUP_WIZARD_FEATURE)

        self.add_section(gettext("Maintenance"))
        label = fsui.MultiLineLabel(
            self,
            gettext(
                "Defragmenting the databases will improve performance "
                "by ensuring that tables and indices are stored contiguously "
                "on disk. It will also reclaim some storage space."), 640)
        self.layout.add(label, fill=True, margin_top=20)
        button = fsui.Button(self, gettext("Defragment Databases"))
        button.activated.connect(self.on_defragment_button)
        self.layout.add(button, margin_top=20)
Ejemplo n.º 4
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("language-settings", "pkg:workspace")
        # gettext("Appearance")
        title = gettext("Language")
        # gettext("Set language and look for FS-UAE applications")
        subtitle = gettext("Set language for FS-UAE applications")
        self.add_header(icon, title, subtitle)

        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        # hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add_spacer(0, expand=True)
        self.language_choice = LanguageSettingChoice(self)
        hori_layout.add(self.language_choice)

        self.layout.add_spacer(20)

        information = ""
        # information = gettext(
        #     "A change of language will only affect applications "
        #     "which are restarted after the change.")
        # information += "\n\n"
        information += gettext(
            "When Automatic is specified, your preferred language is set "
            "based on information from the operating system (or English, "
            "if a supported language is not detected).")
        self.layout.add(fsui.MultiLineLabel(self, information, 640))
Ejemplo n.º 5
0
    def __init__(self, parent=None):
        print("RefreshWindow parent =", parent)
        title = gettext("Updating Database")
        super().__init__(parent, title, maximizable=False)
        self.set_icon(fsui.Icon("refresh", "pkg:workspace"))

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

        self.icon_header = IconHeader(
            self, fsui.Icon("refresh", "pkg:workspace"),
            gettext("Updating Database"), "")
        self.layout.add(self.icon_header, fill=True, margin_bottom=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.stop_button = fsui.Button(self, gettext("Stop"))
        self.stop_button.activated.connect(self.on_abort_activated)
        hori_layout.add(self.stop_button)

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

        self.task = DatabaseRefreshTask()
        self.task.progressed.connect(self.on_progress)
        self.task.failed.connect(self.on_failure)
        self.task.succeeded.connect(self.close)
        self.task.stopped.connect(self.close)
        self.task.start()
Ejemplo n.º 6
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)
Ejemplo n.º 7
0
    def upload_prefix(self, prefix):
        self.stop_check()
        result = self.upload_check(prefix)
        print(len(result))
        for k in range(0, len(result), 20):
            self.stop_check()

            sha1 = result[k:k + 20]
            path = fsgs.file.find_by_sha1(bytes_to_hex(sha1))
            if not path:
                continue
            try:
                # this is done to properly handle encrypted ROMs
                archive = Archive(path)
                # FIXME: Use Archive.open to get support for filter functions
                # FIXME: Also use stream api, do not buffer entire file
                data = ROMManager.decrypt_archive_rom(archive, path)["data"]
            except Exception:
                traceback.print_exc()
                uri = "sha1://{0}".format(bytes_to_hex(sha1))
                print(uri)
                try:
                    input_stream = fsgs.file.open(uri)
                    data = input_stream.read()
                except Exception:
                    continue
                assert not input_stream.read()

            print("uploading file of size ", len(data))

            # self.progressed(gettext("Verifying {name}").format(
            #                 name=bytes_to_hex(sha1)))
            self.progressed(
                gettext("Uploading {name}").format(name=bytes_to_hex(sha1)))
            import hashlib

            new_hash = hashlib.sha1(data).hexdigest()
            print(new_hash, "vs", bytes_to_hex(sha1))
            if hashlib.sha1(data).hexdigest() != bytes_to_hex(sha1):
                print("hash mismatch, probably Cloanto ROM...")
                continue

            retry_seconds = 1
            while True:
                try:
                    self.client.post("/api/locker-upload-file", data=data)
                except OGDClient.NonRetryableHTTPError as e:
                    raise e
                except Exception:
                    traceback.print_exc()
                    self.progressed(
                        gettext("Re-trying in {0} seconds...").format(
                            retry_seconds))
                    for _ in range(retry_seconds):
                        self.stop_check()
                        time.sleep(1.0)
                    retry_seconds = min(retry_seconds * 2, 60 * 10)
                else:
                    break
Ejemplo n.º 8
0
    def upload_prefix(self, prefix):
        self.stop_check()
        result = self.upload_check(prefix)
        print(len(result))
        for k in range(0, len(result), 20):
            self.stop_check()

            sha1 = result[k:k + 20]
            path = fsgs.file.find_by_sha1(bytes_to_hex(sha1))
            if not path:
                continue
            try:
                # this is done to properly handle encrypted ROMs
                archive = Archive(path)
                data = ROMManager.decrypt_archive_rom(archive, path)["data"]
            except Exception:
                traceback.print_exc()
                uri = "sha1://{0}".format(bytes_to_hex(sha1))
                print(uri)
                try:
                    input_stream = fsgs.file.open(uri)
                    data = input_stream.read()
                except Exception:
                    continue
                assert not input_stream.read()

            print("uploading file of size ", len(data))

            # self.progressed(gettext("Verifying {name}").format(
            #                 name=bytes_to_hex(sha1)))
            self.progressed(gettext("Uploading {name}").format(
                            name=bytes_to_hex(sha1)))
            import hashlib
            new_hash = hashlib.sha1(data).hexdigest()
            print(new_hash, "vs", bytes_to_hex(sha1))
            if hashlib.sha1(data).hexdigest() != bytes_to_hex(sha1):
                print("hash mismatch, probably Cloanto ROM...")
                continue

            retry_seconds = 1
            while True:
                try:
                    self.client.post("/api/locker-upload-file", data=data)
                except OGDClient.NonRetryableHTTPError as e:
                    raise e
                except Exception:
                    traceback.print_exc()
                    self.progressed(gettext(
                        "Re-trying in {0} seconds...").format(retry_seconds))
                    for _ in range(retry_seconds):
                        self.stop_check()
                        time.sleep(1.0)
                    retry_seconds = min(retry_seconds * 2, 60 * 10)
                else:
                    break
Ejemplo n.º 9
0
    def create_disk_file(self):
        self.created_label.set_text("")
        disk_type = self.list_view.get_index()
        path = self.dir_field.get_text().strip()
        if not os.path.isdir(path):
            return self.show_error(
                gettext("Specified directory does not exist"))
        name = self.name_field.get_text().strip()
        ext = ".hdf"
        if not name.lower().endswith(ext):
            name += ext
        path = os.path.join(path, name)

        try:
            size = int(self.size_field.get_text())
        except ValueError:
            return self.show_error(gettext("Invalid size specified"))
        else:
            size = size * 1024 * 1024
        if disk_type == 2:
            if size >= 512 * 1024 * 1024:
                return self.show_error(
                    gettext("Use RDB disk images for size >= {0}".format(512)))

        if os.path.exists(path):
            return self.show_error(gettext("File already exists"))

        path_partial = path + ".partial"
        try:
            f = open(path_partial, "wb")
        except Exception:
            print("error opening", path)
            traceback.print_exc()
            return self.show_error(gettext("Could not open file for writing"))

        try:
            if disk_type == 0:
                self.create_hdf(f, size)
            elif disk_type == 1:
                self.create_rdb(f, size)
        except Exception:
            traceback.print_exc()
            try:
                f.close()
            except Exception:
                pass
            try:
                os.unlink(path_partial)
            except Exception:
                pass
            return self.show_error(gettext("Error writing disk image"))
        else:
            f.close()
            try:
                shutil.move(path_partial, path)
            except Exception:
                print("error moving", path_partial, path)
                traceback.print_exc()
                return self.show_error(gettext("Error moving file into place"))
        self.show_success(gettext("Disk image created") + ": " + name)
Ejemplo n.º 10
0
    def create_disk_file(self):
        self.created_label.set_text("")
        disk_type = self.list_view.get_index()
        path = self.dir_field.get_text().strip()
        if not os.path.isdir(path):
            return self.show_error(
                gettext("Specified directory does not exist"))
        name = self.name_field.get_text().strip()
        ext = ".hdf"
        if not name.lower().endswith(ext):
            name += ext
        path = os.path.join(path, name)

        try:
            size = int(self.size_field.get_text())
        except ValueError:
            return self.show_error(gettext("Invalid size specified"))
        else:
            size = size * 1024 * 1024
        if disk_type == 2:
            if size >= 512 * 1024 * 1024:
                return self.show_error(
                    gettext("Use RDB disk images for size >= {0}".format(512)))

        if os.path.exists(path):
            return self.show_error(gettext("File already exists"))

        path_partial = path + ".partial"
        try:
            f = open(path_partial, "wb")
        except Exception:
            print("error opening", path)
            traceback.print_exc()
            return self.show_error(gettext("Could not open file for writing"))

        try:
            if disk_type == 0:
                self.create_hdf(f, size)
            elif disk_type == 1:
                self.create_rdb(f, size)
        except Exception:
            traceback.print_exc()
            try:
                f.close()
            except Exception:
                pass
            try:
                os.unlink(path_partial)
            except Exception:
                pass
            return self.show_error(gettext("Error writing disk image"))
        else:
            f.close()
            try:
                shutil.move(path_partial, path)
            except Exception:
                print("error moving", path_partial, path)
                traceback.print_exc()
                return self.show_error(gettext("Error moving file into place"))
        self.show_success(gettext("Disk image created") + ": " + name)
Ejemplo n.º 11
0
    def upload_check(self, prefix):
        self.progressed(
            gettext("Finding files eligible for OAGD.net Locker")
            + " ({:0.0%})".format((prefix / 16.0))
        )
        file_database = FileDatabase.instance()
        cursor = file_database.cursor()
        # FIXME: prefix
        p = "0123456789ABCDEF"[prefix]
        cursor.execute(
            "SELECT DISTINCT sha1 FROM file " "WHERE hex(sha1) LIKE ?",
            (p + "%",),
        )
        string_io = StringIO()
        for row in cursor:
            string_io.write(row[0])
        # print(prefix, len(string_io.getvalue()))
        self.stop_check()

        retry_seconds = 1
        while True:
            try:
                result = self.client.post(
                    "/api/locker-upload-check", data=string_io.getvalue()
                )
            except OGDClient.ForbiddenError:
                raise Task.Failure(
                    gettext(
                        "OAGD.net Locker is not enabled for your user. "
                        "It may be available only to a few select beta "
                        "users."
                    )
                )
            except OGDClient.NonRetryableHTTPError as e:
                raise e
            except Exception:
                traceback.print_exc()
                self.progressed(
                    gettext("Re-trying in {0} seconds...").format(
                        retry_seconds
                    )
                )
                for _ in range(retry_seconds):
                    self.stop_check()
                    time.sleep(1.0)
                retry_seconds = min(retry_seconds * 2, 60 * 10)
            else:
                return result
Ejemplo n.º 12
0
    def __init__(self, parent, task):
        fsui.Window.__init__(self, parent, task.get_task_name())
        self.set_icon(fsui.Icon("tools", "pkg:workspace"))

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

        self.icon_header = IconHeader(
            self, fsui.Icon("tools", "pkg:workspace"), task.get_task_name(), ""
        )
        self.layout.add(self.icon_header, fill=True, margin_bottom=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.abort_button = fsui.Button(self, gettext("Stop"))
        self.abort_button.activated.connect(self.on_abort_activated)
        hori_layout.add(self.abort_button)

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

        self.task = task
        self.task.progressed.connect(self.on_progress)
        self.task.failed.connect(self.on_failure)
        self.task.succeeded.connect(self.close)
        self.task.stopped.connect(self.close)
        self.task.start()
Ejemplo n.º 13
0
    def __init__(self, parent, task):
        fsui.Window.__init__(
            self, parent, task.get_task_name())
        self.set_icon(fsui.Icon("tools", "pkg:workspace"))

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

        self.icon_header = IconHeader(
            self, fsui.Icon("tools", "pkg:workspace"),
            task.get_task_name(), "")
        self.layout.add(self.icon_header, fill=True, margin_bottom=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.abort_button = fsui.Button(self, gettext("Stop"))
        self.abort_button.activated.connect(self.on_abort_activated)
        hori_layout.add(self.abort_button)

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

        self.task = task
        self.task.progressed.connect(self.on_progress)
        self.task.failed.connect(self.on_failure)
        self.task.succeeded.connect(self.close)
        self.task.stopped.connect(self.close)
        self.task.start()
    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/16/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)
Ejemplo n.º 15
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)
Ejemplo n.º 16
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)
Ejemplo n.º 17
0
 def on_browse_clicked(self):
     # if hasattr(self, "dialog"):
     #    return
     self.dialog = fsui.DirDialog(
         None, gettext("Select Destination Directory"))
     self.dialog.accepted.connect(self.on_dialog_accepted)
     # self.dialog.destroyed.connect(self.on_dialog_destroyed)
     # self.dialog.finished.connect(self.on_dialog_finished)
     self.dialog.show()
Ejemplo n.º 18
0
 def on_browse_clicked(self):
     # if hasattr(self, "dialog"):
     #    return
     self.dialog = fsui.DirDialog(
         None, gettext("Select Destination Directory"))
     self.dialog.accepted.connect(self.on_dialog_accepted)
     # self.dialog.destroyed.connect(self.on_dialog_destroyed)
     # self.dialog.finished.connect(self.on_dialog_finished)
     self.dialog.show()
Ejemplo n.º 19
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 __init__(self, parent):
        super().__init__(parent)
        # icon = fsui.Icon("language-settings", "pkg:workspace")
        # title = gettext("Language")
        # subtitle = gettext("Set language for FS-UAE applications")
        # self.add_header(icon, title, subtitle)

        PrefsNotWorkingWarningPanel(parent=self)
        self.layout.add_spacer(20)

        hori_layout = fsui.HorizontalLayout()
        self.layout.add(hori_layout, fill=True)
        # hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add(fsui.Label(self, gettext("Language:")))
        hori_layout.add_spacer(0, expand=True)
        self.language_choice = LanguageSettingChoice(self)
        hori_layout.add(self.language_choice)

        self.layout.add_spacer(20)

        information = ""
        # information = gettext(
        #     "A change of language will only affect applications "
        #     "which are restarted after the change.")
        # information += "\n\n"
        information += gettext(
            "When Automatic is specified, your preferred language is set "
            "based on information from the operating system (or English, "
            "if a supported language is not detected)."
        )
        self.layout.add(fsui.MultiLineLabel(self, information, 500))

        label = fsui.Label(
            self, "You can help translate FS-UAE on crowdin.net:"
        )
        self.layout.add(label, margin_top=20)
        label = fsui.URLLabel(
            self,
            "https://crowdin.com/project/fs-uae",
            "https://crowdin.com/project/fs-uae",
        )
        self.layout.add(label, margin_top=5)
Ejemplo n.º 21
0
    def upload_check(self, prefix):
        self.progressed(
            gettext("Finding files eligible for OpenRetro Locker") +
            " ({:0.0%})".format((prefix / 16.0)))
        file_database = FileDatabase.instance()
        cursor = file_database.cursor()
        # FIXME: prefix
        p = "0123456789ABCDEF"[prefix]
        cursor.execute(
            "SELECT DISTINCT sha1 FROM file "
            "WHERE hex(sha1) LIKE ?",
            (p + "%", ),
        )
        string_io = StringIO()
        for row in cursor:
            string_io.write(row[0])
        # print(prefix, len(string_io.getvalue()))
        self.stop_check()

        retry_seconds = 1
        while True:
            try:
                result = self.client.post("/api/locker-upload-check",
                                          data=string_io.getvalue())
            except OGDClient.ForbiddenError:
                raise Task.Failure(
                    gettext("OpenRetro Locker is not enabled for your user. "
                            "It may be available only to a few select beta "
                            "users."))
            except OGDClient.NonRetryableHTTPError as e:
                raise e
            except Exception:
                traceback.print_exc()
                self.progressed(
                    gettext("Re-trying in {0} seconds...").format(
                        retry_seconds))
                for _ in range(retry_seconds):
                    self.stop_check()
                    time.sleep(1.0)
                retry_seconds = min(retry_seconds * 2, 60 * 10)
            else:
                return result
Ejemplo n.º 22
0
    def __init__(self, parent=None):
        title = gettext("OAGD.net Locker Uploader")
        super().__init__(parent, title)
        self.theme = WorkspaceTheme.instance()
        self.layout = fsui.VerticalLayout()
        self.set_icon(fsui.Icon("refresh", "pkg:workspace"))

        self.layout.min_width = 600
        self.layout.set_padding(20, 20, 20, 20)

        self.icon_header = IconHeader(
            self,
            fsui.Icon("refresh", "pkg:workspace"),
            gettext("OAGD.net Locker Uploader"),
            gettext("Upload recognized Amiga files to your OAGD.net locker"),
        )
        self.layout.add(self.icon_header, fill=True, margin_bottom=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)

        self.upload_button = fsui.Button(self, gettext("Upload"))
        self.upload_button.activated.connect(self.on_upload_activated)
        hori_layout.add(self.upload_button, margin_left=10)

        self.stop_button = fsui.Button(self, gettext("Stop"))
        self.stop_button.activated.connect(self.on_stop_activated)
        self.stop_button.disable()
        hori_layout.add(self.stop_button, margin_left=10)

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

        self.set_size(self.layout.get_min_size())
        self.center_on_parent()
        self.task = None
Ejemplo n.º 23
0
    def __init__(self, parent=None):
        title = gettext("OpenRetro Locker Uploader")
        super().__init__(parent, title)
        self.theme = WorkspaceTheme.instance()
        self.layout = fsui.VerticalLayout()
        self.set_icon(fsui.Icon("refresh", "pkg:workspace"))

        self.layout.min_width = 600
        self.layout.set_padding(20, 20, 20, 20)

        self.icon_header = IconHeader(
            self,
            fsui.Icon("refresh", "pkg:workspace"),
            gettext("OpenRetro Locker Uploader"),
            gettext("Upload recognized Amiga files to your OpenRetro locker"),
        )
        self.layout.add(self.icon_header, fill=True, margin_bottom=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)

        self.upload_button = fsui.Button(self, gettext("Upload"))
        self.upload_button.activated.connect(self.on_upload_activated)
        hori_layout.add(self.upload_button, margin_left=10)

        self.stop_button = fsui.Button(self, gettext("Stop"))
        self.stop_button.activated.connect(self.on_stop_activated)
        self.stop_button.disable()
        hori_layout.add(self.stop_button, margin_left=10)

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

        self.set_size(self.layout.get_min_size())
        self.center_on_parent()
        self.task = None
Ejemplo n.º 24
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("fs-uae", "pkg:launcher")
        self.add_header(icon, "FS-UAE")

        label = fsui.MultiLineLabel(
            self,
            gettext("The following options may affect performance, "
                    "so only enable them when needed for testing or "
                    "debugging purposes."), 640)
        self.layout.add(label, fill=True, margin_top=20)

        self.add_option(Option.LOG_AUTOSCALE)
        self.add_option(Option.LOG_INPUT)
Ejemplo n.º 25
0
    def create_disk_file(self):
        self.created_label.set_text("")
        disk_type = self.list_view.get_index()
        path = self.dir_field.get_text().strip()
        if not os.path.isdir(path):
            return self.show_error(
                gettext("Specified directory does not exist")
            )
        name = self.name_field.get_text().strip()
        ext = ".adf"
        if not name.lower().endswith(ext):
            name += ext
        path = os.path.join(path, name)

        # if disk_type == 0:
        #     size = 901120
        # elif disk_type == 1:
        #     size = 2104892

        if os.path.exists(path):
            return self.show_error(gettext("File already exists"))

        path_partial = path + ".partial"
        try:
            f = open(path_partial, "wb")
        except Exception:
            print("error opening", path)
            traceback.print_exc()
            return self.show_error(gettext("Could not open file for writing"))

        try:
            if disk_type == 0:
                self.create_adf(f)
            elif disk_type == 1:
                self.create_extended_adf(f)
        except Exception:
            traceback.print_exc()
            try:
                f.close()
            except Exception:
                pass
            try:
                os.unlink(path_partial)
            except Exception:
                pass
            return self.show_error(gettext("Error writing disk image"))
        else:
            f.close()
            try:
                shutil.move(path_partial, path)
            except Exception:
                print("error moving", path_partial, path)
                traceback.print_exc()
                return self.show_error(gettext("Error moving file into place"))

        self.show_success(gettext("Disk image created") + ": " + name)
Ejemplo n.º 26
0
    def __init__(self, parent=None):
        title = gettext("OAGD.net Locker Uploader")
        super().__init__(parent, title, maximizable=False)
        self.set_icon(fsui.Icon("refresh", "pkg:workspace"))

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

        self.icon_header = IconHeader(
            self, fsui.Icon("refresh", "pkg:workspace"),
            gettext("OAGD.net Locker Uploader"),
            gettext("Upload recognized Amiga files to your OAGD.net locker"))
        self.layout.add(self.icon_header, fill=True, margin_bottom=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)

        self.upload_button = fsui.Button(self, gettext("Upload"))
        self.upload_button.activated.connect(self.on_upload_activated)
        hori_layout.add(self.upload_button, margin_left=10)

        self.stop_button = fsui.Button(self, gettext("Stop"))
        self.stop_button.activated.connect(self.on_stop_activated)
        self.stop_button.disable()
        hori_layout.add(self.stop_button, margin_left=10)

        # self.close_button = fsui.Button(self, gettext("Close"))
        # self.close_button.activated.connect(self.on_close_activated)
        # hori_layout.add(self.close_button, margin_left=10)

        self.set_size(self.layout.get_min_size())
        self.center_on_parent()
        self.task = None
Ejemplo n.º 27
0
    def create_disk_file(self):
        self.created_label.set_text("")
        disk_type = self.list_view.get_index()
        path = self.dir_field.get_text().strip()
        if not os.path.isdir(path):
            return self.show_error(
                gettext("Specified directory does not exist"))
        name = self.name_field.get_text().strip()
        ext = ".adf"
        if not name.lower().endswith(ext):
            name += ext
        path = os.path.join(path, name)

        # if disk_type == 0:
        #     size = 901120
        # elif disk_type == 1:
        #     size = 2104892

        if os.path.exists(path):
            return self.show_error(gettext("File already exists"))

        path_partial = path + ".partial"
        try:
            f = open(path_partial, "wb")
        except Exception:
            print("error opening", path)
            traceback.print_exc()
            return self.show_error(gettext("Could not open file for writing"))

        try:
            if disk_type == 0:
                self.create_adf(f)
            elif disk_type == 1:
                self.create_extended_adf(f)
        except Exception:
            traceback.print_exc()
            try:
                f.close()
            except Exception:
                pass
            try:
                os.unlink(path_partial)
            except Exception:
                pass
            return self.show_error(gettext("Error writing disk image"))
        else:
            f.close()
            try:
                shutil.move(path_partial, path)
            except Exception:
                print("error moving", path_partial, path)
                traceback.print_exc()
                return self.show_error(gettext("Error moving file into place"))

        self.show_success(gettext("Disk image created") + ": " + name)
Ejemplo n.º 28
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("settings", "pkg:workspace")
        self.add_header(icon, "FS-UAE Launcher")

        if fsboot.get("fws") == "1":
            # We omit the appearance settings, since they have no effect
            # when running under the workspace environment.
            pass
        else:
            self.add_option("launcher_theme")
            self.add_option("launcher_font_size")

        self.add_section(gettext("Experimental Features"))
        # self.add_option(Option.NETPLAY_FEATURE)
        self.add_option(Option.LAUNCHER_CONFIG_FEATURE)
Ejemplo n.º 29
0
    def __init__(self, parent):
        super().__init__(parent)
        icon = fsui.Icon("fs-uae", "pkg:launcher")
        self.add_header(icon, "FS-UAE")

        label = fsui.MultiLineLabel(
            self,
            gettext(
                "The following options may affect performance, "
                "so only enable them when needed for testing or "
                "debugging purposes."
            ),
            640,
        )
        self.layout.add(label, fill=True, margin_top=20)

        self.add_option(Option.LOG_AUTOSCALE)
        self.add_option(Option.LOG_INPUT)
Ejemplo n.º 30
0
 def run(self):
     for i in range(16):
         self.upload_prefix(i)
     self.progressed(gettext("OAGD.net upload task completed successfully"))
 def __init__(self, parent):
     super().__init__(parent)
     icon = fsui.Icon("settings", "pkg:workspace")
     self.add_header(icon, gettext("Directories"))
Ejemplo n.º 32
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()
Ejemplo n.º 33
0
    def __init__(self, parent=None):
        title = gettext("HDF Disk Image Creator")
        super().__init__(parent, title=title, maximizable=False)
        buttons, layout = fsui.DialogButtons.create_with_layout(self)
        # 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/16/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()
                "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)

        self.item_selected.connect(self.__item_changed)

    def __item_changed(self, index):
        LauncherSettings.set("language", LANGUAGE_ITEMS[index][1])


LANGUAGE_ITEMS = [
    # language name, language code, country flag code
    (gettext("Automatic"), "", "unknown"),
    ("Čeština", "cs", "cz"),
    ("Dansk", "da", "dk"),
    ("Deutsch", "de", "de"),
    ("English", "en", "gb"),
    ("Español", "es", "es"),
    ("Français", "fr", "fr"),
    ("Eλληνικά", "el", "gr"),  # greek
    ("Italiano", "it", "it"),
    ("Norsk (bokmål)", "nb", "no"),
    ("Polski", "pl", "pl"),
    ("Português", "pt", "pt"),
    ("Srpski", "sr", "rs"),  # srpski or српски
    ("Svensk", "sv", "se"),
    ("Suomi", "fi", "fi"),
    ("Türkçe", "tr", "tr"),
Ejemplo n.º 35
0
    def __init__(self):
        super().__init__(title=gettext("OpenRetro Login"), maximizable=False)
        # return
        self.set_icon(fsui.Icon("password", "pkg:workspace"))
        # self.theme = WorkspaceTheme.instance()

        with FlexContainer(
                parent=self,
                style={
                    "backgroundColor": "#bbbbbb",
                    "gap": 20,
                    # "marginLeft": 10,
                    # "marginRight": 10,
                    # "marginTop": 10,
                    "padding": 20,
                    "paddingBottom": 10,
                },
        ):
            with VerticalFlexContainer(style={"flexGrow": 1, "gap": 5}):
                Label(
                    gettext("Log in to your OpenRetro.org account"),
                    style={"fontWeight": "bold"},
                )
                Label(
                    gettext("Logging in will enable the online game database "
                            "and more"))
            ImageView(fsui.Image("workspace:/data/48/password.png"))

        with VerticalFlexContainer(
                parent=self,
                style={
                    "backgroundColor": "#bbbbbb",
                    "gap": 10,
                    # "marginLeft": 10,
                    # "marginRight": 10,
                    # "padding": 10,
                    "padding": 20,
                    "paddingBottom": 10,
                    "paddingTop": 10,
                },
        ):
            labelStyle = {"width": 140}
            with FlexContainer():
                Label(gettext("E-mail:"), style=labelStyle)
                self.username_field = TextField(
                    app.settings["database_email"].strip(),
                    style={"flexGrow": 1},
                )
            with FlexContainer():
                Label(gettext("Password:"******"password",
                                                style={"flexGrow": 1})

        # with VerticalFlexContainer(
        #     parent=self,
        #     style={
        #         "backgroundColor": "#ff0000",
        #         "gap": 10,
        #         "padding": 20,
        #         "paddingTop": 0,
        #     },
        # ):
        #     with FlexContainer(style={"gap": 10}):
        #         Label(gettext("Don't have an account already?"))
        #         UrlLabel(
        #             gettext("Create an account now"),
        #             "https://openretro.org/user/register?r=fs-uae-launcher",
        #         )
        #     with FlexContainer(style={"gap": 10}):
        #         Label(gettext("Forgot your password?"))
        #         UrlLabel(
        #             gettext("Reset password via e-mail"),
        #             "https://openretro.org/user/reset?r=fs-uae-launcher",
        #         )

        with FlexContainer(
                parent=self,
                style={
                    "backgroundColor": "#bbbbbb",
                    "gap": 10,
                    # "marginLeft": 10,
                    # "marginRight": 10,
                    # "padding": 10,
                    "padding": 20,
                    "paddingBottom": 10,
                    "paddingTop": 10,
                },
        ):
            with VerticalFlexContainer(style={"gap": 10}):
                Label(gettext("Don't have an account already?"))
                Label(gettext("Forgot your password?"))
            with VerticalFlexContainer(style={"gap": 10}):
                UrlLabel(
                    gettext("Create an account on openretro.org"),
                    "https://openretro.org/user/register?r=fs-uae-launcher",
                )
                self.reset_label = UrlLabel(
                    gettext("Reset password via e-mail"),
                    "https://openretro.org/user/reset?r=fs-uae-launcher",
                )

        with FlexContainer(
                parent=self,
                style=
            {
                "backgroundColor": "#bbbbbb",
                "gap": 10,
                # "marginBottom": 10,
                # "marginLeft": 10,
                # "marginRight": 10,
                # "padding": 10,
                "padding": 20,
                "paddingTop": 10,
            },
        ):
            Spacer(style={"flexGrow": 1})
            # FIXME: Set visible via stylesheet instead?
            self.spinner = WidgetSizeSpinner(visible=False)
            self.login_button = Button(gettext("Log in"))

        self.username_field.changed.connect(self.on_text_field_changed)
        self.username_field.activated.connect(self.on_username_activated)
        self.password_field.changed.connect(self.on_text_field_changed)
        self.password_field.activated.connect(self.on_password_activated)
        self.login_button.set_enabled(False)
        self.login_button.activated.connect(self.on_login_activated)
        if len(self.username_field.text()) == 0:
            self.username_field.focus()
        else:
            self.password_field.focus()
Ejemplo n.º 36
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.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)

        # self.close_button = fsui.Button(self, gettext("Close"))
        # self.close_button.activated.connect(self.on_close_activated)
        # hori_layout.add(self.close_button, 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()
Ejemplo n.º 37
0
    def __init__(self, parent=None):
        title = gettext("ADF Disk Image Creator")
        super().__init__(parent, title=title, maximizable=False)
        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("floppy", "pkg:workspace"))

        layout.min_width = 500

        self.icon_header = IconHeader(
            self,
            fsui.Icon("floppy", "pkg:workspace"),
            gettext("ADF Disk Image Creator"),
            gettext("Create a blank or formatted ADF floppy disk 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/floppy.png")
        self.list_view.add_item(
            gettext("ADF - Standard Floppy Disk Image"), icon
        )
        self.list_view.add_item(
            gettext("ADF - Extended Floppy Disk Image (MFM Encoded)"), icon
        )
        layout.add(self.list_view, expand=True, fill=True)
        # self.list_view.on_select_item = self.on_select_item
        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.activated.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()
Ejemplo n.º 38
0
 def on_stopped(self):
     self.icon_header.subtitle_label.set_text(gettext("Stopped by user"))
     self.after_task_has_stopped()
Ejemplo n.º 39
0
    def __init__(self, parent=None):
        title = gettext("ADF Disk Image Creator")
        super().__init__(parent, title=title, maximizable=False)
        buttons, layout = fsui.DialogButtons.create_with_layout(self)
        # buttons.create_close_button()

        self.dialog = None
        self.path = ""

        self.set_icon(fsui.Icon("floppy", "pkg:workspace"))

        layout.min_width = 500

        self.icon_header = IconHeader(
            self, fsui.Icon("floppy", "pkg:workspace"),
            gettext("ADF Disk Image Creator"),
            gettext("Create a blank or formatted ADF floppy disk 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/16/floppy.png")
        self.list_view.add_item(gettext("ADF - Standard Floppy Disk Image"),
                                icon)
        self.list_view.add_item(
            gettext("ADF - Extended Floppy Disk Image (MFM Encoded)"), icon)
        layout.add(self.list_view, expand=True, fill=True)
        # self.list_view.on_select_item = self.on_select_item
        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()
Ejemplo n.º 40
0
                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)

    def on_changed(self):
        index = self.get_index()
        LauncherSettings.set("language", LANGUAGE_ITEMS[index][1])


LANGUAGE_ITEMS = [
    # language name, language code, country flag code
    (gettext("Automatic"), "", "unknown"),
    ("Čeština", "cs", "cz"),
    ("Dansk", "da", "dk"),
    ("Deutsch", "de", "de"),
    ("English", "en", "gb"),
    ("Esperanto", "eo", "eo"),
    ("Español", "es", "es"),
    ("Français", "fr", "fr"),
    ("Eλληνικά", "el", "gr"),  # greek
    ("Italiano", "it", "it"),
    ("Magyar", "hu", "hu"),  # hungarian
    ("Nederlands", "nl", "nl"),
    ("Norsk (bokmål)", "nb", "no"),
    ("Polski", "pl", "pl"),
    ("Português", "pt", "pt"),
    ("Srpski", "sr", "rs"),  # srpski or српски
Ejemplo n.º 41
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()
Ejemplo n.º 42
0
 def run(self):
     for i in range(16):
         self.upload_prefix(i)
     self.progressed(gettext("OAGD.net upload task completed successfully"))
Ejemplo n.º 43
0
 def on_stopped(self):
     self.icon_header.subtitle_label.set_text(gettext("Stopped by user"))
     self.after_task_has_stopped()