Repository: lutris/lutris

Issue:
Allow deleting Runners from the UI
I need to because of a bug in the version of steam I am using.
Allow deleting Runners from the UI
I need to because of a bug in the version of steam I am using.


Discussion:
Menu Lutris > Manage runners > Bottom left, `Open Runners Folder`
Delete `winesteam` folder.
Would be nice to have a "Uninstall" button directly in the UI for Runners that are installed.

![delete](https://user-images.githubusercontent.com/25086/44474049-b2371d00-a5ff-11e8-8371-6ca8394ec892.png)

Great idea Rob!
Menu Lutris > Manage runners > Bottom left, `Open Runners Folder`
Delete `winesteam` folder.
Would be nice to have a "Uninstall" button directly in the UI for Runners that are installed.

![delete](https://user-images.githubusercontent.com/25086/44474049-b2371d00-a5ff-11e8-8371-6ca8394ec892.png)

Great idea Rob!

Resolving patch:
diff --git a/lutris/gui/runnersdialog.py b/lutris/gui/runnersdialog.py
--- a/lutris/gui/runnersdialog.py
+++ b/lutris/gui/runnersdialog.py
@@ -1,4 +1,6 @@
 # -*- coding:Utf-8 -*-
+import os
+
 from gi.repository import Gtk, GObject, Gdk
 
 from lutris import runners
@@ -56,10 +58,10 @@ def __init__(self):
         open_runner_button.connect('clicked', self.on_runner_open_clicked)
         buttons_box.pack_start(open_runner_button, False, False, 0)
 
-        refresh_button = Gtk.Button("Refresh")
-        refresh_button.show()
-        refresh_button.connect('clicked', self.on_refresh_clicked)
-        buttons_box.pack_start(refresh_button, False, False, 10)
+        self.refresh_button = Gtk.Button("Refresh")
+        self.refresh_button.show()
+        self.refresh_button.connect('clicked', self.on_refresh_clicked)
+        buttons_box.pack_start(self.refresh_button, False, False, 10)
 
         close_button = Gtk.Button("Close")
         close_button.show()
@@ -124,6 +126,12 @@ def get_runner_hbox(self, runner_name):
                                     runner_label)
         hbox.pack_start(self.install_button, False, False, 5)
 
+        self.remove_button = Gtk.Button("Remove")
+        self.remove_button.set_size_request(90, 30)
+        self.remove_button.set_valign(Gtk.Align.CENTER)
+        self.remove_button.connect("clicked", self.on_remove_clicked, runner, runner_label)
+        hbox.pack_start(self.remove_button, False, False, 5)
+
         self.configure_button = Gtk.Button("Configure")
         self.configure_button.set_size_request(90, 30)
         self.configure_button.set_valign(Gtk.Align.CENTER)
@@ -144,12 +152,21 @@ def set_button_display(self, runner):
         if runner.multiple_versions:
             self.versions_button.show()
             self.install_button.hide()
+            if runner.can_uninstall():
+                self.remove_button.show()
+            else:
+                self.remove_button.hide()
         else:
             self.versions_button.hide()
+            self.remove_button.hide()
             self.install_button.show()
 
         if runner.is_installed():
             self.install_button.hide()
+            if runner.can_uninstall():
+                self.remove_button.show()
+            else:
+                self.remove_button.hide()
 
         self.configure_button.show()
 
@@ -171,14 +188,18 @@ def on_install_clicked(self, widget, runner, runner_label):
             ErrorDialog(ex.message, parent=self)
         if runner.is_installed():
             self.emit('runner-installed')
-            widget.hide()
-            runner_label.set_sensitive(True)
+            self.refresh_button.emit('clicked')
 
     def on_configure_clicked(self, widget, runner, runner_label):
         config_dialog = RunnerConfigDialog(runner, parent=self)
         config_dialog.connect('destroy', self.set_install_state,
                               runner, runner_label)
 
+    def on_remove_clicked(self, widget, runner, runner_label):
+        if runner.is_installed():
+            runner.uninstall()
+            self.refresh_button.emit('clicked')
+
     def on_runner_open_clicked(self, widget):
         open_uri('file://' + settings.RUNNER_DIR)
 
diff --git a/lutris/runners/runner.py b/lutris/runners/runner.py
--- a/lutris/runners/runner.py
+++ b/lutris/runners/runner.py
@@ -367,6 +367,10 @@ def extract(self, archive=None, dest=None, merge_single=None,
     def remove_game_data(self, game_path=None):
         system.remove_folder(game_path)
 
+    def can_uninstall(self):
+        runner_path = os.path.join(settings.RUNNER_DIR, self.name)
+        return os.path.isdir(runner_path)
+
     def uninstall(self):
         runner_path = os.path.join(settings.RUNNER_DIR, self.name)
         if os.path.isdir(runner_path):


Test patch: