def __init__(self, parent): super().__init__(parent) icon = fsui.Icon("joystick-settings", "pkg:workspace") # gettext("Joystick Settings") title = gettext("Controllers") subtitle = gettext( "Configure joysticks and set preferred joystick " "devices" ) self.add_header(icon, title, subtitle) label = fsui.Label( self, gettext("Double-click a controller to configure it:") ) self.layout.add(label, margin_bottom=10) self.list_view = fsui.ListView(self) self.list_view.set_min_height(140) self.list_view.item_activated.connect(self.on_joystick_activated) image = fsui.Image("workspace:res/16x16/gamepad.png") for device_name in DeviceManager.get_joystick_names(): if DeviceManager.is_joystick(device_name): self.list_view.add_item(device_name, icon=image) self.layout.add(self.list_view, fill=True, expand=True) self.layout.add_spacer(20) self.pref_group = PreferredJoysticksGroup(self) self.layout.add(self.pref_group, fill=True) # For reset to defaults function self.options_on_page.add(Option.PRIMARY_JOYSTICK) self.options_on_page.add(Option.SECONDARY_JOYSTICK)
def __init__(self, parent): super().__init__(parent) icon = fsui.Icon("joystick-settings", "pkg:workspace") # gettext("Joystick Settings") title = gettext("Joysticks & Gamepads") subtitle = gettext("Configure joysticks and set preferred joystick " "devices") self.add_header(icon, title, subtitle) self.list_view = fsui.ListView(self) self.list_view.set_min_height(140) self.list_view.item_activated.connect(self.on_joystick_activated) image = fsui.Image("workspace:res/16/gamepad.png") for device_name in DeviceManager.get_joystick_names(): if DeviceManager.is_joystick(device_name): self.list_view.add_item(device_name, icon=image) self.layout.add(self.list_view, fill=True, expand=True) label = fsui.Label( self, gettext("Double-click a device entry to configure it (map " "joystick buttons).")) self.layout.add(label, margin_top=10) self.layout.add_spacer(20) self.pref_group = PreferredJoysticksGroup(self) self.layout.add(self.pref_group, fill=True)
def __init__(self, parent): 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)
def __init__(self, parent): fsui.Group.__init__(self, parent) self.layout = fsui.HorizontalLayout() self.layout2 = fsui.VerticalLayout() self.layout.add(self.layout2, fill=True, expand=True) layout3 = fsui.HorizontalLayout() self.layout2.add(layout3, fill=True, expand=True) self.list_view = fsui.ListView(self) self.list_view.set_min_height(130) self.default_icon = fsui.Image("launcher:res/folder_16.png") layout3.add(self.list_view, expand=True, fill=True) layout3.add_spacer(10) vlayout = fsui.VerticalLayout() layout3.add(vlayout, fill=True) add_button = IconButton(self, "add_button.png") add_button.set_tooltip(gettext("Add Directory to Search Path")) # add_button.disable() add_button.activated.connect(self.on_add_button) vlayout.add(add_button) vlayout.add_spacer(10) self.remove_button = IconButton(self, "remove_button.png") self.remove_button.set_tooltip( gettext("Remove Directory from Search Path")) self.remove_button.disable() self.remove_button.activated.connect(self.on_remove_button) vlayout.add(self.remove_button) # self.list_view.set_items(self.get_search_path()) self.repopulate_list() self.list_view.on_select_item = self.on_select_item LauncherSettings.add_listener(self)
def __init__(self, parent, cd_mode): fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() self.cd_mode = cd_mode if self.cd_mode: self.file_key_prefix = "cdrom_image_" self.file_key = "cdrom_image_{0}" self.sha1_key = "x_cdrom_image_{0}_sha1" else: self.file_key_prefix = "floppy_image_" self.file_key = "floppy_image_{0}" self.sha1_key = "x_floppy_image_{0}_sha1" hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, expand=False, fill=True) self.heading_label = fsui.HeadingLabel(self, gettext("Media Swap List")) hori_layout.add(self.heading_label, margin=10, margin_top=20, margin_bottom=20) hori_layout.add_spacer(0, expand=True) if not self.cd_mode: # hori_layout.add(ConfigWidgetFactory().create( # self, Option.SAVE_DISK), margin_right=20) hori_layout.add(SaveDiskCheckBox(self), margin_right=20) clear_button = IconButton(self, "clear_button.png") clear_button.set_tooltip(gettext("Clear List")) clear_button.activated.connect(self.on_clear_list) hori_layout.add(clear_button, margin_right=10) remove_button = IconButton(self, "remove_button.png") remove_button.set_tooltip(gettext("Remove Selected Files")) remove_button.activated.connect(self.on_remove_button) hori_layout.add(remove_button, margin_right=10) add_button = IconButton(self, "add_button.png") add_button.set_tooltip(gettext("Add Files to List")) add_button.activated.connect(self.on_add_button) hori_layout.add(add_button, margin_right=10) # hori_layout = fsui.HorizontalLayout() # self.layout.add(hori_layout, expand=True, fill=True) self.list_view = fsui.ListView(self) self.list_view.on_activate_item = self.on_activate_item if self.cd_mode: self.default_icon = fsui.Image("launcher:res/cdrom_16.png") else: self.default_icon = fsui.Image("launcher:res/floppy_16.png") # hori_layout.add(self.list_view, expand=True, fill=True, margin=10) self.layout.add(self.list_view, expand=True, fill=True, margin=10, margin_top=0) # vert_layout = fsui.VerticalLayout() # hori_layout.add(vert_layout, fill=True) # add_button = IconButton(self, "add_button.png") # add_button.set_tooltip(gettext("Add Files to List")) # add_button.activated.connect(self.on_add_button) # vert_layout.add(add_button, margin=10) # # remove_button = IconButton(self, "remove_button.png") # remove_button.set_tooltip(gettext("Remove Selected Files")) # remove_button.activated.connect(self.on_remove_button) # vert_layout.add(remove_button, margin=10) # # clear_button = IconButton(self, "clear_button.png") # clear_button.set_tooltip(gettext("Clear List")) # clear_button.activated.connect(self.on_clear_list) # vert_layout.add(clear_button, margin=10) self.update_list() LauncherConfig.add_listener(self)
def __init__(self, parent, title): super().__init__(parent, title, minimizable=False, maximizable=False) # buttons, layout = fsui.DialogButtons.create_with_layout(self) # buttons.create_close_button() self.layout = fsui.VerticalLayout() # self.layout.set_padding(20) layout = self.layout hor_layout = fsui.HorizontalLayout() layout.add(hor_layout, fill=True, expand=True) layout_2 = fsui.VerticalLayout() # layout_2.padding_top = 20 # layout_2.padding_bottom = 20 # layout_2.padding_left = 20 self.list_view = fsui.ListView(self, border=(not Skin.fws())) self.list_view.set_min_width(240) self.list_view.item_selected.connect(self.on_select_item) if Skin.fws(): from workspace.ui.theme import Theme theme = Theme.instance() self.list_view.set_row_height(28) # self.list_view.set_background_color(fsui.Color(0xeb, 0xeb, 0xeb)) self.list_view.setStyleSheet(""" QListView {{ padding-top: 20px; background-color: {0}; outline: none; }} QListView::item {{ padding-left: 20px; border: 0px; }} QListView::item:selected {{ background-color: {1}; }} """.format(theme.sidebar_background.to_hex(), theme.selection_background.to_hex())) layout_2.add(self.list_view, fill=True, expand=True) else: layout_2.add(self.list_view, fill=True, expand=True, margin=20, margin_right=0) hor_layout.add(layout_2, fill=True) hor_layout.add_spacer(20) self.page_container = fsui.Panel(self) self.page_container.layout = fsui.VerticalLayout() hor_layout.add(self.page_container, fill=True, expand=True, margin_top=20, margin_right=20, margin_bottom=20) # self.layout.add_spacer(20) hor_layout = fsui.HorizontalLayout() layout.add(hor_layout, fill=True) self.page_titles = [] self.pages = [] # self.add_page(_("Hardware"), HardwarePage) # self.add_page(_("Hard Drives"), HardDrivesPage) # elf.add_page(_("Custom Options"), CustomOptionsPage) self.current_page = None self.set_size((840, 640)) self.center_on_parent()
def __init__(self, parent=None): title = gettext("HDF Disk Image Creator") super().__init__(parent, title=title) self.theme = WorkspaceTheme.instance() buttons, layout = fsui.DialogButtons.create_with_layout(self) if self.window.theme.has_close_buttons: buttons.create_close_button() self.dialog = None self.path = "" self.set_icon(fsui.Icon("hd-volume", "pkg:workspace")) layout.min_width = 500 self.icon_header = IconHeader( self, fsui.Icon("hd-volume", "pkg:workspace"), gettext("HDF Disk Image Creator"), gettext("Create a single-partition or partitionable hard " "drive image")) layout.add(self.icon_header, fill=True, margin_bottom=20) label = fsui.Label(self, gettext("Create disk image of type:")) layout.add(label) layout.add_spacer(6) self.list_view = fsui.ListView(self) self.list_view.set_min_width(560) self.list_view.set_min_height(60) icon = fsui.Image("workspace:res/16x16/hd-volume.png") self.list_view.add_item( gettext("HDF - Single Partition Hard Disk File"), icon) self.list_view.add_item( gettext("HDF - Partitionable Hard Drive Image (RDB)"), icon) layout.add(self.list_view, expand=True, fill=True) self.list_view.item_selected.connect(self.on_item_selected) layout.add_spacer(20) label = fsui.Label(self, gettext("Filename for the new disk image:")) layout.add(label) layout.add_spacer(6) hori_layout = fsui.HorizontalLayout() layout.add(hori_layout, fill=True) self.name_field = fsui.TextField( self, "", read_only=False) hori_layout.add(self.name_field, expand=True) text = gettext("Size:") label = fsui.Label(self, text) hori_layout.add(label, margin_left=20) self.size_field = fsui.TextField(self, "") self.size_field.set_min_width(60) hori_layout.add(self.size_field, expand=False, margin_left=10) text = gettext("MB") label = fsui.Label(self, text) hori_layout.add(label, margin_left=10) layout.add_spacer(20) label = fsui.Label(self, gettext("Save to directory:")) layout.add(label) layout.add_spacer(6) hori_layout = fsui.HorizontalLayout() layout.add(hori_layout, fill=True) self.dir_field = fsui.TextField(self, "", read_only=True) hori_layout.add(self.dir_field, expand=True) self.browse_button = fsui.Button(self, gettext("Browse")) self.browse_button.clicked.connect(self.on_browse_clicked) hori_layout.add(self.browse_button, margin_left=10) self.created_label = fsui.Label(self, "") layout.add(self.created_label, fill=True) # layout.add_spacer(20) # layout.add_spacer(20) # hori_layout = fsui.HorizontalLayout() # layout.add(hori_layout, fill=True) # self.created_label = fsui.Label(self, "") # hori_layout.add(self.created_label, expand=True) # hori_layout.add_spacer(20) self.create_button = fsui.Button(buttons, gettext("Create")) # self.create_button.activated.connect(self.on_create_clicked) self.create_button.clicked.connect(self.on_create_clicked) # hori_layout.add(self.create_button) buttons.add_button(self.create_button) self.list_view.select_item(0) self.update_name_suggestion()
def __init__(self, parent, 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=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()
def __init__(self, parent, title): super().__init__(parent, title, minimizable=False, maximizable=False) self.theme = LauncherTheme.get() self.layout = fsui.VerticalLayout() # self.layout.set_padding(20) layout = self.layout h_layout = fsui.HorizontalLayout() layout.add(h_layout, fill=True, expand=True) layout_2 = fsui.VerticalLayout() # layout_2.padding_top = 20 # layout_2.padding_bottom = 20 # layout_2.padding_left = 20 self.list_view = fsui.ListView(self, border=False) self.list_view.set_min_width(240) self.list_view.item_selected.connect(self.on_select_item) self.list_view.set_row_height( self.window.theme.sidebar_list_row_height) self.list_view.setStyleSheet(""" QListView {{ padding-top: 20px; background-color: {base}; outline: none; }} QListView::item {{ padding-left: 20px; border: 0px; }} QListView::item:selected {{ background-color: {row_bg}; color: {row_fg}; }} """.format( row_fg=self.window.theme.sidebar_list_row_text.to_hex(), row_bg=self.window.theme.sidebar_list_row_background.to_hex(), base=self.window.theme.sidebar_list_background.to_hex())) layout_2.add(self.list_view, fill=True, expand=True) h_layout.add(layout_2, fill=True) # h_layout.add_spacer(20) v_layout = fsui.VerticalLayout() h_layout.add(v_layout, fill=True, expand=True) use_scrolling = False if use_scrolling: # FIXME: Problems with page height scroll_area = fsui.VerticalScrollArea(self) self.page_container = fsui.Panel(scroll_area) self.page_container.layout = fsui.VerticalLayout() scroll_area.set_widget(self.page_container) v_layout.add(scroll_area, fill=True, expand=True) else: self.page_container = fsui.Panel(self) self.page_container.layout = fsui.VerticalLayout() v_layout.add(self.page_container, fill=True, expand=True) # self.layout.add_spacer(20) # h_layout = fsui.HorizontalLayout() # layout.add(h_layout, fill=True) self.page_titles = [] self.pages = [] # self.add_page(_("Hardware"), HardwarePage) # self.add_page(_("Hard Drives"), HardDrivesPage) # elf.add_page(_("Custom Options"), CustomOptionsPage) self.button_layout = fsui.HorizontalLayout() v_layout.add(self.button_layout, fill=True, margin=20, margin_top=0) if self.window.theme.has_close_buttons: self.button_layout.add_spacer(expand=True) self.close_button = CloseButton(self) self.button_layout.add( self.close_button, fill=True, margin_left=10) self.current_page = None # self.page_container.set_min_width(600) # self.page_container.set_min_height(640) # self.set_size_from_layout() self.set_size((840, 640)) self.center_on_parent()
def __init__(self, parent, cd_mode): super().__init__(parent) self.layout = fsui.VerticalLayout() self.cd_mode = cd_mode if self.cd_mode: self.file_key_prefix = "cdrom_image_" self.file_key = "cdrom_image_{0}" self.sha1_key = "x_cdrom_image_{0}_sha1" platforms = AMIGA_PLATFORMS else: self.file_key_prefix = "floppy_image_" self.file_key = "floppy_image_{0}" self.sha1_key = "x_floppy_image_{0}_sha1" platforms = AMIGA_PLATFORMS hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, expand=False, fill=True) self.heading_label = fsui.HeadingLabel(self, gettext("Media Swap List")) hori_layout.add(self.heading_label, margin=10, margin_top=20, margin_bottom=20) hori_layout.add_spacer(0, expand=True) if not self.cd_mode: save_disk_check_box = SaveDiskCheckBox(self) hori_layout.add(save_disk_check_box, margin_right=20) PlatformEnableBehavior(save_disk_check_box, platforms=platforms) clear_button = IconButton(self, "clear_button.png") clear_button.set_tooltip(gettext("Clear List")) clear_button.activated.connect(self.on_clear_list) PlatformEnableBehavior(clear_button, platforms=platforms) hori_layout.add(clear_button, margin_right=10) remove_button = IconButton(self, "remove_button.png") remove_button.set_tooltip(gettext("Remove Selected Files")) remove_button.activated.connect(self.on_remove_button) PlatformEnableBehavior(remove_button, platforms=platforms) hori_layout.add(remove_button, margin_right=10) add_button = IconButton(self, "add_button.png") add_button.set_tooltip(gettext("Add Files to List")) add_button.activated.connect(self.on_add_button) PlatformEnableBehavior(add_button, platforms=platforms) hori_layout.add(add_button, margin_right=10) # hori_layout = fsui.HorizontalLayout() # self.layout.add(hori_layout, expand=True, fill=True) self.list_view = fsui.ListView(self) PlatformEnableBehavior(self.list_view, platforms=platforms) self.list_view.on_activate_item = self.on_activate_item if self.cd_mode: self.default_icon = fsui.Image("launcher:/data/cdrom_16.png") else: self.default_icon = fsui.Image("launcher:/data/floppy_16.png") # hori_layout.add(self.list_view, expand=True, fill=True, margin=10) self.layout.add(self.list_view, expand=True, fill=True, margin=10, margin_top=0) # vert_layout = fsui.VerticalLayout() # hori_layout.add(vert_layout, fill=True) # add_button = IconButton(self, "add_button.png") # add_button.set_tooltip(gettext("Add Files to List")) # add_button.activated.connect(self.on_add_button) # vert_layout.add(add_button, margin=10) # # remove_button = IconButton(self, "remove_button.png") # remove_button.set_tooltip(gettext("Remove Selected Files")) # remove_button.activated.connect(self.on_remove_button) # vert_layout.add(remove_button, margin=10) # # clear_button = IconButton(self, "clear_button.png") # clear_button.set_tooltip(gettext("Clear List")) # clear_button.activated.connect(self.on_clear_list) # vert_layout.add(clear_button, margin=10) self.update_list() config = get_config(self) config.add_listener(self)