From d64c7aee42fb0f14d274d0bbb0a36388797b60ff Mon Sep 17 00:00:00 2001 From: Michael Schlapa Date: Thu, 18 Jan 2024 20:55:54 +0100 Subject: [PATCH] Mehr Pep8 kompatibel --- Datenbank.py | 18 +++-- Registrierung.py | 176 +++++++++++++++++++++++------------------------ Tabelle.py | 7 +- 3 files changed, 103 insertions(+), 98 deletions(-) diff --git a/Datenbank.py b/Datenbank.py index 46fd862..4871f10 100644 --- a/Datenbank.py +++ b/Datenbank.py @@ -1,5 +1,6 @@ import sqlite3 - + + def datenbank_erstellen(): try: conn = sqlite3.connect('einsatz.db') @@ -33,7 +34,10 @@ def datenbank_erstellen(): finally: conn.close() -def daten_einfuegen(vorname, nachname, strasse, plz, ort, geburtsdatum, geschlecht, nationalitaet, hiorg, start_datum, start_uhrzeit, ende_datum, ende_uhrzeit, position, qrcode): + +def daten_einfuegen( + vorname, nachname, strasse, plz, ort, geburtsdatum, geschlecht, nationalitaet, hiorg, start_datum, + start_uhrzeit, ende_datum, ende_uhrzeit, position, qrcode): try: conn = sqlite3.connect('einsatz.db') cursor = conn.cursor() @@ -61,16 +65,16 @@ def daten_einfuegen(vorname, nachname, strasse, plz, ort, geburtsdatum, geschlec finally: conn.close() + def main(): datenbank_erstellen() daten_einfuegen( - "Max", "Mustermann", "Musterstraße 123", "12345", "Musterstadt", - "01.01.1990", "männlich", "deutsch", "Deutsches Rotes Kreuz", - "01.01.2024", "08:00", "01.01.2024", "17:00", + "Max", "Mustermann", "Musterstraße 123", "12345", "Musterstadt", + "01.01.1990", "männlich", "deutsch", "Deutsches Rotes Kreuz", + "01.01.2024", "08:00", "01.01.2024", "17:00", "Sanitäter", "ABC123" ) + if __name__ == '__main__': main() - - \ No newline at end of file diff --git a/Registrierung.py b/Registrierung.py index bdc413c..235a38b 100644 --- a/Registrierung.py +++ b/Registrierung.py @@ -1,88 +1,88 @@ -# Registrierung BY DANIEL SCHLAPA - -# Bsp. QRCODE: Mustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;; -# qrcode = "ustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;;" - -import time -import qrcode - -# print(time.strftime("%d%H%M%b%y")) -# print(time.strftime("%d.%m.%Y %H:%M:%S")) - -""" -try: - -except : - - -if ';' in string: - -else: - -""" - - -def input_code(): - scancode = input("Scan den Code: ").strip() - - if ';' in scancode: - kompletter_qrcode = scancode - nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse, helferid, null, hiorg, null, null, null,null = kompletter_qrcode.split(";") - kompletter_name = nachname + ", " + vorname - - print("AUSGABE DER DATEN") - print("-----------------\n") - print("Kompletter Name: " + kompletter_name) - print("Vorname: " + vorname) - print("Nachname: " + nachname) - print("Straße: " + strasse) - print("Postleitzzahl + Ort: " + plz + " " + ort) - print("Geburtsdatum: " + geburtsdatum) - print("Geschlecht: " + geschlecht) - print("Nationalität: " + nationalitaet) - print("Hilfsorganisation: " + hiorg) - start_datum = time.strftime("%d.%m.%Y") - start_uhrzeit = time.strftime("%H:%M:%S") - print (start_datum + " " + start_uhrzeit) - else: - print("Code: " + scancode) - -def make_qrcode(): - dateinname_qrcode = input("Dateiname: ").strip() - img = qrcode.make('Daniel') - type(img) - img.save(dateinname_qrcode + ".png") - print("QR-Code " + dateinname_qrcode + ".png" + " wurde erstellt.") - -def main(): - print("""Menü ----- -[1] - Einregistrieren -[2] - Ausregistrieren - -[3] - QR-Code erstellen - -[4] - Test - -[5] - Ende""") - - while True: - menu_auswahl = int(input("Menüpunkt: ")) - - if (menu_auswahl == 1): - input_code() - elif (menu_auswahl == 2): - print("SORRY - 2") - elif (menu_auswahl == 3): - make_qrcode() - elif (menu_auswahl == 4): - print("SORRY - 4") - elif (menu_auswahl == 5): - return - else: - print("Auswahl ist ungültig!") - - -if __name__ == '__main__': - main() - \ No newline at end of file +# Registrierung BY DANIEL SCHLAPA + +# Bsp. QRCODE: Mustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;; +# qrcode = "ustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;;" + +import time +import qrcode + +# print(time.strftime("%d%H%M%b%y")) +# print(time.strftime("%d.%m.%Y %H:%M:%S")) + +""" +try: + +except : + + +if ';' in string: + +else: + +""" + + +def input_code(): + scancode = input("Scan den Code: ").strip() + + if ';' in scancode: + kompletter_qrcode = scancode + nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse, helferid, null, hiorg, null, null, null, null = kompletter_qrcode.split(";") + kompletter_name = nachname + ", " + vorname + + print("AUSGABE DER DATEN") + print("-----------------\n") + print(f"Kompletter Name: {kompletter_name}") + print("Vorname: " + vorname) + print("Nachname: " + nachname) + print("Straße: " + strasse) + print(f"Postleitzzahl + Ort: {plz} {ort}") + print("Geburtsdatum: " + geburtsdatum) + print("Geschlecht: " + geschlecht) + print("Nationalität: " + nationalitaet) + print("Hilfsorganisation: " + hiorg) + start_datum = time.strftime("%d.%m.%Y") + start_uhrzeit = time.strftime("%H:%M:%S") + print(start_datum + " " + start_uhrzeit) + else: + print("Code: " + scancode) + + +def make_qrcode(): + dateinname_qrcode = input("Dateiname: ").strip() + img = qrcode.make('Daniel') + img.save(dateinname_qrcode + ".png") + print("QR-Code " + dateinname_qrcode + ".png" + " wurde erstellt.") + + +def main(): + print("""Menü +---- +[1] - Einregistrieren +[2] - Ausregistrieren + +[3] - QR-Code erstellen + +[4] - Test + +[5] - Ende""") + + while True: + menu_auswahl = int(input("Menüpunkt: ")) + + if (menu_auswahl == 1): + input_code() + elif (menu_auswahl == 2): + print("SORRY - 2") + elif (menu_auswahl == 3): + make_qrcode() + elif (menu_auswahl == 4): + print("SORRY - 4") + elif (menu_auswahl == 5): + return + else: + print("Auswahl ist ungültig!") + + +if __name__ == '__main__': + main() diff --git a/Tabelle.py b/Tabelle.py index c60345e..755a2b9 100644 --- a/Tabelle.py +++ b/Tabelle.py @@ -1,8 +1,8 @@ import openpyxl from openpyxl.styles import Font -def make_tabellen_ueberschrift(): +def make_tabellen_ueberschrift(): workbook = openpyxl.Workbook() tabelle1 = workbook.active @@ -29,9 +29,10 @@ def make_tabellen_ueberschrift(): workbook.save('Registrierliste.xlsx') -def main(): +def main(): make_tabellen_ueberschrift() + if __name__ == '__main__': - main() \ No newline at end of file + main()