def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.floppies_group = FloppiesGroup(self, 4) self.layout.add(self.floppies_group, fill=True) self.media_list_group = MediaListGroup(self, False) self.layout.add(self.media_list_group, expand=True, fill=True)
def __init__(self, parent): super().__init__(parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.drives_group = FloppiesGroup(self, 1, cd_mode=True) self.layout.add(self.drives_group, fill=True) self.layout.add_spacer(10) self.add_amiga_option(Option.CDROM_DRIVE_0_DELAY) self.layout.add_spacer(10) self.media_list_group = MediaListGroup(self, cd_mode=True) self.layout.add(self.media_list_group, expand=True, fill=True)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.input_group = InputGroup(self, refresh_button=True) self.layout.add(self.input_group, fill=True) self.layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.input_group = InputGroup(self, parallel_ports=True) self.layout.add(self.input_group, fill=True) self.input_group = InputGroup(self, custom_ports=True) self.layout.add(self.input_group, fill=True)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.model_group = ModelGroup(self) self.layout.add(self.model_group, fill=True) self.layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.removable_media_group = RemovableMediaGroup(self, 2, main=True) self.layout.add(self.removable_media_group, fill=True) self.layout.add_spacer(10) self.input_group = InputGroup( self, refresh_button=True, autofire_button=False) self.layout.add(self.input_group, fill=True)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.input_group = InputGroup(self, refresh_button=True) self.layout.add(self.input_group, fill=True) self.layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.input_group = InputGroup( self, parallel_ports=True) self.layout.add(self.input_group, fill=True) self.input_group = InputGroup( self, custom_ports=True) self.layout.add(self.input_group, fill=True)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() self.model_group = ModelGroup(self) self.layout.add(self.model_group, fill=True) self.layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.removable_media_group = RemovableMediaGroup(self, 2, main=True) self.layout.add(self.removable_media_group, fill=True) self.layout.add_spacer(10) self.input_group = InputGroup( self, refresh_button=True, autofire_button=False ) self.layout.add(self.input_group, fill=True)
def __init__(self, parent, spacing=10): unused(spacing) Panel.__init__(self, parent, paintable=True) Skin.set_background_color(self) self.layout = HorizontalLayout() self.layout.add_spacer(20) # self.layout.add_spacer(spacing) # self.layout.padding_left = 10 # self.layout.padding_right = 10 # self.set_background_color(Color(0xAEAEAE)) # self.set_min_height(Constants.TAB_HEIGHT) self.bgcolor = get_theme(self).window_bgcolor() self.set_background_color(self.bgcolor)
def __init__(self, parent, icon, title, subtitle="", icon_position=ICON_RIGHT): unused(subtitle) fsui.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) if Skin.fws(): font = fsui.Font("Roboto", 26) self.title_label.set_font(font) self.layout.add( self.title_label, expand=True, fill=False, valign=0.0) else: 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 on_paint(self): dc = self.create_dc() dc.clear(Skin.get_background_color()) if self.is_enabled(): dc.draw_image(self.icon, 8, 4) else: pass
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() heading_label = fsui.HeadingLabel(self, gettext("Hard Drives")) self.layout.add(heading_label, margin=10) self.layout.add_spacer(0) self.hard_drive_groups = [] for i in range(4): self.hard_drive_groups.append(HardDriveGroup(self, i)) self.layout.add(self.hard_drive_groups[i], fill=True, margin=10) self.layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) heading_label = fsui.HeadingLabel(self, gettext("WHDLoad Arguments")) self.layout.add(heading_label, margin=10) self.layout.add_spacer(0) self.whdload_group = WHDLoadGroup(self) self.layout.add(self.whdload_group, fill=True)
def __init__( self, parent, icon, button_type=TYPE_TAB, left_padding=0, right_padding=0, ): fsui.Panel.__init__(self, parent, paintable=True) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() # self.set_background_color((0xdd, 0xdd, 0xdd)) self.set_min_width(Constants.TAB_WIDTH + left_padding + right_padding) self.set_min_height(Constants.TAB_HEIGHT) self.group_id = 0 self.icon = icon self.type = button_type self.state = self.STATE_NORMAL self.hover = False self.left_padding = left_padding self.right_padding = right_padding
def __init__( self, parent, icon, button_type=TYPE_TAB, left_padding=0, right_padding=0, ): fsui.Panel.__init__(self, parent, paintable=True) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() # self.set_background_color((0xdd, 0xdd, 0xdd)) self.set_min_width(Constants.TAB_WIDTH + left_padding + right_padding) self.set_min_height(Constants.TAB_HEIGHT) self.group_id = 0 self.icon = icon self.type = button_type self.state = self.STATE_NORMAL self.hover = False self.left_padding = left_padding self.right_padding = right_padding
def open_main_menu(self): if fsui.System.windows: if time.time() - getattr(self, "main_menu_close_time", 0) < 0.2: return self._menu = self.create_menu() if Skin.use_unified_toolbar(): self.popup_menu(self._menu, (0, -2)) else: self.menu_button.popup_menu(self._menu, (0, self.menu_button.size()[1] - 2)) if fsui.System.windows: self.main_menu_close_time = time.time() return self._menu
def update_title(self): if Skin.fws(): # Just want to keep "FS-UAE Launcher" in the title return auth = LauncherSettings.get(Option.DATABASE_AUTH) if auth: username = LauncherSettings.get(Option.DATABASE_USERNAME) login_info = username else: login_info = gettext("Not logged in") app_name = "{} Launcher".format(Product.base_name) title = "{} {} ({})".format(app_name, Application.instance().version, login_info) self.set_title(title)
def __init__(self, parent, icon, title, subtitle="", icon_position=ICON_RIGHT): unused(subtitle) fsui.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) if Skin.fws() or True: font = fsui.Font("Roboto", 26) self.title_label.set_font(font) self.layout.add(self.title_label, expand=True, fill=False, valign=0.0) else: 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): super().__init__(parent) Skin.set_background_color(self) self.layout = VerticalLayout() self.config_widget_factory = ConfigWidgetFactory()
def __init__(self, parent, cover_on_right=True): BottomPanel.__init__(self, parent) Skin.set_background_color(self) # self.set_background_color((0xdd, 0xdd, 0xdd)) self.cover_on_right = cover_on_right self.requests = None self.image = None self.layout = fsui.HorizontalLayout() # def get_min_height(width): # return Constants.COVER_SIZE[1] + 2 * BORDER # self.layout.get_min_height = get_min_height self.layout.padding_left = BORDER // 2 self.layout.padding_right = BORDER // 2 self.layout.padding_top = BORDER + 2 self.layout.padding_bottom = Skin.get_bottom_margin() self.default_image = fsui.Image("launcher:/data/cover.png") # self.default_image.resize(Constants.COVER_SIZE) self.cover_overlay = fsui.Image("launcher:/data/cover_overlay.png") self.cover_overlay_square = fsui.Image( "launcher:/data/cover_overlay_square.png") if not self.cover_on_right: self.layout.add_spacer(Constants.COVER_SIZE[0]) # self.panel = fsui.Panel(self) # self.panel.set_background_color((0xdd, 0xdd, 0xdd)) # self.layout.add(self.panel, expand=True, fill=True) vert_layout = fsui.VerticalLayout() self.layout.add(vert_layout, expand=True, fill=True) # self.panel.layout.padding_top = 10 if self.cover_on_right: vert_layout.padding_right = BORDER else: vert_layout.padding_left = BORDER vert_layout.add_spacer(58 + 3) hori_layout = fsui.HorizontalLayout() vert_layout.add(hori_layout, fill=True) hori_layout.add_spacer(0, expand=True) self.web_button = WebButton(self) hori_layout.add(self.web_button, margin_right=3) self.edit_button = EditButton(self) hori_layout.add(self.edit_button, margin_right=3) # def label_min_width(): # return 330 # self.title_label = fsui.HeadingLabel(self) # self.title_label.get_min_width = label_min_width # vert_layout.add(self.title_label) # self.sub_title_label = fsui.Label(self) # self.sub_title_label.get_min_width = label_min_width # vert_layout.add(self.sub_title_label) self.title = "" self.sub_title = "" self.year = "" self.publisher = "" self.developer = "" self.companies = "" self.image_path = "" vert_layout.add_spacer(0, expand=True) hori_layout = fsui.HorizontalLayout() vert_layout.add(hori_layout, fill=True) # for rating in [1, 4, 5]: # button = RatingButton(self, rating) # hori_layout.add(button, margin_right=5, fill=True) hori_layout.add_spacer(0, expand=True) # self.launch_group = LaunchGroup(self) # hori_layout.add(self.launch_group, fill=True) if self.cover_on_right: self.layout.add_spacer(Constants.COVER_SIZE[0]) self.image_loader = ImageLoader() self.load_info() LauncherSettings.add_listener(self) config = get_config(self) config.add_listener(self) for key in [ "database_url", "hol_url", "lemon_url", "mobygames_url", "wikipedia_url", "year", "publisher", "developer", ]: self.on_config(key, config.get(key))
def __init__(self, parent, device_name): title = gettext("Configure {device_name}").format( device_name=device_name ) super().__init__( parent, title=title, minimizable=False, maximizable=False, separator=False, ) self.theme = WorkspaceTheme.instance() 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) if self.window.theme.has_close_buttons: self.close_button = CloseButton(panel) 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, fsgs=None): LauncherWindow._current = weakref.ref(self) # Old name if fsgs is not None: self.fsgs = fsgs else: self.fsgs = default_context() # New name self.gsc = self.fsgs from launcher.launcherapp import LauncherApp LauncherApp.pre_start() border = True maximize = None menu = False if launcher.ui.get_screen_size()[1] <= 768: if fstd.desktop.is_running_gnome_3(): border = False if "--window-border" in sys.argv: border = True maximize = True if Skin.fws(): border = False menu = True if "--no-window-border" in sys.argv: border = False if fsgs_module.product == "OpenRetro": app_name = "OpenRetro Launcher" else: app_name = "FS-UAE Launcher" if Skin.fws(): title = app_name else: title = "{} {}".format(app_name, Application.instance().version) WindowWithTabs.__init__(self, None, title, border=border, menu=menu) icon = self.find_icon() if icon: self.set_icon_from_path(icon) self.main_layout = fsui.VerticalLayout() self.books = [] self.config_browser = None self.configurations_panel = None self.main_menu_close_time = 0 self.main_panel = None self._menu = None self.menu_button = None self.quick_settings_panel = None self.tab_panels = [] self.user_button = None self.user_menu_close_time = 0 self.set_content(self.main_layout) self.column_layout = fsui.HorizontalLayout() self.main_layout.add(self.column_layout, fill=True, expand=True) # left border self.create_column(0, min_width=Skin.get_window_padding_left(), content=False) # left content # if fs_uae_launcher.ui.get_screen_size()[0] > 1024: # left_width = 518 # else: # left_width = 400 # FIXME: adjust left_width = 462 self.create_column(1, min_width=left_width) # right content # right_width = Constants.SCREEN_SIZE[0] * 2 + 21 + 10 + 10 extra_screenshot_width = Constants.SCREEN_SIZE[0] + 21 need_width = 1280 right_width = 518 if self.is_editor_enabled(): # need_width += extra_screen_width pass else: if launcher.ui.get_screen_size()[0] >= need_width: # make room for one more screenshot right_width += extra_screenshot_width pass # right_width = 518 # if Skin.EXTRA_GROUP_MARGIN: # self.main_layout.add_spacer(Skin.EXTRA_GROUP_MARGIN) self.create_column(2, min_width=right_width, expand=True) # right border self.create_column(3, min_width=Skin.get_window_padding_right(), content=False) # if self.is_editor_enabled(): # from ..editor.EditorGroup import EditorGroup # editor = EditorGroup(self) # self.main_layout.add(editor, fill=True, expand=True, # margin_right=20) # if fs_uae_launcher.ui.get_screen_size()[1] >= 768: # right_margin = 0 if launcher.ui.get_screen_size()[1] >= 720: self.bottom_layout = fsui.HorizontalLayout() self.main_layout.add(self.bottom_layout, fill=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) self.screenshots_panel = ScreenshotsPanel(self) self.bottom_layout.add(self.screenshots_panel, fill=True) self.game_info_panel = GameInfoPanel(self) self.game_info_panel.set_min_width(GAME_INFO_PANEL_MIN_WIDTH) self.bottom_layout.add(self.game_info_panel, fill=True, expand=True) bottom_panel = BottomPanel(self) bottom_panel.set_min_width(10) bottom_panel.set_min_height(Skin.get_bottom_panel_height()) self.bottom_layout.add(bottom_panel, fill=True) else: self.bottom_layout = None self.screenshots_panel = None # right_margin = -10 - Skin.EXTRA_GROUP_MARGIN # else: # bottom_panel = None # # FIXME: # if bottom_panel is None: # layout.add_spacer(0, Skin.get_bottom_panel_height()) # else: # bottom_panel.set_min_height(Skin.get_bottom_panel_height()) # layout.add(bottom_panel, fill=True, margin_right=right_margin) # elif column == 1: # group = LaunchGroup(self) # layout.add(group, fill=True, margin=10, margin_top=0) # layout.add_spacer(0, 10) self.realize_tabs() # self._menu = self.create_menu() if fsui.System.macosx and fsui.toolkit == "wx": # import wx # self.tools_menu = self.create_menu() # menu_bar = wx.MenuBar() # menu_bar.Append(self.tools_menu._menu, _("Tools")) # self.SetMenuBar(menu_bar) pass self.status_bar = StatusBar(self) self.layout.add(self.status_bar, fill=True) was_maximized = LauncherSettings.get("maximized") == "1" if LauncherSettings.get(Option.LAUNCHER_CONFIG_FEATURE) == "1": if launcher.ui.get_screen_size()[0] > 1300: if launcher.ui.get_screen_size()[1] > 1000: self.layout.min_width = 1280 self.layout.min_height = 720 self.set_size(self.layout.get_min_size()) self.center_on_screen() if was_maximized or maximize: self.maximize() LauncherSignal.add_listener("scan_done", self) LauncherSignal.add_listener("setting", self) self.update_title() self.check_for_update_once() self.implicit_config_handler = ImplicitConfigHandler(self)
def create_column(self, column, content=True, expand=False, min_width=0): layout = fsui.VerticalLayout() self.column_layout.add(layout, fill=True, expand=expand) if min_width: layout.add_spacer(min_width, 0) layout.add_spacer(0, 10 + Skin.EXTRA_GROUP_MARGIN) if content: book = Book(self) Skin.set_background_color(book) if column == 1: margin_right = Skin.EXTRA_GROUP_MARGIN # expand = False expand = True else: margin_right = 0 expand = True hor_layout = fsui.HorizontalLayout() layout.add(hor_layout, fill=True, expand=expand, margin_right=margin_right) # hor_layout.add( # book, fill=True, expand=expand, margin_right=margin_right) vert_layout = fsui.VerticalLayout() hor_layout.add( vert_layout, fill=True, expand=expand, margin_right=margin_right, ) hor_layout_2 = fsui.HorizontalLayout() vert_layout.add(hor_layout_2, fill=True, expand=True) # vert_layout.add(book, fill=True, expand=True) hor_layout_2.add(book, fill=True, expand=True) # self.add_tab_panel(LaunchGroup, expand=False) # if column == 2 and \ # LauncherSettings.get( # Option.LAUNCHER_CONFIG_FEATURE) == "1": # if launcher.ui.get_screen_size()[0] >= 1280: # hor_layout.add_spacer(10) # # if not Skin.fws(): # # line_panel = fsui.Panel(self) # # line_panel.set_background_color( # # fsui.Color(*BORDER_COLOR)) # # line_panel.set_min_width(2) # # hor_layout.add( # # line_panel, fill=True, margin_top=-10, # # margin_bottom=-10) # self.config_browser = ConfigBrowser(self) # self.config_browser.set_min_width(CONFIG_BROWSER_WIDTH) # # if Skin.fws(): # hor_layout.add(self.config_browser, fill=True, # expand=0.5, margin=-10, margin_left=0) # # else: # # hor_layout.add(self.config_browser, fill=True, # # expand=0.5, margin=10) if column == 2: # hor_layout.add_spacer(10) self.quick_settings_panel = QuickSettingsPanel(self, self.fsgs) self.quick_settings_panel.set_min_width(QUICK_SETTINGS_WIDTH) # hor_layout.add(self.quick_settings_panel, fill=True, # expand=0.5, margin=-10, margin_left=0) # hor_layout.add(self.quick_settings_panel, fill=True, # expand=0.5, margin=0, margin_top=0) # Adding to hor_layout_2 will make it appear "one level" # further in. # hor_layout_2.add(self.quick_settings_panel, fill=True, # margin=0, margin_top=0) if LauncherSettings.get(Option.QUICK_SETTINGS) != "1": self.quick_settings_panel.hide() hor_layout.add( self.quick_settings_panel, fill=True, margin=0, margin_top=0, ) if column == 2: # if fs_uae_launcher.ui.get_screen_size()[1] >= 1024: # vert_layout.add_spacer(100) hor2_layout = fsui.HorizontalLayout() vert_layout.add(hor2_layout, fill=True, margin=10) launch_group = LaunchGroup(self, self.gsc) # hor2_layout.add_spacer(0, expand=True) hor2_layout.add(launch_group, expand=True) self.books.append(book) self.add_column_content(column) else: layout.add_spacer(0, expand=True) self.books.append(None) # if column == 1 and Settings.get(Option.CONFIG_FEATURE) == "1": # from fs_uae_launcher.ui.config.browser import ConfigBrowser # config_browser = ConfigBrowser(self) # config_browser.set_min_height(200) # layout.add(config_browser, fill=True, expand=True, margin=10) layout.add_spacer(0, 10 + Skin.EXTRA_GROUP_MARGIN)
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)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.HorizontalLayout() vert_layout = fsui.VerticalLayout() self.layout.add(vert_layout, fill=True, expand=True) hor_layout = fsui.HorizontalLayout() vert_layout.add(hor_layout, fill=True) label_stand_in = fsui.Panel(self) tw, th = label_stand_in.measure_text("Games") label_stand_in.set_min_height(th) hor_layout.add(label_stand_in, margin_top=10, margin_bottom=10) hor_layout.add(NewButton(self), margin_left=10, margin_right=10) game_list_selector = GameListSelector(self) game_list_selector.set_min_width(250) game_list_selector.setMaximumWidth(250) game_list_selector.changed.connect(self.on_game_list_changed) hor_layout.add(game_list_selector, expand=False, margin_left=10) self.text_field = fsui.TextField(self, LauncherSettings.get("config_search")) self.text_field.on_changed = self.on_search_changed if VariantsBrowser.use_horizontal_layout(): # window is big enough to use fixed size # self.text_field.set_min_width(210) self.text_field.set_min_width(229) hor_layout.add( self.text_field, expand=False, margin=10, margin_top=0, margin_bottom=0, ) else: hor_layout.add( self.text_field, expand=True, margin=10, margin_top=0, margin_bottom=0, ) # self.refresh_button = IconButton(self, "refresh_button.png") # self.refresh_button.set_tooltip( # gettext("Refresh Game Configurations from Online Database")) # self.refresh_button.activated.connect(self.on_refresh_button) # hor_layout.add( # self.refresh_button, margin=10, margin_top=0, margin_bottom=0) self.configurations_browser = ConfigurationsBrowser(self) vert_layout.add(self.configurations_browser, fill=True, expand=3, margin=10) self.variants_panel = fsui.Panel(self) vert_layout.add( self.variants_panel, fill=True, expand=False, margin=10, margin_top=20, ) self.variants_panel.layout = fsui.HorizontalLayout() self.variants_browser = VariantsBrowser(self.variants_panel) # Do not use fill=True with the default OS X theme at least, # if you do the item will be rendered with the old Aqua look self.variants_panel.layout.add(self.variants_browser, fill=False, expand=True) # for rating in [1, 4, 5]: # button = RatingButton(self.variants_panel, rating) # self.variants_panel.layout.add(button, margin_left=5, fill=True) self.variants_panel.layout.add(RatingChoice(self.variants_panel), margin_left=5, fill=True) self.config_panel = fsui.Panel(self) vert_layout.add( self.config_panel, fill=True, expand=False, margin_bottom=10, margin_top=20, ) self.config_panel.layout = fsui.VerticalLayout() self.config_group = ConfigGroup(self.config_panel, new_button=False) self.config_panel.layout.add(self.config_group, fill=True, expand=True) LauncherSettings.add_listener(self) self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))
def __init__(self, parent, header=True): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() if header: hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) self.layout.add_spacer(0) label = fsui.HeadingLabel(self, gettext("Net Play")) hori_layout.add(label, margin=10) hori_layout.add_spacer(0, expand=True) # label = fsui.Label(self, "Netplay is currently disabled in the " # "development versions.") # self.layout.add(label, margin=10) # label = fsui.Label(self, "Please use the stable FS-UAE series for " # "netplay in the meantime.") # self.layout.add(label, margin=10) # return # TODO gettext("Nick:") gettext("Connect") gettext("Disconnect") # self.nick_label = fsui.Label(self, _("Nick:")) # hori_layout.add(self.nick_label, # margin=10, margin_top=0, margin_bottom=0) # # self.nick_field = fsui.TextField(self, Settings.get("irc_nick")) # self.nick_field.set_min_width(130) # hori_layout.add(self.nick_field, margin_right=10) # #self.nick_field.on_changed = self.on_nick_change # # self.connect_button = fsui.Button(self, _("Connect")) # hori_layout.add(self.connect_button, margin_right=10) # #self.connect_button.activated.connect(self.on_connect_button) # # self.disconnect_button = fsui.Button(self, _("Disconnect")) # hori_layout.add(self.disconnect_button, margin_right=10) # #self.disconnect_button.activated.connect(self.on_disconnect_button) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True, expand=True) ver_layout = fsui.VerticalLayout() hori_layout.add(ver_layout, fill=True) self.channel_list = fsui.ListView(self) self.channel_list.set_min_width(212) self.channel_list.on_select_item = self.on_select_channel ver_layout.add(self.channel_list, fill=True, expand=True, margin=10) self.nick_list = fsui.ListView(self) ver_layout.add(self.nick_list, fill=True, expand=True, margin=10) self.text_area = fsui.TextArea(self, font_family="monospace") hori_layout.add(self.text_area, fill=True, expand=True, margin=10, margin_left=0) self.input_field = fsui.TextField(self) self.input_field.activated.connect(self.on_input) self.layout.add(self.input_field, fill=True, margin=10, margin_top=0) self.active_channel = LOBBY_CHANNEL self.input_field.focus() self.netplay = Netplay() IRCBroadcaster.add_listener(self)
def __init__(self, parent): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.HorizontalLayout() vert_layout = fsui.VerticalLayout() self.layout.add(vert_layout, fill=True, expand=True) hor_layout = fsui.HorizontalLayout() vert_layout.add(hor_layout, fill=True) label_stand_in = fsui.Panel(self) tw, th = label_stand_in.measure_text("Games") label_stand_in.set_min_height(th) hor_layout.add(label_stand_in, margin_top=10, margin_bottom=10) hor_layout.add(NewButton(self), margin_left=10, margin_right=10) game_list_selector = GameListSelector(self) game_list_selector.set_min_width(250) game_list_selector.setMaximumWidth(250) game_list_selector.changed.connect(self.on_game_list_changed) hor_layout.add(game_list_selector, expand=False, margin_left=10) self.text_field = fsui.TextField( self, LauncherSettings.get("config_search")) self.text_field.on_changed = self.on_search_changed if VariantsBrowser.use_horizontal_layout(): # window is big enough to use fixed size # self.text_field.set_min_width(210) self.text_field.set_min_width(229) hor_layout.add( self.text_field, expand=False, margin=10, margin_top=0, margin_bottom=0) else: hor_layout.add( self.text_field, expand=True, margin=10, margin_top=0, margin_bottom=0) # self.refresh_button = IconButton(self, "refresh_button.png") # self.refresh_button.set_tooltip( # gettext("Refresh Game Configurations from Online Database")) # self.refresh_button.activated.connect(self.on_refresh_button) # hor_layout.add( # self.refresh_button, margin=10, margin_top=0, margin_bottom=0) self.configurations_browser = ConfigurationsBrowser(self) vert_layout.add( self.configurations_browser, fill=True, expand=3, margin=10) self.variants_panel = fsui.Panel(self) vert_layout.add(self.variants_panel, fill=True, expand=False, margin=10, margin_top=20) self.variants_panel.layout = fsui.HorizontalLayout() self.variants_browser = VariantsBrowser(self.variants_panel) # Do not use fill=True with the default OS X theme at least, # if you do the item will be rendered with the old Aqua look self.variants_panel.layout.add( self.variants_browser, fill=False, expand=True) # for rating in [1, 4, 5]: # button = RatingButton(self.variants_panel, rating) # self.variants_panel.layout.add(button, margin_left=5, fill=True) self.variants_panel.layout.add( RatingChoice(self.variants_panel), margin_left=5, fill=True) self.config_panel = fsui.Panel(self) vert_layout.add(self.config_panel, fill=True, expand=False, margin_bottom=10, margin_top=20) self.config_panel.layout = fsui.VerticalLayout() self.config_group = ConfigGroup(self.config_panel, new_button=False) self.config_panel.layout.add(self.config_group, fill=True, expand=True) LauncherSettings.add_listener(self) self.on_setting("parent_uuid", LauncherSettings.get("parent_uuid"))
def __init__(self, parent, header=True): fsui.Panel.__init__(self, parent) Skin.set_background_color(self) self.layout = fsui.VerticalLayout() if header: hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) self.layout.add_spacer(0) label = fsui.HeadingLabel(self, gettext("Net Play")) hori_layout.add(label, margin=10) hori_layout.add_spacer(0, expand=True) # label = fsui.Label(self, "Netplay is currently disabled in the " # "development versions.") # self.layout.add(label, margin=10) # label = fsui.Label(self, "Please use the stable FS-UAE series for " # "netplay in the meantime.") # self.layout.add(label, margin=10) # return # TODO gettext("Nick:") gettext("Connect") gettext("Disconnect") # self.nick_label = fsui.Label(self, _("Nick:")) # hori_layout.add(self.nick_label, # margin=10, margin_top=0, margin_bottom=0) # # self.nick_field = fsui.TextField(self, Settings.get("irc_nick")) # self.nick_field.set_min_width(130) # hori_layout.add(self.nick_field, margin_right=10) # #self.nick_field.on_changed = self.on_nick_change # # self.connect_button = fsui.Button(self, _("Connect")) # hori_layout.add(self.connect_button, margin_right=10) # #self.connect_button.activated.connect(self.on_connect_button) # # self.disconnect_button = fsui.Button(self, _("Disconnect")) # hori_layout.add(self.disconnect_button, margin_right=10) # #self.disconnect_button.activated.connect(self.on_disconnect_button) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True, expand=True) ver_layout = fsui.VerticalLayout() hori_layout.add(ver_layout, fill=True) self.channel_list = fsui.ListView(self) self.channel_list.set_min_width(212) self.channel_list.on_select_item = self.on_select_channel ver_layout.add(self.channel_list, fill=True, expand=True, margin=10) self.nick_list = fsui.ListView(self) ver_layout.add(self.nick_list, fill=True, expand=True, margin=10) self.text_area = fsui.TextArea(self, font_family="monospace") hori_layout.add( self.text_area, fill=True, expand=True, margin=10, margin_left=0 ) self.input_field = fsui.TextField(self) self.input_field.activated.connect(self.on_input) self.layout.add(self.input_field, fill=True, margin=10, margin_top=0) self.active_channel = LOBBY_CHANNEL self.input_field.focus() self.netplay = Netplay() IRCBroadcaster.add_listener(self)
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.theme = WorkspaceTheme.instance() 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) self.mapping_field = fsui.TextArea( self, read_only=True, line_wrap=False ) self.layout.add( self.mapping_field, fill=True, margin_left=20, margin_top=20, margin_right=20, ) 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.reset_button = fsui.Button(panel, gettext("Reset")) self.reset_button.activated.connect(self.on_reset_button) panel.layout.add(self.reset_button) self.priority_type_ids = [ "axis,hat,button", "hat,button,axis", ] self.priority_type_labels = [ gettext("Axes, hats, buttons"), gettext("Hats, buttons, axes"), ] self.priority_choice = fsui.Choice(panel, self.priority_type_labels) panel.layout.add(self.priority_choice, margin_left=20) self.type_field = fsui.Choice(panel, self.device_type_labels) panel.layout.add(self.type_field, margin_left=20) # panel.layout.add( # fsui.PlainLabel(panel, gettext("Make:")), margin_left=20 # ) # self.make_field = fsui.TextField(panel) # self.make_field.set_min_width(140) # 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) 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) if self.window.theme.has_close_buttons: self.close_button = CloseButton(panel) 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.type_field.changed.connect(self.on_change) # self.make_field.changed.connect(self.on_change) self.model_field.changed.connect(self.on_change) self.save_button.disable() self.set_size(self.layout.get_min_size()) self.center_on_parent() self.stopped = False self.previous_timer_state = {} 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()