Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

BUG: Completion widget position and pager focus. #862

Closed
wants to merge 1 commit into from

2 participants

@prabhuramachandran

When the console widget is used with gui-completion, the positioning of
the completion widget was incorrect the first time a completion was
performed since the size of the widget is initially bogus. Using
sizeHint fixes this. If the paging mode is set to vsplit/hsplit, the
focus was lost after the pager is quit.

@prabhuramachandran prabhuramachandran BUG: Completion widget position and pager focus.
When the console widget is used with gui-completion, the positioning of
the completion widget was incorrect the first time a completion was
performed since the size of the widget is initially bogus.  Using
sizeHint fixes this.  If the paging mode is set to vsplit/hsplit, the
focus was lost after the pager is quit.
4f11d31
@fperez
Owner

Note: I can't reproduce the two problems you describe in my limited testing with PyQt. Perhaps the first is a function of window size/position on the desktop or size of the completion list itself. As for the second, I have no idea why I don't see the problem.

Having said that, I also don't see any problems with the code itself, and the explicit focus reset can't hurt even for those users who weren't seeing the problem. So I'm merging now, many thanks for the contribution!

@fperez
Owner

Merged (with rebase to avoid a recursive merge for just one commit), pushed.

@fperez fperez closed this
@prabhuramachandran

The first seems to occur when the console is embedded into another application and can be triggered if the console is too close to the bottom of the screen. The second occurs when you have other widgets along with the console (only then would a loss of focus become painfully obvious). I guess I should have created a simple standalone app to demonstrate this. Thanks for merging regardless though, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Oct 12, 2011
  1. @prabhuramachandran

    BUG: Completion widget position and pager focus.

    prabhuramachandran authored
    When the console widget is used with gui-completion, the positioning of
    the completion widget was incorrect the first time a completion was
    performed since the size of the widget is initially bogus.  Using
    sizeHint fixes this.  If the paging mode is set to vsplit/hsplit, the
    focus was lost after the pager is quit.
This page is out of date. Refresh to see the latest.
View
5 IPython/frontend/qt/console/completion_widget.py
@@ -86,10 +86,11 @@ def show_items(self, cursor, items):
text_edit = self._text_edit
point = text_edit.cursorRect(cursor).bottomRight()
point = text_edit.mapToGlobal(point)
+ height = self.sizeHint().height()
screen_rect = QtGui.QApplication.desktop().availableGeometry(self)
- if screen_rect.size().height() - point.y() - self.height() < 0:
+ if screen_rect.size().height() - point.y() - height < 0:
point = text_edit.mapToGlobal(text_edit.cursorRect().topRight())
- point.setY(point.y() - self.height())
+ point.setY(point.y() - height)
self.move(point)
self._start_position = cursor.position()
View
1  IPython/frontend/qt/console/console_widget.py
@@ -1261,6 +1261,7 @@ def _event_filter_page_keypress(self, event):
elif key in (QtCore.Qt.Key_Q, QtCore.Qt.Key_Escape):
if self._splitter:
self._page_control.hide()
+ self._control.setFocus()
else:
self.layout().setCurrentWidget(self._control)
return True
Something went wrong with that request. Please try again.