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

Python console shortcuts #51913

Merged
merged 3 commits into from
Feb 21, 2023
Merged

Conversation

YoannQDQ
Copy link
Contributor

Fixes #51732

Description

When writting code in a Python Console Editor, pressing Ctrl+S triggers the Save Project action instead of the save script action.

This PR uses QEvent.ShortcutOverride to override the following shortcuts:

  • Ctrl+W: close current tab
  • Ctrl+Shift+W: close all tabs
  • Ctrl+S: save current tab
  • Ctrl+Shift+S: save current tab as
  • Ctrl+T: open new tab
  • Ctrl+Tab: Iter over tabs

Thus, when the Editor has focus, application QAction/QShortcut that share these KeySequences are ignored in favor of the Editor actions.

@github-actions github-actions bot added the Python Console Python Console label Feb 17, 2023
@github-actions github-actions bot added this to the 3.30.0 milestone Feb 17, 2023
@nyalldawson nyalldawson merged commit 9c56921 into qgis:master Feb 21, 2023
@YoannQDQ YoannQDQ deleted the python-console-shortcuts branch February 21, 2023 13:46
@nyalldawson
Copy link
Collaborator

@YoannQDQ I'm getting an exception after this PR when trying to save a python script via the toolbar button -- 'EditorTab' object has no attribute 'save'

@agiudiceandrea
Copy link
Contributor

Hi @YoannQDQ, please see #57071,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Python Console Python Console
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python Console Editors are not deleted when closed
3 participants