Skip to content

Commit

Permalink
Revert revision 5d2fde6fe338
Browse files Browse the repository at this point in the history
- We don't support PyQt versions lower than 4.6 already (since 2.3.0) so it
really doesn't make sense to try to support API #1
  • Loading branch information
ccordoba12 committed Dec 9, 2014
1 parent 4a50123 commit 1d47da2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
2 changes: 1 addition & 1 deletion bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
default=False, help="Run Spyder in debug mode")
options, args = parser.parse_args()

assert options.gui in (None, 'pyqt', 'pyqtv1', 'pyside'), \
assert options.gui in (None, 'pyqt', 'pyside'), \
"Invalid GUI toolkit option '%s'" % options.gui

# For testing purposes
Expand Down
23 changes: 9 additions & 14 deletions spyderlib/qt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,36 @@
import os

os.environ.setdefault('QT_API', 'pyqt')
assert os.environ['QT_API'] in ('pyqt', 'pyqtv1', 'pyside')
assert os.environ['QT_API'] in ('pyqt', 'pyside')

API = os.environ['QT_API']
API_NAME = None
API_NAME = {'pyqt': 'PyQt4', 'pyside': 'PySide'}[API]

if API == 'pyqt':
# Spyder 2.3 is compatible with both #1 and #2 PyQt API,
# but to avoid issues with IPython and other Qt plugins
# we choose to support only API #2 for 2.4+
import sip
try:
import sip
sip.setapi('QString', 2)
sip.setapi('QVariant', 2)
except ImportError:
print('qt: PyQt4 is not found. Fallback to PySide API')
API = os.environ['QT_API'] = 'pyside'
except AttributeError:
# PyQt < 4.6. Fallback to API #1
print('qt: Fallback to PyQt4 API #1')
API = os.environ['QT_API'] = 'pyqtv1'
# PyQt < v4.6. The actual check is done by requirements.check_qt()
# call from spyder.py
pass

if API in ('pyqtv1', 'pyqt'):
try:
from PyQt4.QtCore import PYQT_VERSION_STR as __version__
except ImportError:
# No PyQt4. Fallback to PySide
print('qt: Fallback to PySide API')
# Switching to PySide
API = os.environ['QT_API'] = 'pyside'
API_NAME = 'PySide'
else:
is_old_pyqt = __version__.startswith(('4.4', '4.5', '4.6', '4.7'))
is_pyqt46 = __version__.startswith('4.6')
import sip
try:
API_NAME = ("PyQt4 (API v%d)" % sip.getapi('QString'))
API_NAME += (" (API v%d)" % sip.getapi('QString'))
except AttributeError:
pass

Expand All @@ -54,4 +50,3 @@
raise ImportError("Spyder requires PySide or PyQt to be installed")
else:
is_old_pyqt = is_pyqt46 = False
API_NAME = 'PySide'

0 comments on commit 1d47da2

Please sign in to comment.