Example #1
0
    def on_service_synced(self, sync_results, _extra):
        """Called when games are imported"""
        window = get_main_window(self)
        if not window:
            logger.warning("Unable to get main window")
            return
        if not sync_results:
            logger.error("No sync results were passed")
            return
        added_games, original_games = sync_results

        skipped_import = len(original_games) - len(added_games)
        if added_games:
            added_message = gettext.ngettext(
                "%d game was imported. ", "%d games were imported. ",
                len(added_games)) % len(added_games)
        else:
            added_message = _("No games were added. ")

        if skipped_import:
            skipped_message = gettext.ngettext(
                "%s game is already in the library",
                "%s games are already in the library",
                skipped_import) % skipped_import
        else:
            skipped_message = ""

        send_notification(_("Games imported"), added_message + skipped_message)
        for game_id in added_games:
            window.game_store.add_or_update(game_id)
Example #2
0
    def on_service_synced(self, sync_results, _extra):
        """Called when games are imported"""
        window = get_main_window(self)
        if not window:
            logger.warning("Unable to get main window")
            return
        added_games, original_games = sync_results

        skipped_import = len(original_games) - len(added_games)
        if added_games:
            added_message = "%s game%s imported. " % (
                len(added_games),
                "s were" if len(added_games) > 1 else " was"
            )
        else:
            added_message = "No games were added. "

        if skipped_import:
            skipped_message = "%s game%s already in the library" % (
                skipped_import,
                "s are" if skipped_import > 1 else " is"
            )
        else:
            skipped_message = ""

        send_notification("Games imported", added_message + skipped_message)
        for game_id in added_games:
            window.game_store.add_or_update(game_id)
Example #3
0
 def on_game_moved(self, dialog):
     """Show a notification when the game is moved"""
     new_directory = dialog.new_directory
     if new_directory:
         self.directory_entry.set_text(new_directory)
         send_notification("Finished moving game", "%s moved to %s" % (dialog.game, new_directory))
     else:
         send_notification("Failed to move game", "Lutris could not move %s" % dialog.game)
Example #4
0
 def on_service_synced(self, games, _extra):
     """Called when games are imported"""
     window = get_main_window(self)
     if not window:
         logger.warning("Unable to get main window")
         return
     if games:
         send_notification(
             "Games imported", "%s game%s imported to Lutris" %
             (len(games), "s were" if len(games) > 1 else " was"))
         for game_id in games:
             window.game_store.add_or_update(game_id)
Example #5
0
 def on_service_synced(self, games, _extra):
     """Called when games are imported"""
     window = get_main_window(self)
     if not window:
         logger.warning("Unable to get main window")
         return
     if games:
         send_notification(
             "Games imported",
             "%s game%s imported to Lutris" %
             (len(games), "s were" if len(games) > 1 else " was")
         )
         window.game_store.add_games_by_ids(games)
         GLib.idle_add(window.view.queue_draw)
Example #6
0
 def on_service_synced(self, games, _extra):
     """Called when games are imported"""
     window = get_main_window(self)
     if not window:
         logger.warning("Unable to get main window")
         return
     if games:
         send_notification(
             "Games imported",
             "%s game%s imported to Lutris" %
             (len(games), "s were" if len(games) > 1 else " was")
         )
         for game_id in games:
             window.game_store.add_or_update(game_id)