diff options
| author | Debulois Quentin <quentin.debulois@gmail.com> | 2020-09-17 08:40:49 +0200 |
|---|---|---|
| committer | Debulois Quentin <quentin.debulois@gmail.com> | 2020-09-17 08:40:49 +0200 |
| commit | 1050e54ea530326fb4288a56c3e2ee4781f569b5 (patch) | |
| tree | 32c09ddc78591d093092c5a17081c0ed2ff14027 /Redim/config.py | |
| parent | 7e375df5b11da3175b2e173e3ef40667b0d28f06 (diff) | |
Création de fichier en vu de la POO (convertisseur & config)
Diffstat (limited to 'Redim/config.py')
| -rw-r--r-- | Redim/config.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Redim/config.py b/Redim/config.py new file mode 100644 index 0000000..2634ded --- /dev/null +++ b/Redim/config.py @@ -0,0 +1,25 @@ +import json + +class config(): + def sauvegarde(json_path, largeur1, hauteur1, largeur2, hauteur2, background_color, format_final): + dictionnaire = { + "dimensions" : [[largeur1, hauteur1], [largeur2,hauteur2]], + "background_color" : background_color, + "format_final" : format_final + } + if not isdir(json_path): + mkdir(json_path) + with open(join(json_path, "config_redim"), "w") as f: + json.dump(dictionnaire, f) + + def lecture(json_path): + with open(join(json_path, "config_redim"), "r") as f: + dictionnaire = json.load(f) + largeur1 = dictionnaire["dimensions"][0][0] + hauteur1 = dictionnaire["dimensions"][0][1] + largeur2 = dictionnaire["dimensions"][1][0] + hauteur2 = dictionnaire["dimensions"][1][1] + background_color = dictionnaire["background_color"] + format_final = dictionnaire["format_final"] + return largeur1, hauteur1, largeur2, hauteur2, background_color, format_final + |
