2016-07-29 16:37:58 +02:00
|
|
|
#! /usr/bin/env python
|
|
|
|
# encoding: utf-8#
|
|
|
|
# Federico Pellegrin, 2016 (fedepell)
|
|
|
|
|
|
|
|
"""
|
|
|
|
Python QT5 helper tools example:
|
|
|
|
converts QT5 Designer tools files (UI and QRC) into python files with
|
|
|
|
the appropriate tools (pyqt5 and pyside2 searched) and manages their
|
|
|
|
python compilation and installation using standard python waf Tool
|
|
|
|
|
|
|
|
"""
|
|
|
|
def options(opt):
|
|
|
|
# Load also python to demonstrate mixed calls
|
|
|
|
opt.load('python pyqt5')
|
|
|
|
|
|
|
|
def configure(conf):
|
2022-06-08 08:11:20 +02:00
|
|
|
# Recent UIC/RCC versions require explicit python generator selection
|
|
|
|
conf.env.QT_PYUIC_FLAGS = ['-g', 'python']
|
|
|
|
conf.env.QT_PYRCC_FLAGS = ['-g', 'python']
|
2016-07-29 16:37:58 +02:00
|
|
|
# Load also python to demonstrate mixed calls
|
|
|
|
conf.load('python pyqt5')
|
2022-06-08 08:11:20 +02:00
|
|
|
conf.check_python_version((2,7,4))
|
2016-07-29 16:37:58 +02:00
|
|
|
|
|
|
|
def build(bld):
|
2018-07-29 01:46:58 +02:00
|
|
|
# Demonstrates mixed usage of py and pyqt5 module, and tests also install_path and install_from
|
2016-07-29 16:37:58 +02:00
|
|
|
# (since generated files go into build it has to be reset inside the pyqt5 tool)
|
2022-06-08 08:11:20 +02:00
|
|
|
bld(features="py pyqt5", source="src/sample.py src/firstgui.ui", install_path="${PREFIX}/play/", install_from="src/")
|
2016-07-29 16:37:58 +02:00
|
|
|
|
2022-06-08 08:11:20 +02:00
|
|
|
# Simple usage on a resource file. If a file referenced inside the resource changes it will be rebuilt
|
2016-07-29 16:37:58 +02:00
|
|
|
# as the qrc XML is parsed and dependencies are calculated
|
2022-06-08 08:11:20 +02:00
|
|
|
bld(features="pyqt5", source="sampleRes.qrc")
|
|
|
|
|