"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "modules/pmg_qt/pymol_gl_widget.py" between
pymol-open-source-2.2.0.tar.gz and pymol-open-source-2.3.0.tar.gz

About: PyMOL is a Python-enhanced molecular graphics tool. It excels at 3D visualization of proteins, small molecules, density, surfaces, and trajectories. It also includes molecular editing, ray tracing, and movies. Open Source version.

pymol_gl_widget.py  (pymol-open-source-2.2.0):pymol_gl_widget.py  (pymol-open-source-2.3.0)
skipping to change at line 21 skipping to change at line 21
Gesture = QtCore.QEvent.Gesture Gesture = QtCore.QEvent.Gesture
Qt = QtCore.Qt Qt = QtCore.Qt
from .keymapping import get_modifiers from .keymapping import get_modifiers
# don't import the heavy OpenGL (PyOpenGL) module # don't import the heavy OpenGL (PyOpenGL) module
from pymol._cmd import glViewport from pymol._cmd import glViewport
# QOpenGLWidget is supposed to supersede QGLWidget, but has issues (e.g. # QOpenGLWidget is supposed to supersede QGLWidget, but has issues (e.g.
# no stereo support) # no stereo support)
USE_QOPENGLWIDGET = pymol.IS_MACOS USE_QOPENGLWIDGET = pymol.IS_MACOS and QtCore.QT_VERSION >= 0x50400
if USE_QOPENGLWIDGET: if USE_QOPENGLWIDGET:
BaseGLWidget = QtWidgets.QOpenGLWidget BaseGLWidget = QtWidgets.QOpenGLWidget
AUTO_DETECT_STEREO = False AUTO_DETECT_STEREO = False
else: else:
from pymol.Qt import QtOpenGL from pymol.Qt import QtOpenGL
BaseGLWidget = QtOpenGL.QGLWidget BaseGLWidget = QtOpenGL.QGLWidget
# only attempt stereo detection in Qt <= 5.6 (with 5.9+ on Linux I # only attempt stereo detection in Qt <= 5.6 (with 5.9+ on Linux I
# get GL_DOUBLEBUFFER=0 with flickering when requesting stereo) # get GL_DOUBLEBUFFER=0 with flickering when requesting stereo)
AUTO_DETECT_STEREO = pymol.IS_WINDOWS or QtCore.QT_VERSION < 0x50700 AUTO_DETECT_STEREO = pymol.IS_WINDOWS or QtCore.QT_VERSION < 0x50700
skipping to change at line 47 skipping to change at line 47
# mouse button map # mouse button map
_buttonMap = { _buttonMap = {
Qt.LeftButton: 0, Qt.LeftButton: 0,
Qt.MidButton: 1, Qt.MidButton: 1,
Qt.RightButton: 2, Qt.RightButton: 2,
} }
def __init__(self, parent): def __init__(self, parent):
self.gui = parent self.gui = parent
self.fb_scale = 1.0
# OpenGL context setup # OpenGL context setup
if USE_QOPENGLWIDGET: if USE_QOPENGLWIDGET:
f = QtGui.QSurfaceFormat() f = QtGui.QSurfaceFormat()
else: else:
f = QtOpenGL.QGLFormat() f = QtOpenGL.QGLFormat()
from pymol.invocation import options from pymol.invocation import options
# logic equivalent to layer5/main.cpp:launch # logic equivalent to layer5/main.cpp:launch
skipping to change at line 227 skipping to change at line 228
# Scale framebuffer for Retina displays # Scale framebuffer for Retina displays
try: try:
window = self.windowHandle() window = self.windowHandle()
# QOpenGLWidget workaround # QOpenGLWidget workaround
if window is None: if window is None:
window = self.parent().windowHandle() window = self.parent().windowHandle()
self.updateFbScale(window) self.updateFbScale(window)
window.screenChanged.connect(self.updateFbScale) window.screenChanged.connect(self.updateFbScale)
window.screen().physicalDotsPerInchChanged.connect(
lambda dpi: self.updateFbScale(window))
except AttributeError: except AttributeError:
# Fallback for Qt4 # Fallback for Qt4
self.fb_scale = 1.0 pass
def _pymolProcess(self): def _pymolProcess(self):
idle = self.pymol.idle() idle = self.pymol.idle()
if idle or self.pymol.getRedisplay(): if idle or self.pymol.getRedisplay():
self.update() self.update()
self._timer.start(20) self._timer.start(20)
########################## ##########################
# drag n drop # drag n drop
 End of changes. 4 change blocks. 
2 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)