Use gettext for generated GUI code

Instead of using the Qt system. So I can use one single
way for everything

Also join all the targets into one single target.
This commit is contained in:
Salvo 'LtWorf' Tomaselli 2020-10-22 07:44:54 +02:00
parent f3947b5367
commit 9c7719831a
No known key found for this signature in database
GPG Key ID: B3A7CF0C801886CF

View File

@ -1,16 +1,19 @@
.PHONY: gui .PHONY: gui
gui: relational_gui/survey.py relational_gui/maingui.py relational_gui/rel_edit.py relational_gui/resources.py gui: relational_gui/survey.py relational_gui/maingui.py relational_gui/rel_edit.py relational_gui/resources.py
relational_gui/survey.py: relational_gui/maingui.py relational_gui/survey.py relational_gui/rel_edit.py:
pyuic5 relational_gui/survey.ui > relational_gui/survey.py # Create .py file
pyuic5 $(basename $@).ui > $@
relational_gui/maingui.py: # Use my custom editor class
pyuic5 relational_gui/maingui.ui > relational_gui/maingui.py sed -i 's/QtWidgets.QPlainTextEdit/editor.Editor/g' $@
sed -i 's/QtWidgets.QPlainTextEdit/editor.Editor/g' relational_gui/maingui.py echo 'from . import editor' >> $@
echo 'from . import editor' >> relational_gui/maingui.py # Use gettext instead of Qt translations
echo 'from gettext import gettext as _' >> $@
relational_gui/rel_edit.py: sed -i \
pyuic5 relational_gui/rel_edit.ui > relational_gui/rel_edit.py -e 's/_translate("MainWindow", /_(/g' \
-e 's/_translate("Dialog", /_(/g' \
-e 's/_translate("Form", /_(/g' \
$@
relational_gui/resources.py: relational_gui/resources.py:
pyrcc5 relational_gui/resources.qrc > relational_gui/resources.py pyrcc5 relational_gui/resources.qrc > relational_gui/resources.py