Skip to content
This repository has been archived by the owner on Jul 9, 2024. It is now read-only.

Commit

Permalink
fix(PR #480 crahsed GUI): added selenium code generation to GUI (#486)
Browse files Browse the repository at this point in the history
* Draft for Code gen over GUI

first draft for running Code Gen over GUI

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update qtcodegen.py

* Thread cancel optimization

break while loops if stop called

* update now checking missing kontakt data

showing dialog to generate kontaktdaten if not present

* remove help icon

* added  CodeGEn Checkbox to Kontaktdaten

for now it just simply adds a XXXX dummy code to prevent code validation error (since it is not yet known )

* Update qtcodegen.py

* Update qtcodegen.py

* Revert "added  CodeGEn Checkbox to Kontaktdaten"

This reverts commit 3bf7b6f.

* added QtCodeGen to SubProcess

added QtCodeGen to SubProcess  because Impfterminservice is blocking  the Thread for termination

* adapted to mainline beta and further improvements

READY to TEST

* Update main.py

* Update utils.py

* Update qtcodegen.py

hard exit if cancelled

* Revert "Update main.py"

This reverts commit 8f082c5.

* file permission fix

git update-index --chmod=+x main.py under windows

* File permissin change revert

* Update gui.py

small rearrangment

* Update tools/gui/qtcodegen.py

THX

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* keep all data kontaktdaten.json and just set a dummy code for code gen task

Rework to keep all data in kontaktdaten.json and just set a dummy code for code gen task if not file is present.

Also added checks if kontaktdaten edit fenster was cancelled to not run processes.

Also do a full validation check on input also if mode CODE_GENERIEREN, to have a valid config file

* Update gui.py

Co-authored-by: Florian Glaser <[email protected]>

* Update tools/gui/qtcodegen.py

Co-authored-by: Florian Glaser <[email protected]>

* Update gui.py

Co-authored-by: Florian Glaser <[email protected]>

* Update qtkontakt.py

changes from @Floskinner  added

* Revert "Merge branch 'beta' into ownBeta"

This reverts commit cb67518, reversing
changes made to 7e719ec.

* Revert "Revert "Merge branch 'beta' into ownBeta""

This reverts commit fe4d9f5.

* logger conflicts with redirect of qtgui

* added fix from TIm Reibe

* Added 3 Input Dlg retries if SMS PIN  was wrong

Change allows a wrong input of smspin and if code failed to accept the pin will be asked again

* Fix for keyerror in GUI (Kontaktdaten bearbeiten) with old file

tools\gui\qtkontakt.py", line 362, in __lade_alle_werte
    if kontaktdaten['notifications']:
KeyError: 'notifications'

* fix(PR #480 crahsed GUI)

Merged changes to GUI from : #480

Co-authored-by: Florian Glaser <[email protected]>
  • Loading branch information
IAmWebSA and Floskinner authored Jun 16, 2021
1 parent e156ad9 commit 9e1f5f0
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions tools/gui/qtcodegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def __init__(self, kontaktdaten: dict, ROOT_PATH: str):
self.plz_impfzentrum = ""
self.mail = ""
self.telefonnummer = ""
self.sms_pin = ""

# connect to signals
self.signalUpdateData.connect(self.updateData)
Expand Down Expand Up @@ -92,9 +91,6 @@ def updateData(self, strmode, txt):
if strmode == "GEBURTSDATUM":
print(txt)
self.geburtsdatum = txt
elif strmode == "SMSCODE":
print(txt)
self.sms_pin = txt

self.signalGot = True
return True
Expand Down Expand Up @@ -125,9 +121,11 @@ def code_gen(self):
if self.stopped is True:
return False

# code anfordern
# code anfordern via selenium
try:
token, cookies = its.code_anfordern(self.mail, self.telefonnummer, self.plz_impfzentrum, self.geburtsdatum)
if its.selenium_code_anfordern(self.mail, self.telefonnummer, self.plz_impfzentrum, self.geburtsdatum):
self.sendSignalAndWait("signalShowInput","SMSCODE_OK")
return True
except RuntimeError as exc:
print(
f"\nDie Code-Generierung war leider nicht erfolgreich:\n{str(exc)}")
Expand All @@ -136,18 +134,6 @@ def code_gen(self):
QtCore.QThread.msleep(100)
return False

# code bestätigen
# allow 3 retries
for _ in range(3):
if self.stopped is False:
self.sendSignalAndWait("signalShowInput","SMSCODE")
if its.code_bestaetigen(token, cookies, self.sms_pin, self.plz_impfzentrum):
self.sendSignalAndWait("signalShowInput","SMSCODE_OK")
return True
else:
return False

print("\nSMS-Code ungültig")
print("Die Code-Generierung war leider nicht erfolgreich.")

self.signalShowDlg.emit("CRITICAL_CLOSE",f"SMS-Code ungültig.\n\nDie Code-Generierung war leider nicht erfolgreich")
Expand Down Expand Up @@ -257,16 +243,7 @@ def showInputDlg(self, dlgType):
break
except ValidationError as exc:
QtWidgets.QMessageBox.critical(self, "Geburtsdatum ungültiges Format", "Das Datum entspricht nicht dem richtigen Format (DD.MM.YYYY).")
elif dlgType == "SMSCODE":
text, ok = QtWidgets.QInputDialog.getText(self, 'SMS Code',
'Du erhältst gleich eine SMS mit einem Code zur Bestätigung deiner Telefonnummer\n'
'Bitte trage nachfolgend den SMS-Code ein.\n'
'Beispiel: 551-550\n')
if ok:
sms_pin = str(text).replace("-", "")
self.worker.signalUpdateData.emit("SMSCODE",sms_pin)
else:
self.hardClose()

elif dlgType == "SMSCODE_OK":
ret = QtWidgets.QMessageBox.information(self, "Erfolgreich", "Code erfolgreich generiert. Du kannst jetzt mit der Terminsuche fortfahren.",QMessageBox.StandardButton.Ok)
if ret == QMessageBox.StandardButton.Ok:
Expand Down

0 comments on commit 9e1f5f0

Please sign in to comment.