out-of-dir-files #13

Merged
tux merged 3 commits from out-of-dir-files into master 2020-03-18 21:37:00 +01:00
Showing only changes of commit 1989d432d9 - Show all commits

View file

@ -5,7 +5,7 @@ import npyscreen
import json
import datetime
from sys import argv
from pathlib import Path
import pathlib
from base_data_model import base_data_model
from financial_data_model import financial_data_model
@ -16,7 +16,7 @@ class FormApp(npyscreen.NPSAppManaged):
def __init__(self, filename):
super().__init__()
self.dir_path = Path(filename).absolute().parent
self.dir_path = pathlib.Path(filename).absolute().parent
self.member = json.load(open(filename, 'r'))
self.base_data = base_data_model(self.member['stammdaten'])
@ -46,7 +46,7 @@ class FormApp(npyscreen.NPSAppManaged):
def get_filepath(self):
name = self.base_data.get_form_values_dict()['fullname']
fn = '{}_{}.json'.format('_'.join(name.split()), datetime.datetime.now().replace(microsecond=0).isoformat())
file_path = Path(self.dir_path, fn)
file_path = pathlib.Path(self.dir_path, fn)
return file_path
@ -54,7 +54,7 @@ def main(*_args):
if len(argv) > 1:
filename = argv[1]
else:
filename = Path(Path(__file__).absolute().parent, 'example.json')
filename = pathlib.Path(pathlib.Path(__file__).absolute().parent, 'example.json')
app = FormApp(filename)