Skip to content
This repository

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 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 December 14, 2011
Prabhu Ramachandran 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 December 13, 2011
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 December 13, 2011
Commit has since been removed from the repository and is no longer available.
Fernando Perez fperez referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Fernando Perez fperez referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 14, 2011
Prabhu Ramachandran 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
This page is out of date. Refresh to see the latest.
10  IPython/frontend/qt/console/console_widget.py
@@ -364,6 +364,14 @@ def eventFilter(self, obj, event):
364 364
             QtGui.qApp.sendEvent(obj, QtGui.QDragLeaveEvent())
365 365
             return True
366 366
 
  367
+        # Handle scrolling of the vsplit pager. This hack attempts to solve the
  368
+        # problem of tearing of the pager window's help text on Mac OS X.  This
  369
+        # happens with PySide and PyQt. This fix isn't perfect but makes the
  370
+        # pager more usable.
  371
+        elif etype in [QtCore.QEvent.Wheel, QtCore.QEvent.NativeGesture] and \
  372
+                obj == self._page_control:
  373
+            self._page_control.repaint()
  374
+            return True
367 375
         return super(ConsoleWidget, self).eventFilter(obj, event)
368 376
 
369 377
     #---------------------------------------------------------------------------
@@ -965,6 +973,8 @@ def _create_page_control(self):
965 973
         elif self.kind == 'rich':
966 974
             control = QtGui.QTextEdit()
967 975
         control.installEventFilter(self)
  976
+        viewport = control.viewport()
  977
+        viewport.installEventFilter(self)
968 978
         control.setReadOnly(True)
969 979
         control.setUndoRedoEnabled(False)
970 980
         control.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.