diff --git a/.gitignore b/.gitignore index e7edb51d..fcda29f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .idea/ .vscode/ __pycache__/ +venv/ *.DS_Store @@ -8,8 +9,7 @@ __pycache__/ log/ # data -kontaktdaten.json -zeitspanne.json +data/*.json #building: installer/ diff --git a/gui.py b/gui.py index 701cc87a..5080e2d1 100644 --- a/gui.py +++ b/gui.py @@ -59,7 +59,6 @@ def __init__(self, pfad_fenster_layout: str = os.path.join(PATH, "tools/gui/main # Laden der .ui Datei und Anpassungen self.setup(pfad_fenster_layout) - # GUI anzeigen self.show() @@ -82,6 +81,14 @@ def start_gui(): app = QtWidgets.QApplication(list()) app.setAttribute(QtCore.Qt.AA_X11InitThreads) + + # Lade Systemsprache und passende Übersetzungen + sys_lang = QtCore.QLocale.system() + translator = QtCore.QTranslator() + if translator.load(sys_lang, "qtbase", "_", QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath)): + app.installTranslator(translator) + + window = HauptGUI() app.exec_() diff --git a/tools/gui/qtkontakt.py b/tools/gui/qtkontakt.py index 7266aaf6..473216e8 100644 --- a/tools/gui/qtkontakt.py +++ b/tools/gui/qtkontakt.py @@ -1,7 +1,7 @@ import os from PyQt5 import QtWidgets, uic -from PyQt5.QtCore import QTime, QDate, QDateTime, pyqtSignal +from PyQt5.QtCore import QEvent, QTime, QDate, QDateTime, pyqtSignal from PyQt5.QtGui import QIcon from tools.gui import * @@ -15,6 +15,10 @@ ### QLineEdit #### # i_plz_impfzentren # i_code_impfzentren +# i_code_impfzentren_2 +# i_code_impfzentren_3 +# i_code_impfzentren_4 +# i_code_impfzentren_5 # i_vorname # i_nachname # i_strasse @@ -54,6 +58,7 @@ ### QWidget ### # kontaktdaten_tab # zeitrahmen_tab +# vermittlungscodes_tab ### Buttons ### # b_impfzentren_waehlen @@ -91,6 +96,37 @@ def __init__(self, parent: QtWidgets.QWidget, modus: Modus, standard_speicherpfa # Wähle ersten Reiter aus self.tabWidget.setCurrentIndex(0) + # Erstelle Events für LineEdits + for line_edit in self.vermittlungscodes_tab.findChildren(QtWidgets.QLineEdit): + line_edit.installEventFilter(self) + + self.i_plz_wohnort.installEventFilter(self) + + def eventFilter(self, source: QtWidgets, event: QEvent) -> bool: + """ + Filtert Events (z.B. Eingabe in QLineEdit) um auf diese zu reagieren + + Args: + source: Quelle des Events + event: Art des Events + + Returns: + bool: Eventverarbeitung stopen + + """ + + if source in self.vermittlungscodes_tab.findChildren(QtWidgets.QLineEdit): + if event.type() == QEvent.KeyPress and source.text() == '--': + source.setCursorPosition(0) + return False + + if source == self.i_plz_wohnort: + if event.type() == QEvent.KeyPress and source.text() == '': + source.setCursorPosition(0) + return False + + return False + def setup(self): """ Aktiviert abhänig vom Modus die Eingabefelder