Skip to content

Commit

Permalink
Sort room/channel mappings by channel #
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-k committed Apr 28, 2023
1 parent a72e2de commit 7e312a0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gui/config_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]
Expand Down

0 comments on commit 7e312a0

Please sign in to comment.