initial commit after move from prozesse
This commit is contained in:
commit
b1369f900b
3 changed files with 115 additions and 0 deletions
75
edit_data_form.py
Executable file
75
edit_data_form.py
Executable file
|
@ -0,0 +1,75 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
# encoding: utf-8
|
||||||
|
|
||||||
|
import npyscreen
|
||||||
|
import json
|
||||||
|
from sys import argv
|
||||||
|
|
||||||
|
|
||||||
|
class FormApp(npyscreen.NPSAppManaged):
|
||||||
|
def __init__(self, member_struct):
|
||||||
|
super().__init__()
|
||||||
|
self.member = member_struct
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
f = npyscreen.Form(name='Edit Member data')
|
||||||
|
|
||||||
|
sd = self.member['stammdaten']
|
||||||
|
sd.fn = f.add(npyscreen.TitleText, name="Name: ", value=sd['fullname'])
|
||||||
|
sd.nick = f.add(npyscreen.TitleText, name="Nickname: ",
|
||||||
|
value=sd['nickname'])
|
||||||
|
sd.add.street = f.add(
|
||||||
|
npyscreen.TitleText, name="Adresse - Straße: ", value=sd['address']['street'])
|
||||||
|
sd.add.loc = f.add(
|
||||||
|
npyscreen.TitleText, name="Adresse - Stadt: ", value=sd['address']['locality'])
|
||||||
|
sd.add.code = f.add(npyscreen.TitleText,
|
||||||
|
name="Adresse - PLZ: ", value=sd['address']['code'])
|
||||||
|
sd.add.country = f.add(
|
||||||
|
npyscreen.TitleText, name="Adresse - Land: ", value=sd['address']['country'])
|
||||||
|
sd.birth.date = f.add(npyscreen.TitleText,
|
||||||
|
name="Geburtstag: ", value=sd['birth']['date'])
|
||||||
|
sd.birth.locality = f.add(
|
||||||
|
npyscreen.TitleText, name="Geburtsort: ", value=sd['birth']['location'])
|
||||||
|
sd.email = f.add(npyscreen.TitleText,
|
||||||
|
name="email: ", value=sd['email'])
|
||||||
|
sd.pgp = f.add(npyscreen.TitleText, name="URI PGP Key: ", value=sd['pgp-key'])
|
||||||
|
sd.ssh = f.add(npyscreen.TitleText, name="URI SSH Key: ", value=sd['ssh-key'])
|
||||||
|
|
||||||
|
fin = self.member['finanzdaten']
|
||||||
|
f.add(npyscreen.TitleText, name="IBAN: ", value=fin['iban'])
|
||||||
|
f.add(npyscreen.TitleText, name="BIC: ", value=fin['bic'])
|
||||||
|
f.add(npyscreen.TitleText, name="Kontoinhaber: ", value=fin['holder'])
|
||||||
|
f.add(npyscreen.TitleText, name="Tag der Erteilung Lastschriftmandat: ",
|
||||||
|
value=fin['issuance'])
|
||||||
|
f.add(npyscreen.TitleText, name="Mandatsreferenznummer: ",
|
||||||
|
value=fin['reference'])
|
||||||
|
f.add(npyscreen.TitleText, name="URI Scan SEPA-Mandat: ",
|
||||||
|
value=fin['scan-sepa-mandate'])
|
||||||
|
|
||||||
|
mem = self.member['mitgliederdaten']
|
||||||
|
f.add(npyscreen.TitleText, name="Status: ", value=mem['status'])
|
||||||
|
f.add(npyscreen.TitleText, name="Von: ", value=mem['von'])
|
||||||
|
f.add(npyscreen.TitleText, name="Bis: ", value=mem['bis'])
|
||||||
|
f.add(npyscreen.TitleText, name="Mitgliedsbeitrag: ",
|
||||||
|
value=mem['mitgliedsbeitrag'])
|
||||||
|
f.add(npyscreen.TitleText, name="Schliessberechtigung: ",
|
||||||
|
value=mem['schliessberechtigung'])
|
||||||
|
f.add(npyscreen.TitleText, name="URI Scan Antrag: ",
|
||||||
|
value=mem['scan-antrag'])
|
||||||
|
|
||||||
|
f.edit()
|
||||||
|
|
||||||
|
|
||||||
|
def main(*_args):
|
||||||
|
if len(argv) > 1:
|
||||||
|
member_struct = json.load(open(argv[1], 'r'))
|
||||||
|
else:
|
||||||
|
member_struct = json.load(open('example.json', 'r'))
|
||||||
|
app = FormApp(member_struct)
|
||||||
|
app.run()
|
||||||
|
with open('foo.json', 'w') as outfile:
|
||||||
|
json.dump(app.member, outfile, sort_keys=True, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
npyscreen.wrapper_basic(main)
|
39
example.json
Normal file
39
example.json
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
{
|
||||||
|
"timestamp": "",
|
||||||
|
"stammdaten": {
|
||||||
|
"fullname": "Max Hackerberg",
|
||||||
|
"nickname": "maxH",
|
||||||
|
"address" : {
|
||||||
|
"label": "Max Hackerberg\nLeibnizstr. 32\n39104 Magdeburg",
|
||||||
|
"street": "Leibnizstr. 32",
|
||||||
|
"locality": "Magdeburg",
|
||||||
|
"region": "",
|
||||||
|
"code": "39104",
|
||||||
|
"country": "DE"
|
||||||
|
},
|
||||||
|
"birth": {
|
||||||
|
"date": "1972-02-03",
|
||||||
|
"location": "Magdeburg"
|
||||||
|
},
|
||||||
|
"email": "max.hackerberg@netz39.de",
|
||||||
|
"pgp-key": "https://cdn.netz39.de/maxH.asc",
|
||||||
|
"ssh-key": "https://cdn.netz39.de/maxH.pub"
|
||||||
|
},
|
||||||
|
"finanzdaten": {
|
||||||
|
"iban": "",
|
||||||
|
"bic": "",
|
||||||
|
"holder": "",
|
||||||
|
"issuance": "",
|
||||||
|
"reference": "",
|
||||||
|
"scan-sepa-mandate": ""
|
||||||
|
},
|
||||||
|
"mitgliederdaten": {
|
||||||
|
"status": "",
|
||||||
|
"von": "",
|
||||||
|
"bis": "",
|
||||||
|
"mitgliedsbeitrag": "",
|
||||||
|
"spendenbeitrag": "",
|
||||||
|
"schliessberechtigung": "",
|
||||||
|
"scan-antrag": ""
|
||||||
|
}
|
||||||
|
}
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
npyscreen==4.10.5
|
Loading…
Reference in a new issue