def __init_widgets(self): """ Initialize interface widgets """ self.set_size(520, -1) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % (replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Options # ------------------------------------ self.entry_name = Gtk.Entry() # Properties self.entry_name.set_placeholder_text("%s…" % _("New name")) self.entry_name.set_icon_from_icon_name( Gtk.EntryIconPosition.SECONDARY, Icons.Symbolic.CLEAR) # ------------------------------------ # Integrate widgets # ------------------------------------ self.pack_start(self.label_title, False, False) self.pack_start(self.entry_name, False, False)
def __init_widgets(self): """ Initialize interface widgets """ self.set_size(640, -1) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Stack # ------------------------------------ self.stack = Gtk.Stack() self.sidebar_stack = Gtk.StackSwitcher() # Properties self.stack.set_margin_top(12) self.stack.set_transition_type(Gtk.StackTransitionType.NONE) self.sidebar_stack.set_margin_top(12) self.sidebar_stack.set_stack(self.stack) self.sidebar_stack.set_halign(Gtk.Align.CENTER) # ------------------------------------ # Grids # ------------------------------------ self.grid_content = Gtk.Box() grid_parameters = Gtk.Box() grid_environment = Gtk.Box() grid_environment_buttons = Gtk.Box() grid_statistic = Gtk.Box() grid_statistic_total = Gtk.Box() grid_statistic_average = Gtk.Box() # Properties self.grid_content.set_spacing(6) self.grid_content.set_orientation(Gtk.Orientation.VERTICAL) grid_parameters.set_spacing(6) grid_parameters.set_homogeneous(False) grid_parameters.set_orientation(Gtk.Orientation.VERTICAL) grid_environment.set_spacing(12) grid_environment.set_homogeneous(False) Gtk.StyleContext.add_class( grid_environment_buttons.get_style_context(), "linked") grid_environment_buttons.set_spacing(-1) grid_environment_buttons.set_orientation(Gtk.Orientation.VERTICAL) grid_statistic.set_spacing(6) grid_statistic.set_homogeneous(False) grid_statistic.set_orientation(Gtk.Orientation.VERTICAL) grid_statistic_total.set_spacing(12) grid_statistic_total.set_homogeneous(True) grid_statistic_average.set_spacing(12) grid_statistic_average.set_homogeneous(True) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % (replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Emulators # ------------------------------------ label_emulator = Gtk.Label() self.model = Gtk.ListStore(GdkPixbuf.Pixbuf, str) self.combo = Gtk.ComboBox() cell_icon = Gtk.CellRendererPixbuf() cell_name = Gtk.CellRendererText() # Properties label_emulator.set_use_markup(True) label_emulator.set_halign(Gtk.Align.CENTER) label_emulator.set_markup("<b>%s</b>" % _("Alternative emulator")) self.model.set_sort_column_id(1, Gtk.SortType.ASCENDING) self.combo.set_model(self.model) self.combo.set_id_column(1) self.combo.pack_start(cell_icon, False) self.combo.add_attribute(cell_icon, "pixbuf", 0) self.combo.pack_start(cell_name, True) self.combo.add_attribute(cell_name, "text", 1) cell_icon.set_padding(4, 0) # ------------------------------------ # Arguments # ------------------------------------ self.entry_arguments = Gtk.Entry() # Properties self.entry_arguments.set_icon_from_icon_name( Gtk.EntryIconPosition.PRIMARY, Icons.Symbolic.TERMINAL) self.entry_arguments.set_icon_from_icon_name( Gtk.EntryIconPosition.SECONDARY, Icons.Symbolic.CLEAR) # ------------------------------------ # Key # ------------------------------------ label_key = Gtk.Label() self.entry_key = Gtk.Entry() # Properties label_key.set_margin_top(12) label_key.set_halign(Gtk.Align.CENTER) label_key.set_use_markup(True) label_key.set_markup("<b>%s</b>" % _("GameID")) self.entry_key.set_placeholder_text(_("No default value")) self.entry_key.set_icon_from_icon_name(Gtk.EntryIconPosition.PRIMARY, Icons.Symbolic.PASSWORD) self.entry_key.set_icon_from_icon_name(Gtk.EntryIconPosition.SECONDARY, Icons.Symbolic.CLEAR) # ------------------------------------ # Tags # ------------------------------------ label_tags = Gtk.Label() self.entry_tags = Gtk.Entry() self.completion_tags = Gtk.EntryCompletion() self.store_tags = Gtk.ListStore(str) # Properties label_tags.set_margin_top(12) label_tags.set_halign(Gtk.Align.CENTER) label_tags.set_use_markup(True) label_tags.set_markup("<b>%s</b>" % _("Tags")) self.entry_tags.set_tooltip_text(_("Use comma to separate tags")) self.entry_tags.set_placeholder_text(_("Use comma to separate tags")) self.entry_tags.set_completion(self.completion_tags) self.entry_tags.set_icon_from_icon_name(Gtk.EntryIconPosition.PRIMARY, Icons.Symbolic.ADD_TEXT) self.entry_tags.set_icon_from_icon_name( Gtk.EntryIconPosition.SECONDARY, Icons.Symbolic.CLEAR) self.completion_tags.set_model(self.store_tags) self.completion_tags.set_popup_single_match(True) self.completion_tags.set_popup_completion(True) self.completion_tags.set_text_column(0) self.completion_tags.set_match_func(self.__on_entry_match_tag) # ------------------------------------ # Statistics # ------------------------------------ scroll_statistic = Gtk.ScrolledWindow() viewport_statistic = Gtk.Viewport() label_statistic_total = Gtk.Label() self.label_statistic_total_value = Gtk.Label() label_statistic_average = Gtk.Label() self.label_statistic_average_value = Gtk.Label() # Properties label_statistic_total.set_label(_("Total play time")) label_statistic_total.set_halign(Gtk.Align.END) label_statistic_total.set_valign(Gtk.Align.CENTER) label_statistic_total.get_style_context().add_class("dim-label") self.label_statistic_total_value.set_label(_("No data")) self.label_statistic_total_value.set_halign(Gtk.Align.START) self.label_statistic_total_value.set_valign(Gtk.Align.CENTER) self.label_statistic_total_value.set_use_markup(True) label_statistic_average.set_label(_("Average play time")) label_statistic_average.set_halign(Gtk.Align.END) label_statistic_average.set_valign(Gtk.Align.CENTER) label_statistic_average.get_style_context().add_class("dim-label") self.label_statistic_average_value.set_label(_("No data")) self.label_statistic_average_value.set_halign(Gtk.Align.START) self.label_statistic_average_value.set_valign(Gtk.Align.CENTER) self.label_statistic_average_value.set_use_markup(True) # ------------------------------------ # Environment variables # ------------------------------------ scroll_environment = Gtk.ScrolledWindow() viewport_environment = Gtk.Viewport() image_environment_add = Gtk.Image() self.button_environment_add = Gtk.Button() image_environment_remove = Gtk.Image() self.button_environment_remove = Gtk.Button() self.store_environment_keys = Gtk.ListStore(str) self.store_environment = Gtk.ListStore(str, str) self.treeview_environment = Gtk.TreeView() treeview_column_environment = Gtk.TreeViewColumn() self.treeview_cell_environment_key = Gtk.CellRendererCombo() self.treeview_cell_environment_value = Gtk.CellRendererText() # Properties scroll_environment.set_shadow_type(Gtk.ShadowType.OUT) image_environment_add.set_from_icon_name(Icons.Symbolic.ADD, Gtk.IconSize.BUTTON) image_environment_remove.set_from_icon_name(Icons.Symbolic.REMOVE, Gtk.IconSize.BUTTON) self.treeview_environment.set_model(self.store_environment) self.treeview_environment.set_headers_clickable(False) self.treeview_environment.set_headers_visible(False) treeview_column_environment.pack_start( self.treeview_cell_environment_key, True) treeview_column_environment.pack_start( self.treeview_cell_environment_value, True) treeview_column_environment.add_attribute( self.treeview_cell_environment_key, "text", 0) treeview_column_environment.add_attribute( self.treeview_cell_environment_value, "text", 1) self.treeview_cell_environment_key.set_padding(12, 6) self.treeview_cell_environment_key.set_property("text-column", 0) self.treeview_cell_environment_key.set_property("editable", True) self.treeview_cell_environment_key.set_property("has-entry", True) self.treeview_cell_environment_key.set_property( "model", self.store_environment_keys) self.treeview_cell_environment_key.set_property( "placeholder_text", _("Key")) self.treeview_cell_environment_key.set_property( "ellipsize", Pango.EllipsizeMode.END) self.treeview_cell_environment_value.set_padding(12, 6) self.treeview_cell_environment_value.set_property("editable", True) self.treeview_cell_environment_value.set_property( "placeholder_text", _("Value")) self.treeview_cell_environment_value.set_property( "ellipsize", Pango.EllipsizeMode.END) self.treeview_environment.append_column(treeview_column_environment) # ------------------------------------ # Integrate widgets # ------------------------------------ self.stack.add_titled(grid_parameters, "parameters", _("Parameters")) grid_parameters.pack_start(label_emulator, False, False, 0) grid_parameters.pack_start(self.combo, False, False, 0) grid_parameters.pack_start(self.entry_arguments, False, False, 0) grid_parameters.pack_start(label_key, False, False, 0) grid_parameters.pack_start(self.entry_key, False, False, 0) grid_parameters.pack_start(label_tags, False, False, 0) grid_parameters.pack_start(self.entry_tags, False, False, 0) self.stack.add_titled(scroll_statistic, "statistic", _("Statistic")) scroll_statistic.add(viewport_statistic) viewport_statistic.add(grid_statistic) grid_statistic.pack_start(grid_statistic_total, False, False, 0) grid_statistic.pack_start(grid_statistic_average, False, False, 0) grid_statistic_total.pack_start(label_statistic_total, True, True, 0) grid_statistic_total.pack_start(self.label_statistic_total_value, True, True, 0) grid_statistic_average.pack_start(label_statistic_average, True, True, 0) grid_statistic_average.pack_start(self.label_statistic_average_value, True, True, 0) self.stack.add_titled(grid_environment, "environment", _("Environment")) scroll_environment.add(viewport_environment) viewport_environment.add(self.treeview_environment) self.button_environment_add.add(image_environment_add) self.button_environment_remove.add(image_environment_remove) grid_environment_buttons.pack_start(self.button_environment_add, False, False, 0) grid_environment_buttons.pack_start(self.button_environment_remove, False, False, 0) grid_environment.pack_start(grid_environment_buttons, False, False, 0) grid_environment.pack_start(scroll_environment, True, True, 0) self.grid_content.pack_start(self.sidebar_stack, False, False, 0) self.grid_content.pack_start(self.stack, True, True, 0) self.pack_start(self.label_title, False, False) self.pack_start(self.grid_content)
def __init_widgets(self): """ Initialize interface widgets """ self.set_size(640, 480) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Grid # ------------------------------------ self.grid_switch = Gtk.Grid() # Properties self.grid_switch.set_column_spacing(12) self.grid_switch.set_row_spacing(6) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % ( replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Description # ------------------------------------ self.label_description = Gtk.Label() # Properties self.label_description.set_text( _("The following game going to be removed from your hard drive. " "This action is irreversible!")) self.label_description.set_line_wrap(True) self.label_description.set_max_width_chars(8) self.label_description.set_single_line_mode(False) self.label_description.set_justify(Gtk.Justification.FILL) self.label_description.set_line_wrap_mode(Pango.WrapMode.WORD) # ------------------------------------ # Options # ------------------------------------ self.label_data = Gtk.Label() self.frame_options = Gtk.Frame() self.scroll_options = Gtk.ScrolledWindow() self.listbox_options = Gtk.ListBox() self.widget_database = ListBoxItem() self.switch_database = Gtk.Switch() self.widget_desktop = ListBoxItem() self.switch_desktop = Gtk.Switch() self.widget_savestate = ListBoxItem() self.switch_savestate = Gtk.Switch() self.widget_screenshots = ListBoxItem() self.switch_screenshots = Gtk.Switch() self.widget_cache = ListBoxItem() self.switch_cache = Gtk.Switch() self.widget_memory = ListBoxItem() self.switch_memory = Gtk.Switch() # Properties self.label_data.set_markup( "<b>%s</b>" % _("Optional data to remove")) self.label_data.set_margin_top(12) self.label_data.set_hexpand(True) self.label_data.set_use_markup(True) self.label_data.set_single_line_mode(True) self.label_data.set_halign(Gtk.Align.CENTER) self.label_data.set_ellipsize(Pango.EllipsizeMode.END) self.listbox_options.set_activate_on_single_click(True) self.listbox_options.set_selection_mode( Gtk.SelectionMode.NONE) self.widget_database.set_widget(self.switch_database) self.widget_database.set_option_label( _("Database")) self.widget_database.set_description_label( _("Delete game data from database")) self.widget_desktop.set_widget(self.switch_desktop) self.widget_desktop.set_option_label( _("Menu entry")) self.widget_desktop.set_description_label( _("Delete desktop file")) self.widget_savestate.set_widget(self.switch_savestate) self.widget_savestate.set_option_label( _("Savestates")) self.widget_savestate.set_description_label( _("Delete savestates files")) self.widget_screenshots.set_widget(self.switch_screenshots) self.widget_screenshots.set_option_label( _("Screenshots")) self.widget_screenshots.set_description_label( _("Delete screenshots files")) self.widget_cache.set_widget(self.switch_cache) self.widget_cache.set_option_label( _("Icons cache")) self.widget_cache.set_description_label( _("Delete generated icons from cache")) self.widget_memory.set_widget(self.switch_memory) self.widget_memory.set_option_label( _("Flash memory")) self.widget_memory.set_description_label( _("Delete flash memory file")) # ------------------------------------ # Integrate widgets # ------------------------------------ self.listbox_options.add(self.widget_database) self.listbox_options.add(self.widget_desktop) self.listbox_options.add(self.widget_cache) self.listbox_options.add(self.widget_savestate) self.listbox_options.add(self.widget_screenshots) if self.game.emulator is not None: # Check extension and emulator for GBA game on mednafen if self.parent.get_mednafen_status() \ and self.game.extension == ".gba" \ and "mednafen" in str(self.game.emulator.binary): self.listbox_options.add(self.widget_memory) self.scroll_options.add(self.listbox_options) self.frame_options.add(self.scroll_options) self.pack_start(self.label_title, False, False) self.pack_start(self.label_description, False, False) self.pack_start(self.label_data, False, False) self.pack_start(self.frame_options)
def __init_widgets(self): """ Initialize interface widgets """ self.set_size(640, 480) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Grid # ------------------------------------ self.grid_content = Gtk.Box() # Properties self.grid_content.set_spacing(6) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % ( replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Image selector # ------------------------------------ self.label_image_selector = Gtk.Label() self.filter_image_selector = Gtk.FileFilter.new() self.dialog_image_selector = Gtk.FileChooserDialog( use_header_bar=not self.use_classic_theme) self.file_image_selector = Gtk.FileChooserButton.new_with_dialog( self.dialog_image_selector) self.image_reset = Gtk.Image() self.button_reset = Gtk.Button() # Properties self.label_image_selector.set_markup("<b>%s</b>" % _("Thumbnail file")) self.label_image_selector.set_margin_top(12) self.label_image_selector.set_hexpand(True) self.label_image_selector.set_use_markup(True) self.label_image_selector.set_single_line_mode(True) self.label_image_selector.set_halign(Gtk.Align.CENTER) self.label_image_selector.set_ellipsize(Pango.EllipsizeMode.END) for pattern in self.mimetypes: self.filter_image_selector.add_mime_type(pattern) self.dialog_image_selector.add_button( _("Cancel"), Gtk.ResponseType.CANCEL) self.dialog_image_selector.add_button( _("Accept"), Gtk.ResponseType.ACCEPT) self.dialog_image_selector.set_filter(self.filter_image_selector) self.dialog_image_selector.set_action(Gtk.FileChooserAction.OPEN) self.dialog_image_selector.set_create_folders(False) self.dialog_image_selector.set_local_only(True) self.file_image_selector.set_hexpand(True) self.image_reset.set_from_icon_name( Icons.Symbolic.CLEAR, Gtk.IconSize.BUTTON) # ------------------------------------ # Image preview # ------------------------------------ self.label_preview = Gtk.Label() self.scroll_preview = Gtk.ScrolledWindow() self.view_preview = Gtk.Viewport() self.image_preview = Gtk.Image() # Properties self.label_preview.set_markup("<b>%s</b>" % _("Preview")) self.label_preview.set_margin_top(12) self.label_preview.set_hexpand(True) self.label_preview.set_use_markup(True) self.label_preview.set_single_line_mode(True) self.label_preview.set_halign(Gtk.Align.CENTER) self.label_preview.set_ellipsize(Pango.EllipsizeMode.END) self.scroll_preview.set_shadow_type(Gtk.ShadowType.OUT) self.image_preview.set_halign(Gtk.Align.CENTER) self.image_preview.set_valign(Gtk.Align.CENTER) self.image_preview.set_hexpand(True) self.image_preview.set_vexpand(True) # ------------------------------------ # Integrate widgets # ------------------------------------ self.button_reset.add(self.image_reset) self.grid_content.pack_start(self.file_image_selector, True, True, 0) self.grid_content.pack_start(self.button_reset, False, False, 0) self.view_preview.add(self.image_preview) self.scroll_preview.add(self.view_preview) self.pack_start(self.label_title, False, False) self.pack_start(self.label_image_selector, False, False) self.pack_start(self.grid_content, False, False) self.pack_start(self.label_preview, False, False) self.pack_start(self.scroll_preview)
def __init_widgets(self): """ Initialize interface widgets """ self.set_size(640, 480) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Grid # ------------------------------------ self.grid_switch = Gtk.Grid() # Properties self.grid_switch.set_column_spacing(12) self.grid_switch.set_row_spacing(6) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % (replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Description # ------------------------------------ self.label_description = Gtk.Label() # Properties self.label_description.set_text( _("The following actions are irreversible, be careful!")) self.label_description.set_line_wrap(True) self.label_description.set_max_width_chars(8) self.label_description.set_single_line_mode(False) self.label_description.set_justify(Gtk.Justification.FILL) self.label_description.set_line_wrap_mode(Pango.WrapMode.WORD) # ------------------------------------ # Options # ------------------------------------ self.label_data = Gtk.Label() self.frame_options = Gtk.Frame() self.scroll_options = Gtk.ScrolledWindow() self.listbox_options = Gtk.ListBox() self.widget_database = ListBoxItem() self.switch_database = Gtk.Switch() self.widget_log = ListBoxItem() self.switch_log = Gtk.Switch() self.widget_note = ListBoxItem() self.switch_note = Gtk.Switch() self.widget_savestate = ListBoxItem() self.switch_savestate = Gtk.Switch() self.widget_screenshots = ListBoxItem() self.switch_screenshots = Gtk.Switch() self.widget_cache = ListBoxItem() self.switch_cache = Gtk.Switch() self.widget_environment = ListBoxItem() self.switch_environment = Gtk.Switch() # Properties self.label_data.set_markup("<b>%s</b>" % _("Available actions")) self.label_data.set_margin_top(12) self.label_data.set_hexpand(True) self.label_data.set_use_markup(True) self.label_data.set_single_line_mode(True) self.label_data.set_halign(Gtk.Align.CENTER) self.label_data.set_ellipsize(Pango.EllipsizeMode.END) self.listbox_options.set_activate_on_single_click(True) self.listbox_options.set_selection_mode(Gtk.SelectionMode.NONE) self.widget_database.set_widget(self.switch_database) self.widget_database.set_option_label(_("Database")) self.widget_database.set_description_label( _("Clean game data from database")) self.widget_log.set_widget(self.switch_log) self.widget_log.set_option_label(_("Log")) self.widget_log.set_description_label(_("Delete game log file")) self.widget_note.set_widget(self.switch_note) self.widget_note.set_option_label(_("Note")) self.widget_note.set_description_label(_("Delete game note file")) self.widget_savestate.set_widget(self.switch_savestate) self.widget_savestate.set_option_label(_("Savestates")) self.widget_savestate.set_description_label( _("Delete savestates files")) self.widget_screenshots.set_widget(self.switch_screenshots) self.widget_screenshots.set_option_label(_("Screenshots")) self.widget_screenshots.set_description_label( _("Delete screenshots files")) self.widget_cache.set_widget(self.switch_cache) self.widget_cache.set_option_label(_("Icons cache")) self.widget_cache.set_description_label( _("Delete generated icons from cache")) self.widget_environment.set_widget(self.switch_environment) self.widget_environment.set_option_label(_("Environment variables")) self.widget_environment.set_description_label( _("Delete custom game environment variables")) # ------------------------------------ # Integrate widgets # ------------------------------------ self.listbox_options.add(self.widget_database) self.listbox_options.add(self.widget_cache) self.listbox_options.add(self.widget_log) self.listbox_options.add(self.widget_note) self.listbox_options.add(self.widget_savestate) self.listbox_options.add(self.widget_screenshots) self.listbox_options.add(self.widget_environment) self.scroll_options.add(self.listbox_options) self.frame_options.add(self.scroll_options) self.pack_start(self.label_title, False, False) self.pack_start(self.label_description, False, False) self.pack_start(self.label_data, False, False) self.pack_start(self.frame_options)
def __init_widgets(self): """ Initialize interface widgets """ self.set_size(640, 480) self.set_spacing(6) self.set_resizable(True) # ------------------------------------ # Grid # ------------------------------------ self.grid_switch = Gtk.Grid() # Properties self.grid_switch.set_column_spacing(12) self.grid_switch.set_row_spacing(6) # ------------------------------------ # Title # ------------------------------------ self.label_title = Gtk.Label() # Properties self.label_title.set_markup( "<span weight='bold' size='large'>%s</span>" % (replace_for_markup(self.game.name))) self.label_title.set_use_markup(True) self.label_title.set_halign(Gtk.Align.CENTER) self.label_title.set_ellipsize(Pango.EllipsizeMode.END) # ------------------------------------ # Filename # ------------------------------------ self.label_name = Gtk.Label() self.entry_name = Gtk.Entry() # Properties self.label_name.set_markup("<b>%s</b>" % _("New filename")) self.label_name.set_margin_top(12) self.label_name.set_hexpand(True) self.label_name.set_use_markup(True) self.label_name.set_single_line_mode(True) self.label_name.set_halign(Gtk.Align.CENTER) self.label_name.set_ellipsize(Pango.EllipsizeMode.END) self.entry_name.set_hexpand(True) self.entry_name.set_icon_from_icon_name(Gtk.EntryIconPosition.PRIMARY, Icons.Symbolic.SAVE) self.entry_name.set_icon_from_icon_name( Gtk.EntryIconPosition.SECONDARY, Icons.Symbolic.ERROR) # ------------------------------------ # Optional data # ------------------------------------ self.label_data = Gtk.Label() self.frame_options = Gtk.Frame() self.scroll_options = Gtk.ScrolledWindow() self.listbox_options = Gtk.ListBox() self.widget_database = ListBoxItem() self.switch_database = Gtk.Switch() self.widget_savestate = ListBoxItem() self.switch_savestate = Gtk.Switch() self.widget_screenshot = ListBoxItem() self.switch_screenshot = Gtk.Switch() self.widget_note = ListBoxItem() self.switch_note = Gtk.Switch() self.widget_memory = ListBoxItem() self.switch_memory = Gtk.Switch() # Properties self.label_data.set_markup("<b>%s</b>" % _("Optional data to duplicate")) self.label_data.set_margin_top(12) self.label_data.set_hexpand(True) self.label_data.set_use_markup(True) self.label_data.set_single_line_mode(True) self.label_data.set_halign(Gtk.Align.CENTER) self.label_data.set_ellipsize(Pango.EllipsizeMode.END) self.listbox_options.set_activate_on_single_click(True) self.listbox_options.set_selection_mode(Gtk.SelectionMode.NONE) self.widget_database.set_widget(self.switch_database) self.widget_database.set_option_label(_("Database")) self.widget_database.set_description_label( _("Duplicate game data from database")) self.widget_savestate.set_widget(self.switch_savestate) self.widget_savestate.set_option_label(_("Savestates")) self.widget_savestate.set_description_label( _("Duplicate savestates files")) self.widget_screenshot.set_widget(self.switch_screenshot) self.widget_screenshot.set_option_label(_("Screenshots")) self.widget_screenshot.set_description_label( _("Duplicate screenshots files")) self.widget_note.set_widget(self.switch_note) self.widget_note.set_option_label(_("Note")) self.widget_note.set_description_label(_("Duplicate game note file")) self.widget_memory.set_widget(self.switch_memory) self.widget_memory.set_option_label(_("Flash memory")) self.widget_memory.set_description_label( _("Duplicate flash memory file")) # ------------------------------------ # Integrate widgets # ------------------------------------ self.listbox_options.add(self.widget_database) self.listbox_options.add(self.widget_savestate) self.listbox_options.add(self.widget_screenshot) self.listbox_options.add(self.widget_note) if self.game.emulator is not None: # Check extension and emulator for GBA game on mednafen if self.parent.get_mednafen_status() \ and self.game.extension == ".gba" \ and "mednafen" in str(self.game.emulator.binary): self.listbox_options.add(self.widget_memory) self.scroll_options.add(self.listbox_options) self.frame_options.add(self.scroll_options) self.pack_start(self.label_title, False, False) self.pack_start(self.label_name, False, False) self.pack_start(self.entry_name, False, False) self.pack_start(self.label_data, False, False) self.pack_start(self.frame_options)