Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

BUG: Scrolling pager in vsplit on Mac OSX tears. #1150

Closed
wants to merge 1 commit into from

4 participants

Prabhu Ramachandran Fernando Perez Min RK Evan Patterson
Prabhu Ramachandran

On Mac OS X, scrolling the pager when it is split vertically causes the
help text to tear (i.e. the help text is unreadable). This hack
attempts to make it a little better although the solution may not be
optimal at all.

Prabhu Ramachandran prabhuramachandran BUG: Scrolling pager in vsplit on Mac OSX tears.
On Mac OS X, scrolling the pager when it is split vertically causes the
help text to tear (i.e. the help text is unreadable).  This hack
attempts to make it a little better although the solution may not be
optimal at all.
90bac7b
Fernando Perez
Owner

This sounds pretty serious, but since I don't see the problem on linux and don't have a mac to test on, I'd like a second pair of eyes. @minrk, could you confirm that you see the problem if you start the Qt console with --paging=vsplit and that this fix works?

If it does indeed fix the problem for you, I'm OK merging it before 0.12 as it's pretty small and obviously having an unusable pager is a serious problem.

Min RK
Owner

I have seen it in the past, but can't seem to reproduce it right now. I'm a little sqeemish, but only because I just don't understand Qt enough to be 100% sure there are no side effects. That said, I don't see anything wrong with this one.

Fernando Perez fperez closed this pull request from a commit
Prabhu Ramachandran prabhuramachandran BUG: Scrolling pager in vsplit on Mac OSX tears.
On Mac OS X, scrolling the pager when it is split vertically causes the
help text to tear (i.e. the help text is unreadable).  This hack
attempts to make it a little better although the solution may not be
optimal at all.

Closes #1150, rebased to prevent recursive merge.
d0119c4
Fernando Perez fperez closed this in d0119c4
Fernando Perez
Owner

Thanks, @prabhuramachandran! Checked with @minrk over IRC and it looks good so far.

Merged with a rebase to prevent the recursive merge.

@epatters, if you spot any problems with this after the fact, let us know and we can always fine-tune things between the 0.12 RC and the release.

Fernando Perez
Owner

Mmh, I should have tested this more carefully in addition to @minrk's OSX tests. On my version of Qt (system one in ubuntu 11.10, version 4.8.5-0ubuntu2), this crashes the qt console with this traceback:

Traceback (most recent call last):
  File "/home/fperez/tmp/junk/lib/python2.7/site-packages/IPython/frontend/qt/console/console_widget.py", line 371, in eventFilter
    elif etype in [QtCore.QEvent.Wheel, QtCore.QEvent.NativeGesture] and \
AttributeError: type object 'QEvent' has no attribute 'NativeGesture'

I've committed a quick fix in 12676e5 for now, so I can release 0.12.rc1 with a working Qt console. @prabhuramachandran, feel free to submit a new PR that restores the functionality you needed, but without accessing NativeGesture unconditionally, which seems to be a new API (or perhaps available only on certain OSes).

Prabhu Ramachandran

@fperez, Sorry, I should have tested under Linux and Windows. I will work on a fix. The issue is platform specific it seems and occurs with PyQt and PySide on the mac. I will make the check platform specific. NativeGesture also seems relatively poorly documented so I cannot find too much information online about it. There is apparently a build time flag -native-gestures/-no-native-guestures, which makes this that much more irritating. I might have to check using hasattr given the lack of documentation. I will test it this time though. Thanks!

Fernando Perez
Owner

Great, thanks. I'm hoping to push 0.12 final over the weekend (I have a trip next week) and Ilan said he'd be testing it for inclusion in the next EPD. So just send us a PR any time with the fixes, and we should be able to merge it before 0.12 final.

Evan Patterson
Collaborator

@prabhuramachandran, the issue is indeed specific to Qt on OS X, but it is not specific to the Qt console. For example, you can see the tearing in a QMessageBox with detailText long enough to create a scrollbar (try the kernel crash dialog in Canopy).

It would be nice if there was a global fix for this, but I haven't done any research yet.

Prabhu Ramachandran prabhuramachandran referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Fernando Perez fperez referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Fernando Perez fperez referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
Yaroslav Halchenko yarikoptic referenced this pull request from a commit in yarikoptic/ipython
Yaroslav Halchenko yarikoptic Merge commit 'rel-0.11-1399-g2c683b7' into debian-01X
* commit 'rel-0.11-1399-g2c683b7': (5033 commits)
  don't catch potential NameErrors in showtraceback()
  protect flush_figures post-exec function from user error
  Don't unregister failing post-exec callbacks automatically
  BUG: Scrolling pager in vsplit on Mac OSX tears.
  Display figures with no axes but lines, which are also valid.
  Fix upload tool to automatically create directories.
  Fix spacing of notebook logo.
  BUG: Ctrl+K and Ctrl+U shortcuts unsafe in Qt console.
  Disable part of #1150 that was crashing the console on ubuntu with qt 4.8.5.
  Change version number to 0.12.rc1 to push the RC out.
  Correctly set read_only meta name for use in javascript.  Note that this has a different meaning than in the Python code: not whether the read-only flag was specified upon launch, but whether the notebook is in read-only mode and input should be disabled.
  allow access to user_ns in prompt_manager
  Hide top login/logout buttons on login/logout pages.
  Split read-only logic into three functions: read_only, logged_in, and login_available.  Move display logic from javascript into templates.
  Improve three-state read-only logic.
  On the login page, focus on the password field.
  Redirect to front page upon read-only logout.
  Display login button in read-only mode.
  updated vim-ipython
  replace "Yes, close all" button text with 'Quit'
  ...
56656cf
matthew von rocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
Prabhu Ramachandran prabhuramachandran BUG: Scrolling pager in vsplit on Mac OSX tears.
On Mac OS X, scrolling the pager when it is split vertically causes the
help text to tear (i.e. the help text is unreadable).  This hack
attempts to make it a little better although the solution may not be
optimal at all.

Closes #1150, rebased to prevent recursive merge.
7f28872
matthew von rocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
Fernando Perez fperez Disable part of #1150 that was crashing the console on ubuntu with qt…
… 4.8.5.
5617a3d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 13, 2011
  1. Prabhu Ramachandran

    BUG: Scrolling pager in vsplit on Mac OSX tears.

    prabhuramachandran authored
    On Mac OS X, scrolling the pager when it is split vertically causes the
    help text to tear (i.e. the help text is unreadable).  This hack
    attempts to make it a little better although the solution may not be
    optimal at all.
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 IPython/frontend/qt/console/console_widget.py
10 IPython/frontend/qt/console/console_widget.py
View
@@ -364,6 +364,14 @@ 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.
+ elif etype in [QtCore.QEvent.Wheel, QtCore.QEvent.NativeGesture] and \
+ obj == self._page_control:
+ self._page_control.repaint()
+ return True
return super(ConsoleWidget, self).eventFilter(obj, event)
#---------------------------------------------------------------------------
@@ -965,6 +973,8 @@ def _create_page_control(self):
elif self.kind == 'rich':
control = QtGui.QTextEdit()
control.installEventFilter(self)
+ viewport = control.viewport()
+ viewport.installEventFilter(self)
control.setReadOnly(True)
control.setUndoRedoEnabled(False)
control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
Something went wrong with that request. Please try again.