Beispiel #1
0
 def on_show_installed_games_toggled(self, widget, data=None):
     self.filter_installed = widget.get_active()
     setting_value = 'true' if self.filter_installed else 'false'
     settings.write_setting(
         'filter_installed', setting_value
     )
     self.do_view_switch(self.current_view_type)
Beispiel #2
0
 def toggle_sidebar(self, widget=None):
     self.sidebar_visible = not self.sidebar_visible
     if self.sidebar_visible:
         settings.write_setting('sidebar_visible', 'true')
     else:
         settings.write_setting('sidebar_visible', 'false')
     self.show_sidebar()
Beispiel #3
0
    def switch_view(self, view_type):
        """Switch between grid view and list view."""
        self.view.destroy()
        self.load_icon_type_from_settings(view_type)
        self.game_store.set_icon_type(self.icon_type)

        self.view = self.get_view(view_type)
        self.view.contextual_menu = self.menu
        self.connect_signals()
        scrollwindow_children = self.games_scrollwindow.get_children()
        if len(scrollwindow_children):
            child = scrollwindow_children[0]
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.view.show_all()

        # Note: set_active(True *or* False) apparently makes ALL the menuitems
        # in the group send the activate signal...
        if self.icon_type == 'banner_small':
            self.banner_small_menuitem.set_active(True)
        elif self.icon_type == 'icon':
            self.icon_menuitem.set_active(True)
        elif self.icon_type == 'banner':
            self.banner_menuitem.set_active(True)
        settings.write_setting('view_type', view_type)
Beispiel #4
0
 def on_column_width_changed(col, *args):
     col_name = col.get_title()
     if col_name:
         settings.write_setting(
             col_name.replace(" ", "") + "_column_width",
             col.get_fixed_width(),
             "list view",
         )
Beispiel #5
0
 def on_sidebar_state_change(self, action, value):
     action.set_state(value)
     self.sidebar_visible = value.get_boolean()
     if self.sidebar_visible:
         settings.write_setting('sidebar_visible', 'true')
     else:
         settings.write_setting('sidebar_visible', 'false')
     self.show_sidebar()
Beispiel #6
0
 def set_show_installed_state(self, filter_installed):
     self.filter_installed = filter_installed
     setting_value = 'true' if filter_installed else 'false'
     settings.write_setting(
         'filter_installed', setting_value
     )
     self.game_store.filter_installed = filter_installed
     self.game_store.modelfilter.refilter()
Beispiel #7
0
 def toggle_sidebar(self, _widget=None):
     if self.sidebar_visible:
         self.sidebar_viewport.hide()
         settings.write_setting('sidebar_visible', 'false')
     else:
         self.sidebar_viewport.show()
         settings.write_setting('sidebar_visible', 'true')
     self.sidebar_visible = not self.sidebar_visible
Beispiel #8
0
 def on_sidebar_state_change(self, action, value):
     """Callback to handle siderbar toggle"""
     action.set_state(value)
     sidebar_visible = value.get_boolean()
     settings.write_setting("sidebar_visible", "true" if sidebar_visible else "false")
     self.sidebar_revealer.set_reveal_child(sidebar_visible)
     self.panel_revealer.set_reveal_child(sidebar_visible)
     self.game_scrolled.set_visible(sidebar_visible)
Beispiel #9
0
 def on_show_installed_games_toggled(self, widget, data=None):
     filter_installed = widget.get_active()
     setting_value = 'true' if filter_installed else 'false'
     settings.write_setting(
         'filter_installed', setting_value
     )
     self.game_store.filter_installed = filter_installed
     self.game_store.modelfilter.refilter()
Beispiel #10
0
 def on_icon_type_activate(self, menuitem):
     icon_type = menuitem.get_name()
     if icon_type == self.game_store.icon_type or not menuitem.get_active():
         return
     if self.current_view_type == "grid":
         settings.write_setting("icon_type_gridview", icon_type)
     elif self.current_view_type == "list":
         settings.write_setting("icon_type_listview", icon_type)
     self.game_store.set_icon_type(icon_type)
Beispiel #11
0
 def on_icon_type_activate(self, menuitem):
     icon_type = menuitem.get_name()
     if icon_type == self.view.icon_type or not menuitem.get_active():
         return
     if self.current_view_type == 'icon':
         settings.write_setting('icon_type_iconview', icon_type)
     elif self.current_view_type == 'list':
         settings.write_setting('icon_type_listview', icon_type)
     self.switch_view(self.current_view_type)
Beispiel #12
0
 def on_version_received(version, error):
     if not version:
         return
     latest_version = settings.read_setting('latest_version')
     if version > (latest_version or settings.VERSION):
         dialogs.ClientUpdateDialog()
         # Store latest version seen to avoid showing
         # the dialog more than once.
         settings.write_setting('latest_version', version)
Beispiel #13
0
 def _set_icon_type(self, icon_type):
     self.icon_type = icon_type
     if self.icon_type == self.game_store.icon_type:
         return
     if self.current_view_type == "grid":
         settings.write_setting("icon_type_gridview", self.icon_type)
     elif self.current_view_type == "list":
         settings.write_setting("icon_type_listview", self.icon_type)
     self.game_store.set_icon_type(self.icon_type)
     self.switch_view(self.get_view_type())
Beispiel #14
0
 def on_icon_type_activate(self, menuitem):
     self.icon_type = menuitem.get_name()
     if self.icon_type == self.game_store.icon_type or not menuitem.get_active():
         return
     if self.current_view_type == 'grid':
         settings.write_setting('icon_type_gridview', self.icon_type)
     elif self.current_view_type == 'list':
         settings.write_setting('icon_type_listview', self.icon_type)
     self.game_store.set_icon_type(self.icon_type)
     self.switch_view(self.get_view_type())
Beispiel #15
0
 def on_icontype_state_change(self, action, value):
     action.set_state(value)
     self.icon_type = value.get_string()
     if self.icon_type == self.game_store.icon_type:
         return
     if self.current_view_type == 'grid':
         settings.write_setting('icon_type_gridview', self.icon_type)
     elif self.current_view_type == 'list':
         settings.write_setting('icon_type_listview', self.icon_type)
     self.game_store.set_icon_type(self.icon_type)
     self.switch_view(self.get_view_type())
Beispiel #16
0
def migrate():
    current_version = int(settings.read_setting("migration_version") or 0)
    if current_version >= MIGRATION_VERSION:
        return
    for i in range(current_version, MIGRATION_VERSION):
        for migration_name in MIGRATIONS[i]:
            logger.info("Running migration: %s", migration_name)
            migration = get_migration_module(migration_name)
            migration.migrate()

    settings.write_setting("migration_version", MIGRATION_VERSION)
Beispiel #17
0
def migrate():
    current_version = settings.read_setting('migration_version') or 0
    current_version = int(current_version)
    if current_version >= MIGRATION_VERSION:
        return
    for i in range(current_version, MIGRATION_VERSION):
        for migration_name in MIGRATIONS[i]:
            logger.debug('Running migration: %s' % migration_name)
            migration = get_migration_module(migration_name)
            migration.migrate()

    settings.write_setting('migration_version', MIGRATION_VERSION)
Beispiel #18
0
 def check_update(self):
     """Verify availability of client update."""
     version_request = http.Request('https://lutris.net/version')
     version_request.get()
     version = version_request.content
     if version:
         latest_version = settings.read_setting('latest_version')
         if version > (latest_version or settings.VERSION):
             dialogs.ClientUpdateDialog()
             # Store latest version seen to avoid showing
             # the dialog more than once.
             settings.write_setting('latest_version', version)
Beispiel #19
0
 def on_show_installed_games_toggled(self, widget, data=None):
     filter_installed = widget.get_active()
     setting_value = 'true' if filter_installed else 'false'
     settings.write_setting(
         'filter_installed', setting_value
     )
     if self.current_view_type == 'grid':
         self.view.filter_installed = filter_installed
         self.view.invalidate_filter()
     else:
         self.game_store.filter_installed = filter_installed
         self.game_store.modelfilter.refilter()
Beispiel #20
0
 def on_show_installed_state_change(self, action, value):
     action.set_state(value)
     filter_installed = value.get_boolean()
     setting_value = 'true' if filter_installed else 'false'
     settings.write_setting(
         'filter_installed', setting_value
     )
     if self.current_view_type == 'grid':
         self.view.filter_installed = filter_installed
         self.view.invalidate_filter()
     else:
         self.game_store.filter_installed = filter_installed
         self.game_store.modelfilter.refilter()
Beispiel #21
0
    def on_destroy(self, *args):
        """Signal for window close."""
        # Stop cancellable running threads
        for stopper in self.threads_stoppers:
            stopper()

        # Save settings
        width, height = self.window_size
        settings.write_setting("width", width)
        settings.write_setting("height", height)

        Gtk.main_quit(*args)
        logger.debug("Quitting lutris")
    def create_shortcuts(self, *args):
        """Create desktop and global menu shortcuts."""
        game_slug = self.interpreter.game_slug
        game_name = self.interpreter.game_name
        create_desktop_shortcut = self.desktop_shortcut_box.get_active()
        create_menu_shortcut = self.menu_shortcut_box.get_active()

        if create_desktop_shortcut:
            shortcuts.create_launcher(game_slug, game_name, desktop=True)
        if create_menu_shortcut:
            shortcuts.create_launcher(game_slug, game_name, menu=True)

        settings.write_setting("create_desktop_shortcut", create_desktop_shortcut)
        settings.write_setting("create_menu_shortcut", create_menu_shortcut)
Beispiel #23
0
    def on_destroy(self, *args):
        """Signal for window close."""
        # Stop cancellable running threads
        for stopper in self.threads_stoppers:
            stopper()
        self.steam_watcher = None

        if self.running_game \
           and self.running_game.state != self.running_game.STATE_STOPPED:
            logger.info("%s is still running, stopping it", self.running_game.name)
            self.running_game.stop()

        # Save settings
        width, height = self.window_size
        settings.write_setting('width', width)
        settings.write_setting('height', height)
Beispiel #24
0
    def switch_view(self, view_type):
        """Switch between grid view and list view."""
        self.view.destroy()
        self.load_icon_type_from_settings(view_type)
        self.game_store.set_icon_type(self.icon_type)

        self.view = self.get_view(view_type)
        self.view.contextual_menu = self.menu
        self.connect_signals()
        scrollwindow_children = self.games_scrollwindow.get_children()
        if len(scrollwindow_children):
            child = scrollwindow_children[0]
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.view.show_all()

        settings.write_setting('view_type', view_type)
Beispiel #25
0
    def switch_view(self, view_type):
        """Switch between grid view and list view."""
        self.view.destroy()
        self.load_icon_type_from_settings(view_type)
        self.game_store.set_icon_type(self.icon_type)

        self.view = self.get_view(view_type)
        self.view.contextual_menu = ContextualMenu(self.game_actions.get_game_actions())
        self._connect_signals()
        scrollwindow_children = self.games_scrollwindow.get_children()
        if scrollwindow_children:
            child = scrollwindow_children[0]
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.set_selected_filter(self.selected_runner, self.selected_platform)
        self.set_show_installed_state(self.filter_installed)
        self.view.show_all()

        self.zoom_adjustment.props.value = list(IMAGE_SIZES.keys()).index(self.icon_type)

        self.set_viewtype_icon(view_type)
        settings.write_setting("view_type", view_type)
Beispiel #26
0
 def on_destroy(self, *args):
     """Signal for window close"""
     view_type = 'icon' if 'IconView' in str(type(self.view)) else 'list'
     settings.write_setting('view_type', view_type)
     width, height = self.window_size
     settings.write_setting('width', width)
     settings.write_setting('height', height)
     Gtk.main_quit(*args)
Beispiel #27
0
 def on_destroy(self, *args):
     """Signal for window close."""
     view_type = 'grid' if 'GridView' in str(type(self.view)) else 'list'
     settings.write_setting('view_type', view_type)
     width, height = self.window_size
     settings.write_setting('width', width)
     settings.write_setting('height', height)
     Gtk.main_quit(*args)
     logger.debug("Quitting lutris")
Beispiel #28
0
    def switch_view(self, view_type):
        """Switch between grid view and list view."""
        self.view.destroy()
        self.load_icon_type_from_settings(view_type)
        self.game_store.set_icon_type(self.icon_type)

        self.view = self.get_view(view_type)
        self.view.contextual_menu = ContextualMenu(
            self.game_actions.get_game_actions())
        self._connect_signals()
        scrollwindow_children = self.games_scrollwindow.get_children()
        if scrollwindow_children:
            child = scrollwindow_children[0]
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.set_selected_filter(self.selected_runner, self.selected_platform)
        self.set_show_installed_state(self.filter_installed)
        self.view.show_all()

        self.zoom_adjustment.props.value = list(IMAGE_SIZES.keys()).index(
            self.icon_type)

        self.set_viewtype_icon(view_type)
        settings.write_setting("view_type", view_type)
Beispiel #29
0
    def switch_view(self, view_type):
        """Switch between grid view and list view."""
        logger.debug("Switching view")
        if view_type == self.get_view_type():
            return
        self.view.destroy()
        icon_type = self.get_icon_type(view_type)
        self.game_store.set_icon_type(icon_type)

        self.view = load_view(view_type, self.game_store)
        self.view.contextual_menu = self.menu
        self.connect_signals()
        self.games_scrollwindow.add(self.view)
        self.view.show_all()

        # Note: set_active(True *or* False) apparently makes ALL the menuitems
        # in the group send the activate signal...
        if icon_type == "banner_small":
            self.banner_small_menuitem.set_active(True)
        if icon_type == "icon":
            self.icon_menuitem.set_active(True)
        if icon_type == "banner":
            self.banner_menuitem.set_active(True)
        settings.write_setting("view_type", view_type)
Beispiel #30
0
    def __init__(
            self,
            setting,
            message,
            secondary_message=None,
            parent=None,
            checkbox_message=None,
    ):

        if settings.read_setting(setting) == "True":
            logger.info("Dialog %s dismissed by user", setting)
            return

        super().__init__(
            type=Gtk.MessageType.WARNING, buttons=Gtk.ButtonsType.OK, parent=parent
        )

        self.set_border_width(12)
        self.set_markup("<b>%s</b>" % message)
        if secondary_message:
            self.props.secondary_use_markup = True
            self.props.secondary_text = secondary_message

        if not checkbox_message:
            checkbox_message = "Do not display this message again."

        dont_show_checkbutton = Gtk.CheckButton(checkbox_message)
        dont_show_checkbutton.props.halign = Gtk.Align.CENTER
        dont_show_checkbutton.show()

        content_area = self.get_content_area()
        content_area.pack_start(dont_show_checkbutton, False, False, 0)
        self.run()
        if dont_show_checkbutton.get_active():
            settings.write_setting(setting, True)
        self.destroy()
Beispiel #31
0
    def __init__(
        self,
        setting,
        message,
        secondary_message=None,
        parent=None,
        checkbox_message=None,
    ):
        # pylint: disable=no-member
        if settings.read_setting(setting) == "True":
            logger.info("Dialog %s dismissed by user", setting)
            return

        super().__init__(type=Gtk.MessageType.WARNING,
                         buttons=Gtk.ButtonsType.OK,
                         parent=parent)

        self.set_border_width(12)
        self.set_markup("<b>%s</b>" % message)
        if secondary_message:
            self.props.secondary_use_markup = True
            self.props.secondary_text = secondary_message

        if not checkbox_message:
            checkbox_message = _("Do not display this message again.")

        dont_show_checkbutton = Gtk.CheckButton(checkbox_message)
        dont_show_checkbutton.props.halign = Gtk.Align.CENTER
        dont_show_checkbutton.show()

        content_area = self.get_content_area()
        content_area.pack_start(dont_show_checkbutton, False, False, 0)
        self.run()
        if dont_show_checkbutton.get_active():
            settings.write_setting(setting, True)
        self.destroy()
Beispiel #32
0
    def switch_view(self, view_type=None):
        """Switch between grid view and list view."""
        if self.view:
            self.view.destroy()
            logger.debug("View destroyed")
        self.reload_service_media()
        view_class = GameGridView if self.view_type == "grid" else GameListView
        self.view = view_class(self.game_store, self.game_store.service_media)

        self.view.connect("game-selected", self.on_game_selection_changed)
        self.view.connect("game-activated", self.on_game_activated)
        self.view.contextual_menu = ContextualMenu(
            self.game_actions.get_game_actions())
        for child in self.games_scrollwindow.get_children():
            child.destroy()
        self.games_scrollwindow.add(self.view)
        self.connect("view-updated", self.update_store)

        if view_type:
            self.set_viewtype_icon(view_type)
            settings.write_setting("view_type", view_type)

        self.view.show_all()
        self.update_store()
Beispiel #33
0
    def on_destroy(self, *_args):
        """Signal for window close."""
        # Stop cancellable running threads
        for stopper in self.threads_stoppers:
            stopper()

        # Save settings
        width, height = self.window_size
        settings.write_setting("width", width)
        settings.write_setting("height", height)
        settings.write_setting("maximized", self.maximized)
Beispiel #34
0
    def on_destroy(self, *_args):
        """Signal for window close."""
        # Stop cancellable running threads
        for stopper in self.threads_stoppers:
            stopper()
        self.steam_watcher = None

        if self.running_game \
           and self.running_game.state != self.running_game.STATE_STOPPED:
            logger.info("%s is still running, stopping it",
                        self.running_game.name)
            self.running_game.stop()

        # Save settings
        width, height = self.window_size
        settings.write_setting('width', width)
        settings.write_setting('height', height)
        settings.write_setting('maximized', self.maximized)
        settings.write_setting('sidebar_width', self.sidebar_width)
Beispiel #35
0
    def on_destroy(self, *_args):
        """Signal for window close."""
        # Stop cancellable running threads
        for stopper in self.threads_stoppers:
            stopper()
        # self.steam_watcher = None

        # Save settings
        width, height = self.window_size
        settings.write_setting("width", width)
        settings.write_setting("height", height)
        settings.write_setting("maximized", self.maximized)
Beispiel #36
0
 def on_toggle_viewtype(self, *args):
     view_type = "list" if self.current_view_type == "grid" else "grid"
     self.set_viewtype_icon(view_type)
     settings.write_setting("view_type", view_type)
     self.redraw_view()
Beispiel #37
0
 def set_show_installed_state(self, filter_installed):
     """Shows or hide uninstalled games"""
     settings.write_setting("filter_installed", bool(filter_installed))
     self.filters["installed"] = filter_installed
Beispiel #38
0
 def on_destroy(self, _widget):
     # Save window size
     width, height = self.dialog_size
     settings.write_setting("runners_manager_width", width)
     settings.write_setting("runners_manager_height", height)
Beispiel #39
0
 def set_show_installed_state(self, filter_installed):
     """Shows or hide uninstalled games"""
     settings.write_setting("filter_installed", bool(filter_installed))
     self.game_store.filter_installed = filter_installed
     self.invalidate_game_filter()
Beispiel #40
0
 def on_dark_theme_state_change(self, action, value):
     action.set_state(value)
     self.use_dark_theme = value.get_boolean()
     setting_value = 'true' if self.use_dark_theme else 'false'
     settings.write_setting('dark_theme', setting_value)
     self.set_dark_theme(self.use_dark_theme)
Beispiel #41
0
 def on_dark_theme_toggled(self, widget):
     use_dark_theme = widget.get_active()
     setting_value = 'true' if use_dark_theme else 'false'
     settings.write_setting('dark_theme', setting_value)
     self.set_dark_theme(use_dark_theme)
Beispiel #42
0
 def on_side_panel_state_change(self, action, value):
     """Callback to handle side panel toggle"""
     action.set_state(value)
     side_panel_visible = value.get_boolean()
     settings.write_setting("side_panel_visible", bool(side_panel_visible))
     self.sidebar_revealer.set_reveal_child(side_panel_visible)
Beispiel #43
0
 def set_show_installed_first_state(self, show_installed_first):
     """Shows the installed games first in the view"""
     settings.write_setting("show_installed_first",
                            "true" if show_installed_first else "false")
     self.game_store.sort_view(show_installed_first)
     self.game_store.modelfilter.refilter()
Beispiel #44
0
def set_hidden_ids(games):
    """Writes a list of game IDs that are to be hidden into the config file"""
    ignores_str = [str(game_id) for game_id in games]
    settings.write_setting("library_ignores",
                           ','.join(ignores_str),
                           section="lutris")
Beispiel #45
0
 def on_view_sorting_state_change(self, action, value):
     self.actions["view-sorting"].set_state(value)
     value = str(value).strip("'")
     settings.write_setting("view_sorting", value)
     self.emit("view-updated")
Beispiel #46
0
 def _on_service_change(self, widget, state, setting_key):
     """Save a setting when an option is toggled"""
     settings.write_setting(setting_key, state, section="services")
Beispiel #47
0
 def on_column_width_changed(self, col, *args):
     col_name = col.get_title()
     if col_name:
         settings.write_setting(
             col_name.replace(' ', '') + '_column_width',
             col.get_fixed_width(), 'list view')
Beispiel #48
0
 def on_show_installed_games_toggled(self, widget, data=None):
     self.filter_installed = widget.get_active()
     setting_value = 'true' if self.filter_installed else 'false'
     settings.write_setting('filter_installed', setting_value)
     self.switch_view(self.current_view_type)
Beispiel #49
0
 def on_switch_changed(self, switch, data):
     state = switch.get_active()
     write_setting('sync_at_startup', state, self.identifier)
Beispiel #50
0
 def set_show_installed_state(self, filter_installed):
     self.filter_installed = filter_installed
     setting_value = 'true' if filter_installed else 'false'
     settings.write_setting('filter_installed', setting_value)
     self.game_store.filter_installed = filter_installed
     self.game_store.modelfilter.refilter()
Beispiel #51
0
 def on_view_sorting_direction_change(self, action, value):
     self.actions["view-sorting-ascending"].set_state(value)
     settings.write_setting("view_sorting_ascending", bool(value))
     self.emit("view-updated")
Beispiel #52
0
    def on_game_store_sorting_changed(self, _game_store, key, ascending):
        self.actions["view-sorting"].set_state(GLib.Variant.new_string(key))
        settings.write_setting("view_sorting", key)

        self.actions["view-sorting-ascending"].set_state(GLib.Variant.new_boolean(ascending))
        settings.write_setting("view_sorting_ascending", "true" if ascending else "false")
Beispiel #53
0
 def on_dark_theme_state_change(self, action, value):
     """Callback for theme switching action"""
     action.set_state(value)
     settings.write_setting("dark_theme",
                            "true" if value.get_boolean() else "false")
     self.set_dark_theme()
Beispiel #54
0
 def on_tray_icon_toggle(self, action, value):
     """Callback for handling tray icon toggle"""
     action.set_state(value)
     settings.write_setting("show_tray_icon", value)
     self.application.set_tray_icon()
Beispiel #55
0
 def set_show_installed_state(self, filter_installed):
     """Shows or hide uninstalled games"""
     settings.write_setting("filter_installed",
                            "true" if filter_installed else "false")
     self.game_store.filter_installed = filter_installed
     self.invalidate_game_filter()
Beispiel #56
0
 def do_shutdown(self):  # pylint: disable=arguments-differ
     logger.info("Shutting down Lutris")
     if self.window:
         settings.write_setting("selected_category", self.window.selected_category)
         self.window.destroy()
     Gtk.Application.do_shutdown(self)
Beispiel #57
0
    def on_show_advanced_options_toggled(self, checkbox):
        value = True if checkbox.get_active() else False
        settings.write_setting("show_advanced_options", value)

        self._set_advanced_options_visible(value)
Beispiel #58
0
 def _on_hide_client_change(self, widget):
     """Save setting for hiding the game on game launch"""
     settings.write_setting("hide_client_on_game_start", widget.get_active())
Beispiel #59
0
    def on_show_advanced_options_toggled(self, checkbox):
        value = bool(checkbox.get_active())
        settings.write_setting("show_advanced_options", value)

        self._set_advanced_options_visible(value)
Beispiel #60
0
 def on_toggle_viewtype(self, *args):
     view_type = "list" if self.current_view_type == "grid" else "grid"
     logger.debug("View type changed to %s", view_type)
     self.set_viewtype_icon(view_type)
     settings.write_setting("view_type", view_type)
     self.redraw_view()