Add write capability to `ConfigManager` using `tomli_w`

- Introduced `set_data_dict` method to update configuration data.
- Added `write_config` method to generate default config structure for writing.
This commit is contained in:
Gustavo Henrique Santos Souza de Miranda 2025-10-30 18:09:44 -03:00
parent b2e80a8c07
commit e8d5159973
1 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,7 @@
import os.path
import tomli
import tomli_w
from metar_navigate.utils import DirectoryManager
@ -38,4 +39,18 @@ class ConfigManager(metaclass=SingletonMeta):
else:
return None
def set_data_dict(self,data):
self.__data.update(data)
def write_config(self):
default = {
"checkwx_api_key": "",
"always_show_detailed": False,
"wind_speed_unit": "Keep",
"temp_unit": "Keep",
"visibility_unit": "Keep",
"pressure_unit": "Keep"
}