Пример #1
0
    def remove(self, from_library=False, from_disk=False):
        """Uninstall a game

        Params:
            from_library (bool): Completely remove the game from library, do
                                 not set it as uninstalled
            from_disk (bool): Delete the game files

        Return:
            bool: Updated value for from_library
        """
        if from_disk and self.runner:
            logger.debug("Removing game %s from disk", self.id)
            self.runner.remove_game_data(game_path=self.directory)

        # Do not keep multiple copies of the same game
        existing_games = pga.get_games_where(slug=self.slug)
        if len(existing_games) > 1:
            from_library = True

        if from_library:
            logger.debug("Removing game %s from library", self.id)
            pga.delete_game(self.id)
        else:
            pga.set_uninstalled(self.id)
        if self.config:
            self.config.remove()
        xdgshortcuts.remove_launcher(self.slug,
                                     self.id,
                                     desktop=True,
                                     menu=True)
        self.is_installed = False
        self.emit("game-removed")
        return from_library
Пример #2
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         self.runner.remove_game_data(game_path=self.directory)
     if from_library:
         pga.delete_game(self.slug)
         self.config.remove()
     else:
         pga.set_uninstalled(self.slug)
Пример #3
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         self.runner.remove_game_data(game_path=self.directory)
     if from_library:
         pga.delete_game(self.slug)
         self.config.remove()
     else:
         pga.set_uninstalled(self.slug)
Пример #4
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         if os.path.exists(self.directory):
             shutil.rmtree(self.directory)
     if from_library:
         pga.delete_game(self.slug)
     else:
         pga.set_uninstalled(self.slug)
     self.game_config.remove()
Пример #5
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         if os.path.exists(self.directory):
             shutil.rmtree(self.directory)
     if from_library:
         pga.delete_game(self.slug)
     else:
         pga.set_uninstalled(self.slug)
     self.config.remove()
Пример #6
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         self.runner.remove_game_data(game_path=self.directory)
     if from_library:
         pga.delete_game(self.slug)
         self.config.remove()
     else:
         pga.set_uninstalled(self.slug)
     shortcuts.remove_launcher(self.slug, desktop=True, menu=True)
Пример #7
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         logger.debug("Removing game %s from disk" % self.id)
         self.runner.remove_game_data(game_path=self.directory)
     if from_library:
         logger.debug("Removing game %s from library" % self.id)
         pga.delete_game(self.id)
     else:
         pga.set_uninstalled(self.id)
     self.config.remove()
     shortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
Пример #8
0
    def remove(self, from_library=False, from_disk=False):
        if from_disk and self.runner:
            logger.debug("Removing game %s from disk" % self.id)
            self.runner.remove_game_data(game_path=self.directory)

        # Do not keep multiple copies of the same game
        existing_games = pga.get_game_by_field(self.slug, 'slug', all=True)
        if len(existing_games) > 1:
            from_library = True

        if from_library:
            logger.debug("Removing game %s from library" % self.id)
            pga.delete_game(self.id)
        else:
            pga.set_uninstalled(self.id)
        self.config.remove()
        shortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
        return from_library
Пример #9
0
    def remove(self, from_library=False, from_disk=False):
        if from_disk and self.runner:
            logger.debug("Removing game %s from disk" % self.id)
            self.runner.remove_game_data(game_path=self.directory)

        # Do not keep multiple copies of the same game
        existing_games = pga.get_game_by_field(self.slug, 'slug', all=True)
        if len(existing_games) > 1:
            from_library = True

        if from_library:
            logger.debug("Removing game %s from library" % self.id)
            pga.delete_game(self.id)
        else:
            pga.set_uninstalled(self.id)
        self.config.remove()
        shortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
        return from_library
Пример #10
0
    def remove(self, from_library=False, from_disk=False):
        if from_disk and self.runner:
            logger.debug("Removing game %s from disk", self.id)
            self.runner.remove_game_data(game_path=self.directory)

        # Do not keep multiple copies of the same game
        existing_games = pga.get_games_where(slug=self.slug)
        if len(existing_games) > 1:
            from_library = True

        if from_library:
            logger.debug("Removing game %s from library", self.id)
            pga.delete_game(self.id)
        else:
            pga.set_uninstalled(self.id)
        if self.config:
            self.config.remove()
        xdgshortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
        self.is_installed = False
        self.emit("game-removed")
        return from_library
Пример #11
0
    def remove(self, from_library=False, from_disk=False):
        if from_disk and self.runner:
            logger.debug("Removing game %s from disk", self.id)
            self.runner.remove_game_data(game_path=self.directory)

        # Do not keep multiple copies of the same game
        existing_games = pga.get_games_where(slug=self.slug)
        if len(existing_games) > 1:
            from_library = True

        if from_library:
            logger.debug("Removing game %s from library", self.id)
            pga.delete_game(self.id)
        else:
            pga.set_uninstalled(self.id)
        if self.config:
            self.config.remove()
        xdgshortcuts.remove_launcher(self.slug, self.id, desktop=True, menu=True)
        self.is_installed = False
        self.emit("game-removed")
        return from_library
Пример #12
0
 def test_delete_game(self):
     pga.delete_game(self.game_id)
     game_list = pga.get_games()
     self.assertEqual(len(game_list), 0)
     self.game_id = pga.add_game(name="LutrisTest", runner="Linux")
Пример #13
0
 def remove(self, from_library=False, from_disk=False):
     if from_disk:
         shutil.rmtree(self.directory)
     if from_library:
         pga.delete_game(self.slug)
     self.game_config.remove()