mirror of
https://github.com/liamcottle/reticulum-meshchat.git
synced 2026-11-20 06:56:20 -05:00
refactor updating of interface settings to allow removing values when saving an existing interface
This commit is contained in:
parent
33e4888737
commit
734eaeed1b
3 changed files with 137 additions and 142 deletions
14
src/backend/interface_editor.py
Normal file
14
src/backend/interface_editor.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
class InterfaceEditor:
|
||||
|
||||
@staticmethod
|
||||
def update_value(interface_details: dict, data: dict, key: str):
|
||||
|
||||
# update value if provided and not empty
|
||||
value = data.get(key)
|
||||
if value is not None and value != "":
|
||||
interface_details[key] = value
|
||||
return
|
||||
|
||||
# otherwise remove existing value
|
||||
if key in interface_details:
|
||||
del interface_details[key]
|
||||
Loading…
Add table
Add a link
Reference in a new issue