Skip to content

Commit

Permalink
feat(GUI): Sprachsupport, Usability (#455)
Browse files Browse the repository at this point in the history
* Update .gitignore

Added venv

* Documentation

* added language support and minor improvements

* documentation

* Updated .gitignore

* Update .gitignore

Added venv

Documentation

added language support and minor improvements

documentation

Updated .gitignore

* typos

* Adapt postition zip-code hometown
  • Loading branch information
TRojaner2013 committed Jun 13, 2021
1 parent 372a376 commit d16c8bf
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.idea/
.vscode/
__pycache__/
venv/

*.DS_Store

# log
log/

# data
kontaktdaten.json
zeitspanne.json
data/*.json

#building:
installer/
Expand Down
9 changes: 8 additions & 1 deletion gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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_()

Expand Down
38 changes: 37 additions & 1 deletion tools/gui/qtkontakt.py
Original file line number Diff line number Diff line change
@@ -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 *
Expand All @@ -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
Expand Down Expand Up @@ -54,6 +58,7 @@
### QWidget ###
# kontaktdaten_tab
# zeitrahmen_tab
# vermittlungscodes_tab

### Buttons ###
# b_impfzentren_waehlen
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d16c8bf

Please sign in to comment.