From 6c10b5b70a2dfeff32f4374148e64f9b69a35c04 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Fri, 6 Mar 2015 14:29:25 +0100 Subject: [PATCH 1/5] Use PyQt5 by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit because if the support for a newer and better version of a library is there, qhy wouldn’t we want to use it --- spyderlib/qt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyderlib/qt/__init__.py b/spyderlib/qt/__init__.py index 92cd88cc216..fed44297c9c 100644 --- a/spyderlib/qt/__init__.py +++ b/spyderlib/qt/__init__.py @@ -9,7 +9,7 @@ import os -os.environ.setdefault('QT_API', 'pyqt') +os.environ.setdefault('QT_API', 'pyqt5') assert os.environ['QT_API'] in ('pyqt5', 'pyqt', 'pyside') API = os.environ['QT_API'] From 264d134cbaab47534baad78f9bec745e2f936057 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Fri, 6 Mar 2015 14:56:24 +0100 Subject: [PATCH 2/5] Add pyqt5 to choices --- spyderlib/plugins/externalconsole.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spyderlib/plugins/externalconsole.py b/spyderlib/plugins/externalconsole.py index 3d18f61160b..826f2aa0199 100644 --- a/spyderlib/plugins/externalconsole.py +++ b/spyderlib/plugins/externalconsole.py @@ -254,8 +254,12 @@ def setup_page(self): monitor_group.setLayout(monitor_layout) # Qt Group - opts = [(_("Default library"), 'default'), ('PyQt4', 'pyqt'), - ('PySide', 'pyside')] + opts = [ + (_("Default library"), 'default'), + ('PyQt5', 'pyqt5'), + ('PyQt4', 'pyqt'), + ('PySide', 'pyside'), + ] qt_group = QGroupBox(_("Qt (PyQt/PySide)")) qt_setapi_box = self.create_combobox( _("Qt-Python bindings library selection:"), opts, From bb94aeb4fe7a4049a8a4264f1fe1cd2e2a752265 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Fri, 6 Mar 2015 15:04:43 +0100 Subject: [PATCH 3/5] fixed PyQt5 logic --- spyderlib/plugins/externalconsole.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/spyderlib/plugins/externalconsole.py b/spyderlib/plugins/externalconsole.py index 826f2aa0199..2dda64828bb 100644 --- a/spyderlib/plugins/externalconsole.py +++ b/spyderlib/plugins/externalconsole.py @@ -271,19 +271,23 @@ def setup_page(self): interpreter = get_python_executable() else: interpreter = self.get_option('pythonexecutable') + has_pyqt5 = programs.is_module_installed('PyQt5', + interpreter=interpreter) has_pyqt4 = programs.is_module_installed('PyQt4', interpreter=interpreter) has_pyside = programs.is_module_installed('PySide', interpreter=interpreter) - if has_pyside and not has_pyqt4: + if has_pyqt4 and not has_pyqt5: + self.set_option('qt/api', 'pyqt4') + elif has_pyside and not (has_pyqt5 or has_pyqt4): self.set_option('qt/api', 'pyside') qt_layout = QVBoxLayout() qt_layout.addWidget(qt_setapi_box) qt_group.setLayout(qt_layout) - qt_group.setEnabled(has_pyqt4 or has_pyside) + qt_group.setEnabled(has_pyqt5 or has_pyqt4 or has_pyside) - # PyQt Group + # PyQt4 Group if has_pyqt4: pyqt_group = QGroupBox(_("PyQt")) setapi_box = self.create_combobox( @@ -318,10 +322,10 @@ def setup_page(self): mpl_group = QGroupBox(_("Matplotlib")) mpl_backend_box = newcb('', 'matplotlib/backend/enabled', True) mpl_backend_edit = self.create_lineedit(_("GUI backend:"), - 'matplotlib/backend/value', "Qt4Agg", + 'matplotlib/backend/value', "Qt5Agg", tip=_("Set the GUI toolkit used by
" "Matplotlib to show figures " - "(default: Qt4Agg)"), + "(default: Qt5Agg)"), alignment=Qt.Horizontal) mpl_backend_box.toggled.connect(mpl_backend_edit.setEnabled) mpl_backend_layout = QHBoxLayout() @@ -339,7 +343,7 @@ def setup_page(self): # ETS Group ets_group = QGroupBox(_("Enthought Tool Suite")) ets_label = QLabel(_("Enthought Tool Suite (ETS) supports " - "PyQt4 (qt4) and wxPython (wx) graphical " + "PyQt5 (qt5) and wxPython (wx) graphical " "user interfaces.")) ets_label.setWordWrap(True) ets_edit = self.create_lineedit(_("ETS_TOOLKIT:"), 'ets_backend', @@ -371,15 +375,18 @@ def setup_page(self): def _auto_change_qt_api(self, pyexec): """Change automatically Qt API depending on selected Python executable""" + has_pyqt5 = programs.is_module_installed('PyQt5', interpreter=pyexec) has_pyqt4 = programs.is_module_installed('PyQt4', interpreter=pyexec) has_pyside = programs.is_module_installed('PySide', interpreter=pyexec) for cb in self.comboboxes: if self.comboboxes[cb][0] == 'qt/api': qt_setapi_cb = cb - if has_pyside and not has_pyqt4: - qt_setapi_cb.setCurrentIndex(2) - elif has_pyqt4 and not has_pyside: + if has_pyqt5: qt_setapi_cb.setCurrentIndex(1) + elif has_pyside and not has_pyqt4: + qt_setapi_cb.setCurrentIndex(3) + elif has_pyqt4 and not has_pyside: + qt_setapi_cb.setCurrentIndex(2) else: qt_setapi_cb.setCurrentIndex(0) From 0f0d27701ff1b313ae213595e52f11491e1b7e14 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Wed, 1 Apr 2015 10:44:16 +0200 Subject: [PATCH 4/5] pyqt, not pyqt4 --- spyderlib/plugins/externalconsole.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyderlib/plugins/externalconsole.py b/spyderlib/plugins/externalconsole.py index 2dda64828bb..69fed94ba95 100644 --- a/spyderlib/plugins/externalconsole.py +++ b/spyderlib/plugins/externalconsole.py @@ -278,7 +278,7 @@ def setup_page(self): has_pyside = programs.is_module_installed('PySide', interpreter=interpreter) if has_pyqt4 and not has_pyqt5: - self.set_option('qt/api', 'pyqt4') + self.set_option('qt/api', 'pyqt') elif has_pyside and not (has_pyqt5 or has_pyqt4): self.set_option('qt/api', 'pyside') From d99ee5744741d2f2b33981ebad8e622200ac4a38 Mon Sep 17 00:00:00 2001 From: flying-sheep Date: Wed, 1 Apr 2015 10:44:57 +0200 Subject: [PATCH 5/5] PyQt 4 per default until sufficiently tested --- spyderlib/qt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spyderlib/qt/__init__.py b/spyderlib/qt/__init__.py index fed44297c9c..92cd88cc216 100644 --- a/spyderlib/qt/__init__.py +++ b/spyderlib/qt/__init__.py @@ -9,7 +9,7 @@ import os -os.environ.setdefault('QT_API', 'pyqt5') +os.environ.setdefault('QT_API', 'pyqt') assert os.environ['QT_API'] in ('pyqt5', 'pyqt', 'pyside') API = os.environ['QT_API']