mirror of
https://github.com/xgui4/LCE-Qt-Launcher.git
synced 2026-07-16 08:31:00 +00:00
59 lines
1.8 KiB
Bash
Executable File
59 lines
1.8 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
QT_RESSOURCE="res.qrc"
|
|
UI_FILES=("form" "system_info" "instance" "settingDialog" "about" "contentInstaller" "setup")
|
|
|
|
RCC="pyside6-rcc"
|
|
UIC="pyside6-ui"
|
|
|
|
fix_import() {
|
|
if [[ $(uname -o) == "GNU/Linux" ]]; then
|
|
echo "fixing $1 file."
|
|
sed -i 's/^import res_rc/from . import res_rc/g' "$1"
|
|
else
|
|
echo "fixing $1 file."
|
|
sed -i.bak 's/^import res_rc/from . import res_rc/g' "$1"
|
|
rm "$1.bak"
|
|
echo "removing $1.bak file."
|
|
fi
|
|
}
|
|
|
|
find_qt_tool() {
|
|
if command -v pyside6-rcc &> /dev/null; then
|
|
echo "pyside6-rcc detected. using pyside6 tools."
|
|
RCC="pyside6-rcc"
|
|
UIC="pyside6-uic"
|
|
elif command -v /usr/local/bin/pyside6-rcc &> /dev/null; then
|
|
echo "/usr/local/bin/pyside6-rcc detected. using /usr/local/bin/pyside6 tools."
|
|
RCC="/usr/local/bin/pyside6-rcc"
|
|
UIC="/usr/local/bin/pyside6-uic"
|
|
elif command -v /usr/lib/qt6/rcc &> /dev/null; then
|
|
echo "/usr/lib/qt6/rcc detected. using /usr/lib/qt6/rcc and uic tools."
|
|
RCC="/usr/lib/qt6/rcc -g python"
|
|
UIC="/usr/lib/qt6/uic -g python"
|
|
elif command -v /usr/local/PySide6/bin/rcc &> /dev/null; then
|
|
echo "/usr/local/PySide6/bin/rcc detected. using /usr/local/PySide6/bin/rcc and uic tools."
|
|
RCC="/usr/local/PySide6/bin/rcc -g python"
|
|
UIC="/usr/local/PySide6/bin/uic -g python"
|
|
fi
|
|
}
|
|
|
|
echo "finding the correct path for the Qt compilers"
|
|
find_qt_tool
|
|
echo "done"
|
|
|
|
echo "Starting Compilaton of Qt Ressource"
|
|
$RCC -g python $QT_RESSOURCE -o src/lce_qt_launcher/res_rc.py
|
|
echo "done"
|
|
|
|
for ui in "${UI_FILES[@]}"; do
|
|
echo "Compiling ${ui}.ui"
|
|
OUT="src/lce_qt_launcher/ui_${ui}.py"
|
|
$UIC "src/${ui}.ui" -o "$OUT"
|
|
echo "done"
|
|
echo "fixing the import"
|
|
fix_import "$OUT"
|
|
echo "done"
|
|
done |