forked from mne-tools/mne-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_backend.py
49 lines (39 loc) · 1.29 KB
/
_backend.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
"""Deal with pyface backend issues."""
# Author: Christian Brodbeck <[email protected]>
#
# License: BSD (3-clause)
import os
from ..utils import warn, _check_pyqt5_version
def _get_pyface_backend():
"""Check the currently selected Pyface backend.
Returns
-------
backend : str
Name of the backend.
result : 0 | 1 | 2
0: the backend has been tested and works.
1: the backend has not been tested.
2: the backend not been tested.
Notes
-----
See also http://docs.enthought.com/pyface/.
"""
from traitsui.toolkit import toolkit
from traits.etsconfig.api import ETSConfig
toolkit()
return ETSConfig.toolkit
def _check_backend():
from pyface.api import warning
backend = _get_pyface_backend()
if backend == 'qt4':
_check_pyqt5_version()
else:
msg = ("Using the currently selected Pyface backend %s is not "
"recommended, and it might not work properly. We recommend "
"using 'qt4' which can be enabled by installing the PyQt5"
"package." % backend)
warn(msg)
warning(None, msg, "Pyface Backend Warning")
def _testing_mode():
"""Determine if we're running tests."""
return os.getenv('_MNE_GUI_TESTING_MODE', '') == 'true'