aea0a6fcc6
Running and testing should be working on the three platforms, but there's still a fair bit that needs to be done: - Wheel building + testing in a venv still needs to be implemented. - Python requirements still need to be compiled with piptool and pinned; need to compile on all platforms then merge - Cargo deps in cargo/ and rslib/ need to be cleaned up, and ideally unified into one place - Currently using rustls to work around openssl compilation issues on Linux, but this will break corporate proxies with custom SSL authorities; need to conditionally use openssl or use https://github.com/seanmonstar/reqwest/pull/1058 - Makefiles and docs still need cleaning up - It may make sense to reparent ts/* to the top level, as we don't nest the other modules under a specific language. - rspy and pylib must always be updated in lock-step, so merging rspy into pylib as a private module would simplify things. - Merging desktop-ftl and mobile-ftl into the core ftl would make managing and updating translations easier. - Obsolete scripts need removing. - And probably more.
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
import re
|
|
import sys
|
|
import io
|
|
from PyQt5.uic import compileUi
|
|
|
|
ui_file = sys.argv[1]
|
|
py_file = sys.argv[2]
|
|
buf = io.StringIO()
|
|
compileUi(open(ui_file), buf, from_imports=True)
|
|
|
|
outdata = buf.getvalue()
|
|
outdata = outdata.replace("# -*- coding: utf-8 -*-", "# -*- coding: utf-8 -*-\nfrom anki.lang import _\n")
|
|
outdata = re.sub(r'(QtGui\.QApplication\.)?_?translate\(".*?", ', '_(', outdata)
|
|
outdata = re.sub(r', None.*', '))', outdata)
|
|
|
|
with open(py_file, "w") as file:
|
|
file.write(outdata)
|
|
|
|
# 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.tmp
|
|
# (cat <<EOF; tail -n +3 $py.tmp) | perl -p -e 's/(QtGui\.QApplication\.)?_?translate\(".*?", /_(/; s/, None.*/))/' > $py
|
|
# # -*- coding: utf-8 -*-
|
|
# # pylint: disable=unsubscriptable-object,unused-import
|
|
# from anki.lang import _
|
|
# EOF
|
|
# rm $py.tmp
|
|
# fi
|
|
# done
|
|
# echo "]" >> $init
|
|
# cat $temp >> $init
|
|
# rm $temp
|
|
|
|
# echo "Building resources.."
|
|
# pyrcc5 designer/icons.qrc -o aqt/forms/icons_rc.py |