de7e40537d
- a few issues to work out still, and editor changes not done yet - for communication between webengine and python code, we set window .location to 'http://anki/<something>' - the leading http is necessary for qt to call the link handler, which was introduced in qt5.5 - the designer files now use a promoted qobject to create instances of AnkiWebView - we use the css zoom property to alter webengine font size based on system dpi - prefs and addons folder stored in new location (at least for now)
42 lines
961 B
Bash
Executable File
42 lines
961 B
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# generate python files based on the designer ui files. pyuic5 and pyrcc5
|
|
# should be on the path.
|
|
#
|
|
|
|
if [ ! -d "designer" ]
|
|
then
|
|
echo "Please run this from the project root"
|
|
exit
|
|
fi
|
|
|
|
mkdir -p aqt/forms
|
|
|
|
init=aqt/forms/__init__.py
|
|
temp=aqt/forms/scratch
|
|
rm -f $init $temp
|
|
echo "# This file auto-generated by build_ui.sh. Don't edit." > $init
|
|
echo "__all__ = [" >> $init
|
|
|
|
echo "Generating forms.."
|
|
for i in designer/*.ui
|
|
do
|
|
base=$(basename $i .ui)
|
|
py="aqt/forms/${base}.py"
|
|
echo " \"$base\"," >> $init
|
|
echo "from . import $base" >> $temp
|
|
if [ $i -nt $py ]; then
|
|
echo " * "$py
|
|
pyuic5 --from-imports $i -o $py
|
|
# munge the output to use gettext
|
|
perl -pi.bak -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' $py
|
|
rm $py.bak
|
|
fi
|
|
done
|
|
echo "]" >> $init
|
|
cat $temp >> $init
|
|
rm $temp
|
|
|
|
echo "Building resources.."
|
|
pyrcc5 designer/icons.qrc -o aqt/forms/icons_rc.py
|