Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

QtConsole zoom adjustments #494

Closed
wants to merge 3 commits into from

3 participants

@mspacek

don't set point size less than 1 in ConsoleWidget: fixes #493
adjust/add key binding for zoom out/reset.

@minrk
Owner

Thanks for the catch, but if we are putting a limit, shouldn't it be more like 4? I don't think there's any use to letting people set the font size to illegibly small sizes.

@mspacek

Good point. But sometimes I find it can be nice to shrink the font as much as possible so you can get a really high level view of the whole thing - indentation, paragraphs, etc.. Of course, you can't read 1 pt text, but you can't really read 4 pt text either.

@mspacek

While I'm at it, I have another couple of commits, one which binds Ctrl+0 to restore the default font size, and another that changes the increase font size key binding from Ctrl++ to Ctrl+= (which means you don't have to hit the shift key). Seems like a good fit here, but maybe they won't be accepted as quickly. Should I make yet another branch for those?

@minrk
Owner

Fair enough - 4pt legibility depends on the typeface, but 1pt is just lines. Leaving it at 1 is fine for the zoom-out use (I guess that's why you are the first to notice this error).

@minrk
Owner

Go ahead and do it here - I'll just rename the PR to reflect the change.

@minrk
Owner

On the issue of +/=, I would make it work with both, rather than changing it to the exclusion of '+'.

@mspacek

That last commit is maybe controversial. QtGui.qApp.font().pointSize() seems to return 9 on my system, which I find too small. 9 pt is what I use as an application/document/desktop font in Ubuntu, but for fixed-width I use 10 pt or more. I don't suppose there's a way to automatically find the system's fixed-width font is there? Or perhaps having a _default_font_size attrib will be useful for the config system anyway?

@minrk
Owner

The default fontsize will be configurable once #492 is merged, so I would rollback that commit.

@minrk
Owner

Also, the hardcoding of a default value is not a great idea, because the logical default size will depend on the system display DPI. For instance, on my Mac, Qt's default font size is 13, and on my Ubuntu machine it's 8. Both appear about the same size.

@mspacek

OK. I think I rolled it back correctly. I used git reset --hard HEAD~1followed by git push --force upstream. Git stresses me out :)

@minrk
Owner

Yes, looks like you did it right. When I rollback, I often just paste the commit hash I want to reset to: git reset --hard <hash> and git push -f.

This looks good to me, thanks!

@epatters, any objections?

@epatters

Looks good to me. Thanks for the fix.

@minrk minrk referenced this pull request from a commit
@minrk minrk Merge PR #494
closes gh-494
657504e
@minrk minrk closed this pull request from a commit
@minrk minrk Merge PR #494
closes gh-494
657504e
@minrk minrk closed this in 657504e
@ellisonbg ellisonbg referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@damianavila damianavila referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
@minrk minrk Merge PR #494
closes gh-494
4066cc2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 7 additions and 2 deletions.
  1. +7 −2 IPython/frontend/qt/console/console_widget.py
View
9 IPython/frontend/qt/console/console_widget.py
@@ -598,7 +598,8 @@ def change_font_size(self, delta):
"""Change the font size by the specified amount (in points).
"""
font = self.font
- font.setPointSize(font.pointSize() + delta)
+ size = max(font.pointSize() + delta, 1) # minimum 1 point
+ font.setPointSize(size)
self._set_font(font)
def select_all(self):
@@ -989,7 +990,7 @@ def _event_filter_console_keypress(self, event):
elif key in (QtCore.Qt.Key_Backspace, QtCore.Qt.Key_Delete):
intercepted = True
- elif key == QtCore.Qt.Key_Plus:
+ elif key in (QtCore.Qt.Key_Plus, QtCore.Qt.Key_Equal):
self.change_font_size(1)
intercepted = True
@@ -997,6 +998,10 @@ def _event_filter_console_keypress(self, event):
self.change_font_size(-1)
intercepted = True
+ elif key == QtCore.Qt.Key_0:
+ self.reset_font()
+ intercepted = True
+
#------ Alt modifier ---------------------------------------------------
elif alt_down:
Something went wrong with that request. Please try again.