Skip to content

Instantly share code, notes, and snippets.

@JosephKiranBabu
Last active February 26, 2018 05:39
Show Gist options
  • Save JosephKiranBabu/3d16d90808016e6e987cf97255ff719e to your computer and use it in GitHub Desktop.
Save JosephKiranBabu/3d16d90808016e6e987cf97255ff719e to your computer and use it in GitHub Desktop.
Changes to add all shortcuts to Plinth home page
diff --git a/plinth/frontpage.py b/plinth/frontpage.py
index d50a8a7..786bbcf 100644
--- a/plinth/frontpage.py
+++ b/plinth/frontpage.py
@@ -22,8 +22,20 @@ Manage application shortcuts on front page.
shortcuts = {}
+def add_all_shortcuts():
+ from plinth import module_loader
+ import importlib
+ for mod_path in module_loader.get_modules_to_load():
+ try:
+ module = importlib.import_module(mod_path)
+ module.add_shortcut()
+ except Exception as exception:
+ print('idgaf')
+
+
def get_shortcuts():
"""Return menu items in sorted order according to current locale."""
+ add_all_shortcuts()
return sorted(shortcuts.values(), key=lambda item: item['label'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment