From 7e312a0159a6bcbe60523cab30529c6da5941564 Mon Sep 17 00:00:00 2001 From: Jeremiah K Date: Fri, 28 Apr 2023 14:21:47 -0500 Subject: [PATCH] Sort room/channel mappings by channel # --- gui/config_editor.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/config_editor.py b/gui/config_editor.py index 6c42bba..7994ca7 100644 --- a/gui/config_editor.py +++ b/gui/config_editor.py @@ -208,7 +208,7 @@ def save_config(config): def apply_changes(): - #Check if config is valid + # Check if config is valid if not validate_config(): return @@ -226,8 +226,8 @@ def apply_changes(): meshtastic_channel = room_frame.meshtastic_channel_var.get() config["matrix_rooms"].append({"id": room_id, "meshtastic_channel": int(meshtastic_channel)}) - # Add updated matrix_rooms to new_config - new_config["matrix_rooms"] = config["matrix_rooms"] + # Sort matrix_rooms by meshtastic_channel and add to new_config + new_config["matrix_rooms"] = sorted(config["matrix_rooms"], key=lambda x: x["meshtastic_channel"]) new_config["logging"] = config["logging"] new_config["plugins"] = config["plugins"]