openalea.vpltk.qt package

Submodules

openalea.vpltk.qt.QtCore module

openalea.vpltk.qt.QtCore.bin(QTextStream) → QTextStream
openalea.vpltk.qt.QtCore.hex(QTextStream) → QTextStream
openalea.vpltk.qt.QtCore.oct(QTextStream) → QTextStream

openalea.vpltk.qt.QtGui module

openalea.vpltk.qt.QtOpenGL module

openalea.vpltk.qt.compat module

spyderlib.qt.compat

Transitional module providing compatibility functions intended to help migrating from PyQt to PySide.

This module should be fully compatible with:
  • PyQt >=v4.4
  • both PyQt API #1 and API #2
  • PySide
openalea.vpltk.qt.compat.from_qvariant(qobj=None, convfunc=None)[source]

Convert QVariant object to Python object This is a transitional function from PyQt API #1 (QVariant exist) to PyQt API #2 and Pyside (QVariant does not exist)

openalea.vpltk.qt.compat.to_qvariant(pyobj=None)[source]

Convert Python object to QVariant This is a transitional function from PyQt API #1 (QVariant exist) to PyQt API #2 and Pyside (QVariant does not exist)

openalea.vpltk.qt.qt module

import qt.py from IPython to set QString and QVariant

The goal is to have the same version of QString and QVariant in all OpenAlea

openalea.vpltk.qt.qt_loaders module

This module contains factory functions that attempt to return Qt submodules from the various python Qt bindings.

It also protects against double-importing Qt with different bindings, which is unstable and likely to crash

This is used primarily by qt and qt_for_kernel, and shouldn’t be accessed directly from the outside

File copied from IPython 1.1.0

class openalea.vpltk.qt.qt_loaders.ImportDenier[source]

Bases: object

Import Hook that will guard against bad Qt imports once IPython commits to a specific binding

find_module(mod_name, pth)[source]
forbid(module_name)[source]
load_module(mod_name)[source]
openalea.vpltk.qt.qt_loaders.can_import(api)[source]

Safely query whether an API is importable, without importing it

openalea.vpltk.qt.qt_loaders.check_version(v, check)[source]

check version string v >= check

If dev/prerelease tags result in TypeError for string-number comparison, it is assumed that the dependency is satisfied. Users on dev branches are responsible for keeping their own packages up to date.

openalea.vpltk.qt.qt_loaders.commit_api(api)[source]

Commit to a particular API, and trigger ImportErrors on subsequent dangerous imports

openalea.vpltk.qt.qt_loaders.has_binding(api)[source]

Safely check for PyQt4 or PySide, without importing submodules

api : str [ ‘pyqtv1’ | ‘pyqt’ | ‘pyside’ | ‘pyqtdefault’]
Which module to check for

True if the relevant module appears to be importable

openalea.vpltk.qt.qt_loaders.import_pyqt4(version=2)[source]

Import PyQt4

version : 1, 2, or None
Which QString/QVariant API to use. Set to None to use the system default

ImportErrors rasied within this function are non-recoverable

openalea.vpltk.qt.qt_loaders.import_pyside()[source]

Import PySide

ImportErrors raised within this function are non-recoverable

openalea.vpltk.qt.qt_loaders.load_qt(api_options)[source]

Attempt to import Qt, given a preference list of permissible bindings

It is safe to call this function multiple times.

api_options: List of strings
The order of APIs to try. Valid items are ‘pyside’, ‘pyqt’, and ‘pyqtv1’

A tuple of QtCore, QtGui, QtSvg, QT_API The first three are the Qt modules. The last is the string indicating which module was loaded.

ImportError, if it isn’t possible to import any requested bindings (either becaues they aren’t installed, or because an incompatible library has already been installed)

openalea.vpltk.qt.qt_loaders.loaded_api()[source]

Return which API is loaded, if any

If this returns anything besides None, importing any other Qt binding is unsafe.

None, ‘pyside’, ‘pyqt’, or ‘pyqtv1’

openalea.vpltk.qt.qt_loaders.qtapi_version()[source]

Return which QString API has been set, if any

The QString API version (1 or 2), or None if not set

Module contents