From c0b5c2ee29373f5bca9cfa1708664b3903291315 Mon Sep 17 00:00:00 2001 From: Storm Dragon Date: Sat, 29 Jun 2024 19:00:36 -0400 Subject: [PATCH] Menu categories should now display in alphabetical order. --- scripts/menu.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/menu.py b/scripts/menu.py index 6863b6b..10a5e3b 100755 --- a/scripts/menu.py +++ b/scripts/menu.py @@ -10,7 +10,6 @@ # You should have received a copy of the GNU General Public License along with I38. If not, see . - import os import configparser from pathlib import Path @@ -99,7 +98,7 @@ for entry in desktop_entries: except configparser.NoOptionError: continue -class XdgMenuWindow(Gtk.Window): +class Xdg_Menu_Window(Gtk.Window): def __init__(self): super().__init__(title="I38 Menu") self.set_default_size(400, 300) @@ -107,7 +106,9 @@ class XdgMenuWindow(Gtk.Window): self.store = Gtk.TreeStore(str, str) # Columns: Category/Application Name, Exec Command - for category, entries in categories.items(): + sorted_categories = sorted(categories.items()) # Sort categories alphabetically + + for category, entries in sorted_categories: if category == "": continue category_iter = self.store.append(parent=None, row=[category, None]) @@ -160,7 +161,7 @@ class XdgMenuWindow(Gtk.Window): else: self.treeview.collapse_row(path) -win = XdgMenuWindow() +win = Xdg_Menu_Window() win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main()