def __init__(self, parent, new_button=True): fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() # heading_label = fsui.HeadingLabel(self, _("Configuration")) # self.layout.add(heading_label, margin=10) # self.layout.add_spacer(0) hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) # dummy label for sizing purposes # label = fsui.HeadingLabel(self, "") # hori_layout.add(label, margin_top=10, margin_bottom=10) if new_button: label_stand_in = fsui.Panel(self) tw, th = label_stand_in.measure_text(gettext("Configuration")) label_stand_in.set_min_height(th) hori_layout.add(label_stand_in, margin_top=10, margin_bottom=10) hori_layout.add(NewButton(self), margin_left=10, margin_right=10) # self.open_button = IconButton(self, "open_button.png") # self.open_button.set_tooltip(_("Open Configuration")) # self.open_button.disable() # self.open_button.activated.connect(self.on_open_button) # hori_layout.add(self.open_button, margin=10) self.config_name_field = fsui.TextField(self) hori_layout.add(self.config_name_field, expand=True, margin=10, margin_top=0, margin_bottom=0) hori_layout.add(SaveButton(self), margin_left=10, margin_right=10) # self.save_button = IconButton(self, "save_button.png") # # self.save_button.disable() # self.save_button.set_tooltip(gettext("Save Configuration")) # self.save_button.activated.connect(self.on_save_button) # hori_layout.add(self.save_button, margin=10, # margin_top=0, margin_bottom=0) self.on_setting("config_name", LauncherSettings.get("config_name")) self.config_name_field.on_changed = self.on_config_name_changed # Config.add_listener(self) LauncherSettings.add_listener(self)
def __init__(self, parent, new_button=True): fsui.Group.__init__(self, parent) self.layout = fsui.VerticalLayout() hori_layout = fsui.HorizontalLayout() self.layout.add(hori_layout, fill=True) if new_button: label_stand_in = fsui.Panel(self) tw, th = label_stand_in.measure_text(gettext("Configuration")) label_stand_in.set_min_height(th) hori_layout.add(label_stand_in, margin_top=10, margin_bottom=10) hori_layout.add(NewButton(self), margin_left=10, margin_right=10) self.config_name_field = fsui.TextField(self) hori_layout.add(self.config_name_field, expand=True, margin=10, margin_top=0, margin_bottom=0) hori_layout.add(SaveButton(self), margin_left=10, margin_right=10) self.config_name_field.on_changed = self.on_config_name_changed SettingsBehavior(self, ["config_name"])
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 new_config(): NewButton.new_config()