Commit 45f81080 authored by Yves Gesnel's avatar Yves Gesnel
Browse files

Version mac : traduction du menu Pyromaths

parent ef237acd
......@@ -43,6 +43,7 @@ MANIFEST-all := $(MANIFEST) \
include Makefile \n
# Unix:
MANIFEST-unix := $(MANIFEST-min) \
exclude data/macmenu_fr.qm \n\
exclude data/images/pyromaths.icns \n\
exclude data/images/pyromaths.ico \n
# Mac app:
......@@ -53,6 +54,7 @@ MANIFEST-mac := $(MANIFEST-min) \
# Win app:
MANIFEST-win := $(MANIFEST-min) \
prune data/linux \n\
exclude data/macmenu_fr.qm \n\
exclude data/images/pyromaths.icns \n
### SHORTCUTS & COMPATIBILITY
......@@ -173,25 +175,7 @@ repo: deb
app: version
# Make standalone Mac application
$(clean)
echo "$(MANIFEST-mac)" > MANIFEST.in
$(setup) py2app -b $(BUILD) -d $(DIST) $(OUT)
# ..Improve french localization..."
# ....Extract strings from qt_menu.nib
cd $(DIST) &&\
ibtool --generate-strings-file qt_menu.strings \
$(APP)/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib &&\
iconv -f utf-16 -t utf-8 qt_menu.strings > qt_menu_tmp.strings &&\
mv -f qt_menu_tmp.strings qt_menu.strings &&\
$(sed-i) 's/Hide/Masquer/g' qt_menu.strings &&\
$(sed-i) 's/Others/les autres/g' qt_menu.strings &&\
$(sed-i) 's/Show All/Tout afficher/g' qt_menu.strings &&\
$(sed-i) 's/Quit/Quitter/g' qt_menu.strings
# ....Import french strings
cd $(APP)/Frameworks/QtGui.framework/Versions/4/Resources &&\
ibtool --strings-file $(DIST)/qt_menu.strings \
--write qt_menu_french.nib qt_menu.nib &&\
rm -rf qt_menu.nib && mv qt_menu_french.nib qt_menu.nib
rm $(DIST)/qt_menu.strings
# ..Clean-up unnecessary files/folders
rm -f $(APP)/PkgInfo
cd $(APP)/Resources && rm -rf include lib/python2.*/config lib/python2.*/site.pyc
......
......@@ -88,7 +88,15 @@ def _mac_opt():
)
return dict(
app = ['src/pyromaths.py'],
data_files = [('data', glob('data/*'))],
data_files = [
( 'data', ['data/macmenu_fr.qm']),
( 'data/images', ['data/images/pyromaths.png',
'data/images/whatsthis.png']),
('data/images/vignettes', glob('data/images/vignettes/*.png')),
('data/macmenu_fr.qm'),
('data/templates', glob('data/templates/*.tex')),
('data/packages', glob('data/packages/*')),
],
setup_requires = ['py2app>=0.7.3', 'lxml>=2.2.2'],
options = {'py2app': py2app},
)
......
......@@ -309,6 +309,7 @@ class Ui_MainWindow(object):
self.action_a_propos = QtGui.QAction(MainWindow)
self.action_a_propos.setText(u"À propos")
self.action_a_propos.setMenuRole(QtGui.QAction.AboutRole)
self.menuFichier.addAction(self.actionTous_les_exercices)
self.menuFichier.addSeparator()
......
......@@ -58,6 +58,12 @@ def main():
app = QtGui.QApplication(argv)
pyromaths = StartQT4()
# Intégration de QTranslator
from PyQt4.QtCore import QTranslator
translator = QTranslator()
translator.load("macmenu_fr", "data")
app.installTranslator(translator)
pyromaths.show()
test(pyromaths)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment