Mehr Pep8 kompatibel

This commit is contained in:
2024-01-18 20:55:54 +01:00
parent f17dc6d1ff
commit d64c7aee42
3 changed files with 103 additions and 98 deletions

View File

@@ -1,5 +1,6 @@
import sqlite3 import sqlite3
def datenbank_erstellen(): def datenbank_erstellen():
try: try:
conn = sqlite3.connect('einsatz.db') conn = sqlite3.connect('einsatz.db')
@@ -33,7 +34,10 @@ def datenbank_erstellen():
finally: finally:
conn.close() 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: try:
conn = sqlite3.connect('einsatz.db') conn = sqlite3.connect('einsatz.db')
cursor = conn.cursor() cursor = conn.cursor()
@@ -61,16 +65,16 @@ def daten_einfuegen(vorname, nachname, strasse, plz, ort, geburtsdatum, geschlec
finally: finally:
conn.close() conn.close()
def main(): def main():
datenbank_erstellen() datenbank_erstellen()
daten_einfuegen( daten_einfuegen(
"Max", "Mustermann", "Musterstraße 123", "12345", "Musterstadt", "Max", "Mustermann", "Musterstraße 123", "12345", "Musterstadt",
"01.01.1990", "männlich", "deutsch", "Deutsches Rotes Kreuz", "01.01.1990", "männlich", "deutsch", "Deutsches Rotes Kreuz",
"01.01.2024", "08:00", "01.01.2024", "17:00", "01.01.2024", "08:00", "01.01.2024", "17:00",
"Sanitäter", "ABC123" "Sanitäter", "ABC123"
) )
if __name__ == '__main__': if __name__ == '__main__':
main() main()

View File

@@ -1,88 +1,88 @@
# Registrierung BY DANIEL SCHLAPA # Registrierung BY DANIEL SCHLAPA
# Bsp. QRCODE: Mustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;; # 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 ;;;;" # qrcode = "ustermann;Max;01.01.1982;m;40000;Musterdorf;deutsch;Musterstrasse;;Düsseldorf;Deutsches Rotes Kreuz ;;;;"
import time import time
import qrcode import qrcode
# print(time.strftime("%d%H%M%b%y")) # print(time.strftime("%d%H%M%b%y"))
# print(time.strftime("%d.%m.%Y %H:%M:%S")) # print(time.strftime("%d.%m.%Y %H:%M:%S"))
""" """
try: try:
<Code, der einen Fehler werfen könnte> <Code, der einen Fehler werfen könnte>
except <Fehlertyp, z.B. ValueError>: except <Fehlertyp, z.B. ValueError>:
<Fehlerbehandlung> <Fehlerbehandlung>
if ';' in string: if ';' in string:
<Mehrere Werte> <Mehrere Werte>
else: else:
<Ein Wert> <Ein Wert>
""" """
def input_code(): def input_code():
scancode = input("Scan den Code: ").strip() scancode = input("Scan den Code: ").strip()
if ';' in scancode: if ';' in scancode:
kompletter_qrcode = scancode kompletter_qrcode = scancode
nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse, helferid, null, hiorg, null, null, null,null = kompletter_qrcode.split(";") nachname, vorname, geburtsdatum, geschlecht, plz, ort, nationalitaet, strasse, helferid, null, hiorg, null, null, null, null = kompletter_qrcode.split(";")
kompletter_name = nachname + ", " + vorname kompletter_name = nachname + ", " + vorname
print("AUSGABE DER DATEN") print("AUSGABE DER DATEN")
print("-----------------\n") print("-----------------\n")
print("Kompletter Name: " + kompletter_name) print(f"Kompletter Name: {kompletter_name}")
print("Vorname: " + vorname) print("Vorname: " + vorname)
print("Nachname: " + nachname) print("Nachname: " + nachname)
print("Straße: " + strasse) print("Straße: " + strasse)
print("Postleitzzahl + Ort: " + plz + " " + ort) print(f"Postleitzzahl + Ort: {plz} {ort}")
print("Geburtsdatum: " + geburtsdatum) print("Geburtsdatum: " + geburtsdatum)
print("Geschlecht: " + geschlecht) print("Geschlecht: " + geschlecht)
print("Nationalität: " + nationalitaet) print("Nationalität: " + nationalitaet)
print("Hilfsorganisation: " + hiorg) print("Hilfsorganisation: " + hiorg)
start_datum = time.strftime("%d.%m.%Y") start_datum = time.strftime("%d.%m.%Y")
start_uhrzeit = time.strftime("%H:%M:%S") start_uhrzeit = time.strftime("%H:%M:%S")
print (start_datum + " " + start_uhrzeit) print(start_datum + " " + start_uhrzeit)
else: else:
print("Code: " + scancode) print("Code: " + scancode)
def make_qrcode():
dateinname_qrcode = input("Dateiname: ").strip() def make_qrcode():
img = qrcode.make('Daniel') dateinname_qrcode = input("Dateiname: ").strip()
type(img) img = qrcode.make('Daniel')
img.save(dateinname_qrcode + ".png") img.save(dateinname_qrcode + ".png")
print("QR-Code " + dateinname_qrcode + ".png" + " wurde erstellt.") print("QR-Code " + dateinname_qrcode + ".png" + " wurde erstellt.")
def main():
print("""Menü def main():
---- print("""Menü
[1] - Einregistrieren ----
[2] - Ausregistrieren [1] - Einregistrieren
[2] - Ausregistrieren
[3] - QR-Code erstellen
[3] - QR-Code erstellen
[4] - Test
[4] - Test
[5] - Ende""")
[5] - Ende""")
while True:
menu_auswahl = int(input("Menüpunkt: ")) while True:
menu_auswahl = int(input("Menüpunkt: "))
if (menu_auswahl == 1):
input_code() if (menu_auswahl == 1):
elif (menu_auswahl == 2): input_code()
print("SORRY - 2") elif (menu_auswahl == 2):
elif (menu_auswahl == 3): print("SORRY - 2")
make_qrcode() elif (menu_auswahl == 3):
elif (menu_auswahl == 4): make_qrcode()
print("SORRY - 4") elif (menu_auswahl == 4):
elif (menu_auswahl == 5): print("SORRY - 4")
return elif (menu_auswahl == 5):
else: return
print("Auswahl ist ungültig!") else:
print("Auswahl ist ungültig!")
if __name__ == '__main__':
main() if __name__ == '__main__':
main()

View File

@@ -1,8 +1,8 @@
import openpyxl import openpyxl
from openpyxl.styles import Font from openpyxl.styles import Font
def make_tabellen_ueberschrift():
def make_tabellen_ueberschrift():
workbook = openpyxl.Workbook() workbook = openpyxl.Workbook()
tabelle1 = workbook.active tabelle1 = workbook.active
@@ -29,9 +29,10 @@ def make_tabellen_ueberschrift():
workbook.save('Registrierliste.xlsx') workbook.save('Registrierliste.xlsx')
def main():
def main():
make_tabellen_ueberschrift() make_tabellen_ueberschrift()
if __name__ == '__main__': if __name__ == '__main__':
main() main()