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:
parent
b2e80a8c07
commit
e8d5159973
|
|
@ -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"
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue