def __init__( self, parent, icon: fsui.Icon, title, subtitle="", icon_position=ICON_LEFT, ): Group.__init__(self, parent) self.layout = fsui.HorizontalLayout() image = icon.image(48) self.image_view = fsui.ImageView(self, image) if icon_position == self.ICON_LEFT: self.layout.add(self.image_view) self.layout.add_spacer(20) vert_layout = fsui.VerticalLayout() self.layout.add(vert_layout, expand=True, fill=False, valign=0.5) self.title_label = fsui.HeadingLabel(self, title) vert_layout.add(self.title_label) vert_layout.add_spacer(2) self.subtitle_label = fsui.Label(self, subtitle) vert_layout.add(self.subtitle_label, fill=True) if icon_position == self.ICON_RIGHT: self.layout.add_spacer(20) self.layout.add(self.image_view)
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, icon, title, subtitle="", icon_position=ICON_RIGHT): Group.__init__(self, parent) self.layout = fsui.HorizontalLayout() image = icon.image(48) self.image_view = fsui.ImageView(self, image) if icon_position == self.ICON_LEFT: self.layout.add(self.image_view) self.layout.add_spacer(20) # vert_layout = fsui.VerticalLayout() # self.layout.add( # vert_layout, expand=True, fill=False, valign=0.5) self.title_label = fsui.HeadingLabel(self, title) font = self.title_label.get_font() font.increase_size(3) self.title_label.set_font(font) self.layout.add(self.title_label, expand=True, fill=False, valign=0.5) if icon_position == self.ICON_RIGHT: self.layout.add_spacer(20) self.layout.add(self.image_view)
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, icon, title): super().__init__(parent) self.layout = fsui.HorizontalLayout() # FIXME: From Theme self.set_background_color(fsui.Color(0xFF, 0xFF, 0xFF)) self.title_label = fsui.HeadingLabel(self, title) font = fsui.Font("Roboto", 26) self.title_label.set_font(font) self.layout.add(self.title_label, expand=True, fill=True, margin=20) self.layout.add_spacer(20) self.layout.add(fsui.ImageView(self, icon.image(48)), margin_right=20)
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)
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)
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)
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)
def __init__(self, parent): super().__init__(parent) icon = fsui.Icon("video-settings", "pkg:workspace") gettext("Video Synchronization Settings") title = gettext("Synchronization") subtitle = gettext("Synchronize FS-UAE with your display for " "smooth video") self.add_header(icon, title, subtitle) label = fsui.MultiLineLabel( self, gettext( "Enabling the following option will synchronize the emulation " "to the display when the emulation refresh rate matches the" "screen refresh rate."), 640) self.layout.add(label, fill=True, margin_top=0) self.video_sync_group = self.add_option("video_sync") self.low_latency_group = self.add_option("low_latency_vsync") # label = fsui.MultiLineLabel(self, gettext( # "Enabling the following option will prevent tearing from " # "occurring, but will also use more CPU. Input latency " # "may become slightly higher."), 640) # self.layout.add(label, fill=True, margin_top=0) # self.vblank_checkbox = fsui.HeadingCheckBox(self, gettext( # "Synchronize buffer swaps with display (prevents tearing)")) # self.layout.add(self.vblank_checkbox, margin_top=20) self.sync_method_label = fsui.MultiLineLabel( self, gettext("Depending on your OS and OpenGL drivers, synchronizing " "can use needlessly much CPU (esp. applies to " "Linux). You can experiment with different sync methods " "to improve performance."), 640) self.layout.add(self.sync_method_label, fill=True, margin_top=20) self.sync_method_group = self.add_option("video_sync_method") # self.smooth_label = fsui.MultiLineLabel(self, gettext( # "In order to get really smooth Amiga graphics, you need to " # "enable the following option, and also make sure your display " # "is running at 50Hz (for PAL) or 60Hz (for NTSC)."), 640) # self.layout.add(self.smooth_label, fill=True, margin_top=20) # self.full_sync_checkbox = fsui.HeadingCheckBox(self, gettext( # "Also synchronize emulation with display when possible " # "(smooth scrolling)")) # self.layout.add(self.full_sync_checkbox, margin_top=20) self.layout.add_spacer(0, expand=True) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True, margin_top=10) hori_layout.add( fsui.ImageView(self, fsui.Image("launcher:res/16x16/world_link.png"))) label = fsui.URLLabel( self, gettext("How to achieve perfectly smooth scrolling"), "https://fs-uae.net/perfectly-smooth-scrolling") hori_layout.add(label, margin_left=6) text = gettext( "Synchronizing with the display can in some cases cause " "increased stuttering and low frame rates (esp. in some Linux " "desktop environments with compositing enabled).") link = (" <a href='https://fs-uae.net/video-synchronization-issues'>" "{0}</a>.".format(gettext("Read more"))) label = fsui.MultiLineLabel(self, text + link, min_width=640) self.layout.add(label, fill=True, margin_top=20) LauncherSettings.add_listener(self) for key in ["video_sync"]: self.on_setting(key, LauncherSettings.get(key))
def __init__(self, parent=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()
def __init__(self, parent, device_name): title = gettext("Configure {device_name}").format( device_name=device_name) super().__init__(parent, title=title, minimizable=False, maximizable=False, separator=False) self.layout = fsui.VerticalLayout() self.image = fsui.Image("workspace:res/gamepad-config.png") self.joystick_panel = fsui.ImageView(self, self.image) self.layout.add(self.joystick_panel) if Skin.fws(): from workspace.ui import TitleSeparator separator = TitleSeparator(self) self.layout.add(separator, fill=True) panel = fsui.Panel(self) self.layout.add(panel, fill=True) panel.layout = fsui.HorizontalLayout() panel.layout.padding = 20 self.device_type_ids = [ "", "gamepad", "joystick", # "flightstick", "other", ] self.device_type_labels = [ gettext("Choose Type"), gettext("Gamepad"), gettext("Digital Joystick"), # gettext("Flight Stick"), gettext("Other Device"), ] self.type_field = fsui.Choice(panel, self.device_type_labels) self.type_field.changed.connect(self.on_change) panel.layout.add(self.type_field) panel.layout.add(fsui.PlainLabel(panel, gettext("Make:")), margin_left=20) self.make_field = fsui.TextField(panel) self.make_field.set_min_width(140) self.make_field.changed.connect(self.on_change) panel.layout.add(self.make_field, margin_left=10) panel.layout.add(fsui.PlainLabel(panel, gettext("Model:")), margin_left=20) self.model_field = fsui.TextField(panel) self.model_field.changed.connect(self.on_change) panel.layout.add(self.model_field, expand=True, margin_left=10) self.save_button = fsui.Button(panel, gettext("Save")) self.save_button.activated.connect(self.on_save_button) panel.layout.add(self.save_button, margin_left=20) # self.close_button = fsui.Button(panel, gettext("Close")) # self.close_button.activated.connect(self.on_close_button) # panel.layout.add(self.close_button, margin_left=10) self.device_name = device_name existing_config = self.read_existing_config() self.button_panels = [] for x, y, direction, name in BUTTONS: b = MappingButton(self.joystick_panel, (x, y + 4), direction, name) self.button_panels.append(b) if name in existing_config: b.event_name = existing_config[name] self.save_button.disable() self.set_size(self.layout.get_min_size()) self.center_on_parent() self.stopped = False self.current_state = {} self.initial_state = {} self.map_key_name = None fsui.call_later(100, self.on_timer_callback) thread = threading.Thread(target=event_thread, name="JoystickConfigEventThread", args=( self.device_name, weakref.ref(self), )) thread.start()
def __init__(self, parent, fsgs): fsui.Window.__init__(self, parent, gettext("Download Game Manually")) self.fsgs = fsgs self.download_page = fsgs.config.get("download_page") self.download_notice = fsgs.config.get("download_notice") self.task = None self.layout = fsui.VerticalLayout() self.layout.set_padding(20, 20, 20, 20) self.icon_header = IconHeader( self, fsui.Icon("web-browser", "pkg:workspace"), gettext("Download Game Manually"), gettext("This game must be downloaded before you can play it")) self.layout.add(self.icon_header, fill=True, margin_bottom=20) label = fsui.HeadingLabel( self, gettext("Please open the following web page and download the " "game from there:")) label.set_min_width(500) self.layout.add(label) 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, self.download_page, self.download_page) hori_layout.add(label, margin_left=6) if self.download_notice: label = fsui.MultiLineLabel(self, self.download_notice) label.set_min_width(500) self.layout.add(label, margin_top=20) label = fsui.HeadingLabel( self, gettext("Download to the following directory, and then " "click '{0}':".format(gettext("Scan Downloads")))) label.set_min_width(500) self.layout.add(label, margin_top=20) 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/folder.png"))) label = fsui.Label(self, FSGSDirectories.ensure_downloads_dir()) hori_layout.add(label, margin_left=6) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True, margin_top=20) self.status_label = fsui.Label(self, "") hori_layout.add(self.status_label, expand=True) self.scan_button = fsui.Button(self, gettext("Scan Downloads")) self.scan_button.activated.connect(self.on_scan_files) hori_layout.add(self.scan_button, margin_left=20) self.close_button = fsui.Button(self, gettext("Close")) self.close_button.activated.connect(self.on_close) hori_layout.add(self.close_button, margin_left=10) self.set_size(self.layout.get_min_size()) self.center_on_parent()