Drop all PyQt4 code

Fix #1203
This commit is contained in:
Julien Duponchelle
2016-04-29 16:40:32 +02:00
parent dfaae1df1a
commit d78064daa6
4 changed files with 3 additions and 38 deletions

View File

@@ -40,15 +40,3 @@ Or start the app with --debug flag.
Due to the fact PyQT intercept you can use a web debugger for inspecting stuff:
https://github.com/Kozea/wdb
Test with PyQT4
~~~~~~~~~~~~~~~~
If you want to simulate a user with PyQT4:
.. code:: bash
export GNS3_QT4=1
python gns3/main.py

View File

@@ -539,8 +539,7 @@ class GraphicsView(QtWidgets.QGraphicsView):
"""
if event.modifiers() == QtCore.Qt.ControlModifier:
# event.delta() added for Qt4 compatibility
delta = event.angleDelta() if hasattr(event, 'angleDelta') else event.delta()
delta = event.angleDelta()
if delta is not None and delta.x() == 0:
# CTRL is pressed then use the mouse wheel to zoom in or out.
self.scaleView(pow(2.0, delta.y() / 240.0))

View File

@@ -195,10 +195,6 @@ def main():
result.append(int(i))
return result
# 4.8.3 because of QSettings (http://pyqt.sourceforge.net/Docs/PyQt4/pyqt_qsettings.html)
if DEFAULT_BINDING == "PyQt4" and version(QtCore.BINDING_VERSION_STR) < version("4.8.3"):
raise SystemExit("Requirement is PyQt version 4.8.3 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))
if DEFAULT_BINDING == "PyQt5" and version(QtCore.BINDING_VERSION_STR) < version("5.0.0"):
raise SystemExit("Requirement is PyQt5 version 5.0.0 or higher, got version {}".format(QtCore.BINDING_VERSION_STR))

View File

@@ -16,9 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Compatibility layer for Qt bindings, so it is easier to switch from PyQt4 to PyQt5 and
vice-versa. It is possible to add PySide if needed.
For PyQt4 and PyQt5 differences please see http://pyqt.sourceforge.net/Docs/PyQt5/pyqt4_differences.html
Compatibility layer for Qt bindings, so it is easier to switch to PySide if needed.
"""
# based on https://gist.github.com/remram44/5985681 and
@@ -36,23 +34,7 @@ import logging
log = logging.getLogger(__name__)
if os.environ.get('GNS3_QT4', None) is not None:
DEFAULT_BINDING = 'PyQt4'
else:
try:
import PyQt5
DEFAULT_BINDING = 'PyQt5'
except ImportError:
DEFAULT_BINDING = 'PyQt4'
if DEFAULT_BINDING == 'PyQt4':
log.critical('ERROR: PyQt4 is no longer supported, please upgrade to PyQt5 for Python 3')
from PyQt4 import QtGui
app = QtGui.QApplication(sys.argv)
message = QtGui.QMessageBox.critical(None, 'GNS3', 'PyQt4 is no longer supported, please upgrade to PyQt5 for Python 3')
sys.exit(1)
DEFAULT_BINDING = 'PyQt5'
from PyQt5 import QtCore, QtGui, QtNetwork, QtWidgets, Qt
sys.modules[__name__ + '.QtCore'] = QtCore