summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJonas Dellinger <jonas@dellinger.dev>2023-06-07 07:35:05 +0200
committerGitHub <noreply@github.com>2023-06-06 22:35:05 -0700
commit47bc910a8482d3d2cc882e28e862ca5ad61063b6 (patch)
treeacc75a2892150df5fd0d151d46d8f75caa062504 /backend
parent1c6270ccd67f271968a3ab8a30c29f19548765f0 (diff)
downloaddecky-loader-47bc910a8482d3d2cc882e28e862ca5ad61063b6.tar.gz
decky-loader-47bc910a8482d3d2cc882e28e862ca5ad61063b6.zip
Add functionality to hide plugins from quick access menu (#468)
Diffstat (limited to 'backend')
-rw-r--r--backend/browser.py20
-rw-r--r--backend/locales/en-US.json9
-rw-r--r--backend/settings.py2
3 files changed, 26 insertions, 5 deletions
diff --git a/backend/browser.py b/backend/browser.py
index 388a01e3..ab71a89d 100644
--- a/backend/browser.py
+++ b/backend/browser.py
@@ -122,10 +122,7 @@ class PluginBrowser:
logger.debug("Plugin %s was stopped", name)
del self.plugins[name]
logger.debug("Plugin %s was removed from the dictionary", name)
- current_plugin_order = self.settings.getSetting("pluginOrder")
- current_plugin_order.remove(name)
- self.settings.setSetting("pluginOrder", current_plugin_order)
- logger.debug("Plugin %s was removed from the pluginOrder setting", name)
+ self.cleanup_plugin_settings(name)
logger.debug("removing files %s" % str(name))
rmtree(plugin_dir)
except FileNotFoundError:
@@ -234,3 +231,18 @@ class PluginBrowser:
def cancel_plugin_install(self, request_id):
self.install_requests.pop(request_id)
+
+ def cleanup_plugin_settings(self, name):
+ """Removes any settings related to a plugin. Propably called when a plugin is uninstalled.
+
+ Args:
+ name (string): The name of the plugin
+ """
+ hidden_plugins = self.settings.getSetting("hiddenPlugins", [])
+ hidden_plugins.remove(name)
+ self.settings.setSetting("hiddenPlugins", hidden_plugins)
+
+ plugin_order = self.settings.getSetting("pluginOrder")
+ plugin_order.remove(name)
+ self.settings.setSetting("pluginOrder", plugin_order)
+ logger.debug("Removed any settings for plugin %s", name)
diff --git a/backend/locales/en-US.json b/backend/locales/en-US.json
index a347351b..b5c32957 100644
--- a/backend/locales/en-US.json
+++ b/backend/locales/en-US.json
@@ -17,6 +17,13 @@
"select": "Use this folder"
}
},
+ "PluginView": {
+ "hidden_one": "1 plugin is hidden from this list",
+ "hidden_other": "{{count}} plugins are hidden from this list"
+ },
+ "PluginListLabel": {
+ "hidden": "Hidden from the quick access menu"
+ },
"PluginCard": {
"plugin_full_access": "This plugin has full access to your Steam Deck.",
"plugin_install": "Install",
@@ -73,6 +80,8 @@
"reload": "Reload",
"uninstall": "Uninstall",
"update_to": "Update to {{name}}",
+ "show": "Quick access: Show",
+ "hide": "Quick access: Hide",
"update_all_one": "Update 1 plugin",
"update_all_other": "Update {{count}} plugins"
},
diff --git a/backend/settings.py b/backend/settings.py
index d54ff2b5..c00e6a82 100644
--- a/backend/settings.py
+++ b/backend/settings.py
@@ -22,7 +22,7 @@ class SettingsManager:
for file in listdir(wrong_dir):
if file.endswith(".json"):
rename(path.join(wrong_dir,file),
- path.join(settings_directory, file))
+ path.join(settings_directory, file))
self.path = path.join(settings_directory, name + ".json")