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

Add shortcut to close plugin manager dialog and quit application #64

Merged
merged 8 commits into from
Jul 16, 2024

Conversation

goanpeca
Copy link
Contributor

@goanpeca goanpeca commented Jun 24, 2024

Fixes #38
Fixes #4

Add shortcut to close plugin manager dialog on mac systems (Cmd+W) and quit application on all other systems (Ctrl+Q)

@goanpeca goanpeca self-assigned this Jun 24, 2024
@goanpeca goanpeca requested a review from psobolewskiPhD June 24, 2024 03:53
@goanpeca goanpeca changed the title Add shortcut to close plugin manager dialog on max systems Add shortcut to close plugin manager dialog on mac systems Jun 24, 2024
Copy link

codecov bot commented Jun 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.10%. Comparing base (e1cee5e) to head (78df5c2).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
+ Coverage   86.89%   87.10%   +0.21%     
==========================================
  Files           9        9              
  Lines        1343     1365      +22     
==========================================
+ Hits         1167     1189      +22     
  Misses        176      176              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Czaki
Copy link
Contributor

Czaki commented Jun 24, 2024

Why only on macos system?

@goanpeca
Copy link
Contributor Author

Why only on macos system?

Hi @Czaki, the Cmd+W is a mac only thing as far as I know.

The quit application one, does work for all systems

@goanpeca goanpeca changed the title Add shortcut to close plugin manager dialog on mac systems Add shortcut to close plugin manager dialog on mac systems (Cmd+W) and quit application on all other systems (Ctrl+Q) Jun 24, 2024
@goanpeca goanpeca changed the title Add shortcut to close plugin manager dialog on mac systems (Cmd+W) and quit application on all other systems (Ctrl+Q) Add shortcut to close plugin manager dialog and quit application Jun 24, 2024
@Czaki
Copy link
Contributor

Czaki commented Jun 24, 2024

it is for all system

obraz

There was a bug in the past that removed shortcut, but on main it is for all os.

@psobolewskiPhD
Copy link
Member

psobolewskiPhD commented Jun 24, 2024

Command-W works nice! Huge improvement!
And yea, I think Control-W is also used on Windows to close stuff like tabs, so I'd make that one work on all systems to close the dialog.
I used Command-Q, which worked, but I was somewhat surprised it just straight quit, without the usual warning/confirmation.

I think it would be best to have that confirmation/dialog for consistency, so users arn't shocked like I was and lose data. But frankly, we could drop that -- it's not odd to have to close the dialog before quitting application, I don't think.

@Czaki
Copy link
Contributor

Czaki commented Jun 24, 2024

I used Command-Q, which worked, but I was somewhat surprised it just straight quit, without the usual warning/confirmation.

Command+W/Q do not ask for confirmation if there is no layer.

@psobolewskiPhD
Copy link
Member

running napari from terminal and then Command-Q I get asked to confirm.

@Czaki
Copy link
Contributor

Czaki commented Jun 24, 2024

running napari from terminal and then Command-Q I get asked to confirm.

You are right, for command+Q should always be a confirmation if not disabled in settings...

@jaimergp
Copy link
Contributor

Isn't the usual Quit shortcut Alt+F4 in Windows? Or is that no longer recommended?

@Czaki
Copy link
Contributor

Czaki commented Jun 25, 2024

Isn't the usual Quit shortcut Alt+F4 in Windows? Or is that no longer recommended?

Alt + F4 is system shoutcut, not application one.

@goanpeca
Copy link
Contributor Author

Hello team, thanks for testing and comments, will leave then the shortcut for all systems, and check about the confirmation dialog :)

Cheers!

@goanpeca
Copy link
Contributor Author

@Czaki and @psobolewskiPhD I have added a fix to emulate the current behavior of Cmd+Q of napari.

Could you please check :) ?

@goanpeca goanpeca requested a review from Czaki July 10, 2024 04:39
@jaimergp jaimergp requested a review from dalthviz July 10, 2024 22:08
@goanpeca
Copy link
Contributor Author

Could you check this one @dalthviz ? Thanks !

@dalthviz
Copy link
Member

Gave this a check on Windows and this is what I'm seeing:

Confirm config + number of layers\Shortcut Ctrl+W Ctrl+Q
Confirm dialog enabled without layers close_confirm_ctrl_w close_confirm_ctrl_q
Confirm dialog enabled with one layer close_confirm_ctrl_w_with_layer close_confirm_ctrl_q_with_layer
Confirm dialog disabled without layers close_no_confirm_ctrl_w close_no_confirm_ctrl_q
Confirm dialog disabled with one layer close_no_confirm_ctrl_w_with_layer close_no_confirm_ctrl_q_with_layer

So I would say that this is fixing the mentioned issues 👍

However, something that maybe is worthy to carefully think about (probably related with napari/napari#6993) is that since actions (install/uninstall) continue running even after the dialog closes, you can end up seeing a message like:

WARNING: QProcess: Destroyed while process ("C:\\Users\\dalth\\anaconda3\\envs\\napari-dev\\python.exe") is still running.

By triggering the shortcuts two consecutive times or even by executing the Ctrl+Q only once if the confirmation dialog is disabled when you previously started an install or uninstall plugin action from the plugin dialog

@jaimergp
Copy link
Contributor

By triggering the shortcuts two consecutive times or even by executing the Ctrl+Q only once if the confirmation dialog is disabled when you previously started an install or uninstall plugin action from the plugin dialog

Yes I guess we will need #56 and napari/napari#6993 for this. Tracking issue is #53.

@goanpeca
Copy link
Contributor Author

Awesome, so this looks like it is good to go. Should I merge? or should someone besides the author do it :) ?

@jaimergp
Copy link
Contributor

We can merge but we should also investigate that numpy 2 breakage.

@goanpeca goanpeca merged commit 5027417 into napari:main Jul 16, 2024
12 checks passed
@goanpeca goanpeca added the enhancement New feature or request label Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
5 participants