Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Kontaktdaten GUI): fix for pressing Cancel Btn in Kontaktdaten GUI raised error #436

Merged
merged 6 commits into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,24 @@ def __check_old_kontakt_version(self, kontaktdaten: dict = None) -> bool:
# Kontaktdaten #
##############################

def kontaktdaten_erstellen(self, modus: Modus = Modus.TERMIN_SUCHEN):
def kontaktdaten_erstellen(self, modus: Modus = Modus.TERMIN_SUCHEN) -> bool:
IAmWebSA marked this conversation as resolved.
Show resolved Hide resolved
"""
Ruft den Dialog für die Kontaktdaten auf

Args:
modus (Modus): Abhängig vom Modus werden nicht alle Daten benötigt. Defalut TERMIN_SUCHEN

Returns:
bool: True bei Erfolg, False bei Abbruch
"""

dialog = QtKontakt(self, modus, self.pfad_kontaktdaten, PATH)
dialog.update_path.connect(self.__update_kontaktdaten_pfad)
dialog.show()
dialog.exec_()
if dialog.exec_() == QtWidgets.QDialog.Rejected:
return False
else:
return True

def __get_kontaktdaten(self, modus: Modus) -> dict:
"""
Expand All @@ -401,9 +407,9 @@ def __get_kontaktdaten(self, modus: Modus) -> dict:
Returns:
dict: Kontakdaten
"""

if not os.path.isfile(self.pfad_kontaktdaten):
self.kontaktdaten_erstellen(modus)
if not self.kontaktdaten_erstellen(modus):
return {}

kontaktdaten = kontak_tools.get_kontaktdaten(self.pfad_kontaktdaten)
kontak_tools.check_kontaktdaten(kontaktdaten, modus)
Expand Down
4 changes: 2 additions & 2 deletions tools/gui/qtkontakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ def bestaetigt(self):
self.update_path.emit(speicherpfad)

# Fenster schließen
self.close()
self.accept()

except (TypeError, IOError, FileNotFoundError) as error:
QtWidgets.QMessageBox.critical(self, "Fehler beim Speichern!", "Bitte erneut versuchen!")
Expand Down Expand Up @@ -206,7 +206,7 @@ def __button_box_clicked(self, button: QtWidgets.QPushButton):
self.__reset_zeitrahmen()
self.__lade_einstellungen()
elif clicked_button == QtWidgets.QDialogButtonBox.Cancel:
self.close()
self.reject()

def __get_alle_werte(self) -> dict:
"""
Expand Down