nextfoam / baram

CFD for Everyone
https://baramcfd.org/
GNU General Public License v3.0
72 stars 16 forks source link

Proposal for Implementing Keyboard Shortcuts and Menu Access Keys #72

Open kjrstory opened 2 months ago

kjrstory commented 2 months ago

I propose the implementation of keyboard shortcuts and menu access keys to enhance the usability of baram. Please refer to the image below.

Shortcut

Firstly, access keys enable direct access to submenus by pressing Alt+ the first letter of each menu item. For instance, pressing Alt+F will display the submenu under File as shown in the image.

Shortcuts facilitate direct actions. For example, Ctrl+N, Ctrl+O, Ctrl+S, and Ctrl+Q are set to perform specific actions. Pressing Ctrl+N will have the same effect as clicking File->New.

Access keys can be easily added in the UI file by including an ampersand (&) before the relevant letter in the menu item names. Setting up shortcuts involves adding a few lines of code (likely less than 20 lines) in the main_window.py file, such as:

self._ui.actionNew.setShortcut('Ctrl+N')

The functionality of these proposals has been confirmed by modifying the actual files. If this proposal sounds good, I am ready to make PRs to both baramMesh and Flow.

jiban commented 2 months ago

That sounds good. Please go on. Thank you for your interest in BARAM.

Jake

kjrstory commented 2 months ago

I only applied shortcut keys for frequently used main menu commands. (PR #73) But, shortcut keys are also required for commands other than the main menu, and if there are shortcut keys that overlap with other shortcut keys or better shortcut keys for each command, I would like to leave this issue open for suggestions. The shortcut keys reflected so far are summarized as follow

Shortcuts

Command Shortcut
New Project Ctrl+N
Open Project Ctrl+O
Save Project Ctrl+S
Exit Program Ctrl+Q
Set Parallel Environment Ctrl+P
Set Language Ctrl+L
Command Shortcut
Save Project Ctrl+S
Save as Project Ctrl+A
Close Project Ctrl+E
Exit Program Ctrl+Q
Set Parallel Environment Ctrl+P
Set Language Ctrl+L
Open ParaView Ctrl+V