change Toml to tomllib

This commit is contained in:
2024-11-08 08:38:54 +01:00
parent 29228cf65d
commit ca4d8f6b9c

View File

@@ -1,5 +1,5 @@
# This Python file uses the following encoding: utf-8 # This Python file uses the following encoding: utf-8
import toml import tomllib
from platformdirs import user_config_dir from platformdirs import user_config_dir
from pathlib import Path from pathlib import Path
from PySide6.QtCore import QObject, Slot from PySide6.QtCore import QObject, Slot
@@ -23,7 +23,7 @@ class ConfigLoader(QObject):
def setConfig(self, app_config): def setConfig(self, app_config):
try: try:
with open (self.config_dir + '/pyqcrm.toml', 'w') as f: with open (self.config_dir + '/pyqcrm.toml', 'w') as f:
config = Vermasseln().oscarVermasseln(toml.dumps(app_config)) config = Vermasseln().oscarVermasseln(tomllib.dumps(app_config))
f.write(config) f.write(config)
except FileNotFoundError: except FileNotFoundError:
print("Konnte die Konfiguration nicht speichern.") print("Konnte die Konfiguration nicht speichern.")
@@ -33,7 +33,7 @@ class ConfigLoader(QObject):
try: try:
with open (self.config_dir + '/pyqcrm.toml', 'r') as f: with open (self.config_dir + '/pyqcrm.toml', 'r') as f:
config = f.read() config = f.read()
self.__config = toml.loads(Vermasseln().entschluesseln(config)) self.__config = tomllib.loads(Vermasseln().entschluesseln(config))
except FileNotFoundError: except FileNotFoundError:
print("Konnte die Konfiguration nicht laden.") print("Konnte die Konfiguration nicht laden.")