'''
Created on 17 avr. 2018

@author: olivier.massot
'''
import subprocess

from PyQt5 import uic
from path import Path


# http://pyqt.sourceforge.net/Docs/PyQt4/designer.html#pyuic4
# http://pyqt.sourceforge.net/Docs/PyQt4/resources.html#pyrcc4

HERE = Path(__file__).parent

def rename(dirname, filename):
    return dirname, (Path(dirname) / filename).name.stripext() + "_ui.py"

uic.compileUiDir(HERE, map=rename, from_imports=True)

for f in HERE.files("*.qrc"):
    output = f.name.stripext() + "_rc.py"
    subprocess.call(["pyrcc5", f, "-o", output])

print("Génération terminée")