Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pager tearing bug #1153

Merged
merged 1 commit into from Dec 14, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
23 changes: 12 additions & 11 deletions IPython/frontend/qt/console/console_widget.py
Expand Up @@ -172,6 +172,13 @@ def __init__(self, parent=None, **kw):
QtGui.QWidget.__init__(self, parent)
LoggingConfigurable.__init__(self, **kw)

# While scrolling the pager on Mac OS X, it tears badly. The
# NativeGesture is platform and perhaps build-specific hence
# we take adequate precautions here.
self._pager_scroll_events = [QtCore.QEvent.Wheel]
if hasattr(QtCore.QEvent, 'NativeGesture'):
self._pager_scroll_events.append(QtCore.QEvent.NativeGesture)

# Create the layout and underlying text widget.
layout = QtGui.QStackedLayout(self)
layout.setContentsMargins(0, 0, 0, 0)
Expand Down Expand Up @@ -364,17 +371,11 @@ def eventFilter(self, obj, event):
QtGui.qApp.sendEvent(obj, QtGui.QDragLeaveEvent())
return True

# Handle scrolling of the vsplit pager. This hack attempts to solve the
# problem of tearing of the pager window's help text on Mac OS X. This
# happens with PySide and PyQt. This fix isn't perfect but makes the
# pager more usable.

# FIXME: this line, on qt 4.8.5, crashes b/c NativeGesture is not
# available. Disabling for now, until we sort out a cleaner solution.
# See https://github.com/ipython/ipython/pull/1150 for details.
#elif etype in [QtCore.QEvent.Wheel, QtCore.QEvent.NativeGesture] and \

elif etype == QtCore.QEvent.Wheel and \
# Handle scrolling of the vsplit pager. This hack attempts to solve
# problems with tearing of the help text inside the pager window. This
# happens only on Mac OS X with both PySide and PyQt. This fix isn't
# perfect but makes the pager more usable.
elif etype in self._pager_scroll_events and \
obj == self._page_control:
self._page_control.repaint()
return True
Expand Down