示例#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
文件: game.py 项目: jimmyleith/lutris
 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
文件: game.py 项目: Kehlyos/lutris
 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
文件: game.py 项目: dacp17/lutris
 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
文件: game.py 项目: Freso/lutris
    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
文件: game.py 项目: aoighost/lutris
 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()