2012-03-02 03:23:51 +00:00
|
|
|
import os, sys
|
2012-09-09 23:07:36 +00:00
|
|
|
## Search the package tree for all .ui files, compile each to
|
|
|
|
## a .py for pyqt and pyside
|
2012-03-02 03:23:51 +00:00
|
|
|
|
2012-09-09 23:07:36 +00:00
|
|
|
pyqtuic = 'pyuic4'
|
|
|
|
pysideuic = 'pyside-uic'
|
2014-03-29 10:57:13 +00:00
|
|
|
pyqt5uic = 'pyuic5'
|
2012-03-02 03:23:51 +00:00
|
|
|
|
|
|
|
for path, sd, files in os.walk('.'):
|
|
|
|
for f in files:
|
|
|
|
base, ext = os.path.splitext(f)
|
|
|
|
if ext != '.ui':
|
|
|
|
continue
|
|
|
|
ui = os.path.join(path, f)
|
2012-09-09 23:07:36 +00:00
|
|
|
|
|
|
|
py = os.path.join(path, base + '_pyqt.py')
|
2013-02-10 19:10:30 +00:00
|
|
|
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
2012-10-03 01:23:59 +00:00
|
|
|
os.system('%s %s > %s' % (pyqtuic, ui, py))
|
2014-03-29 10:57:13 +00:00
|
|
|
print(py)
|
2012-09-09 23:07:36 +00:00
|
|
|
|
|
|
|
py = os.path.join(path, base + '_pyside.py')
|
2013-02-10 19:10:30 +00:00
|
|
|
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
2012-10-03 01:23:59 +00:00
|
|
|
os.system('%s %s > %s' % (pysideuic, ui, py))
|
|
|
|
print(py)
|
2014-03-29 10:57:13 +00:00
|
|
|
|
|
|
|
py = os.path.join(path, base + '_pyqt5.py')
|
|
|
|
if not os.path.exists(py) or os.stat(ui).st_mtime > os.stat(py).st_mtime:
|
|
|
|
os.system('%s %s > %s' % (pyqt5uic, ui, py))
|
|
|
|
print(py)
|
|
|
|
|