From d6f454456232c37c2adc43da7172197dae4c973a Mon Sep 17 00:00:00 2001 From: Slávek Banko Date: Sun, 25 Sep 2016 10:54:27 +0200 Subject: Improve python_tqt module initialization This relates to bug 2693 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michele Calgaro Signed-off-by: Slávek Banko (cherry picked from commit 0b2f1c4760ceb98b6e3213999a1e4d48d24e91e8) --- module-init.py | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 module-init.py (limited to 'module-init.py') diff --git a/module-init.py b/module-init.py new file mode 100644 index 0000000..929a166 --- /dev/null +++ b/module-init.py @@ -0,0 +1,35 @@ + +# Trinity-specific paths +import sys, os +tqt_modules = [] +for m_path in sys.path: + if os.path.exists(os.path.join(m_path, 'sip4_tqt')): + m_sip_dir = os.path.join(m_path, 'sip4_tqt') + tqt_modules.insert(0, m_sip_dir) + if os.path.exists(os.path.join(m_path, 'python_tqt')): + m_pyqt_dir = os.path.join(m_path, 'python_tqt') + tqt_modules.insert(0, m_pyqt_dir) +for m_path in tqt_modules: + sys.path.insert(0, m_path) + +# Base modules +__all__ = [ + 'qt', + 'qtcanvas', + 'qtnetwork', + 'qtsql', + 'qttable', + 'qtui', + 'qtxml', +] + +# Optional modules +if os.path.exists(os.path.join(m_pyqt_dir, 'qtaxcontainer.so')): + __all__.append('qtaxcontainer') +if os.path.exists(os.path.join(m_pyqt_dir, 'qtext.so')): + __all__.append('qtext') +if os.path.exists(os.path.join(m_pyqt_dir, 'qtgl.so')): + __all__.append('qtgl') + +# Import namespaces +from python_tqt import * -- cgit v1.2.3