-
-
Notifications
You must be signed in to change notification settings - Fork 409
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
fix: menu item enablement issues #1750
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this PR causes a change in the behavior of the buttons. I think the new behavior is reasonable, but it was not mentioned in the PR description so I thought it was worth mentioning in case it was unintended/unwanted.
I seem to remember we discussed the idea of having this behavior some time ago and it was rejected, but I might be misremembering and I don't have a strong preference for either behavior.
Behavior of IDE from main
When the user triggers an "Upload" operation in any of the builds from the main
branch, the "Upload" button, and only that button, is given the active coloration during the entire course of the operation (which includes both a compile and an upload phase):
Behavior of IDE from PR
When the user triggers an "Upload" operation using the build from this PR, in addition to the "Upload" button having the active coloration during the entire course of the operation, the "Compile" button is given the active coloration during the compile phase of the "Upload" operation:
Great that you have mentioned it. I did not plan to change it. We can restore what we have on the
Yes. The thread is starting here: #1260 (review) Let me know how to proceed. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kittaakos I've been giving it some more thought and I think the behavior of the button coloration in the builds from main
is better. I think it is good to give the user some feedback about the progress thought the phases of the "Upload" operation to the user (as is already done to some extent via the notifications), but I don't think button coloration is the right way to do that. If I click a button, I don't expect another button to show an activation state.
Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
I have restored the toolbar behavior. Now, it should be the same as on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I verified that:
- "Sketch > Upload" menu item disabled after upload w/ Serial Monitor open #1722 is fixed
- Added menu item disabling when allowing user access would be inappropriate is working as specified.
- Verify button behavior on Upload is the same as the builds from
main
Thanks Akos!
Motivation
Fixes the
Sketch
>Upload
/Upload Using Programmer
menu items enablement. This PR is related to #1735 and covers #1533.IDE2 switched from always-enabled menu items to dynamic ones with this change and here is the crucial part.
Without rebuilding the entire menu, there is no way to support a dynamic menu in an electron app. So in Theia, the menu is calculated at startup, and all menu items are always enabled even though the underlying commands could be disabled. The menu remains the same for the app session—no need to rebuild anything, but the command enablement can change at runtime. If a menu is enabled and the underlying command is disabled, nothing happens when the user clicks on the menu item. This is the vanilla Theia behavior.
IDE2 heavily relies on dynamic menus. IDE2 has to recalculate the menu on board attach/detach, selection change, library/platform installation uninstallation, etc., events. A dynamic menu with the correct menu items enablement state is something IDE2 could provide without much additional effort if it were done correctly. See #1533.
This PR cleans up the placeholder menu items, makes the menu items rely on the command enablement state, and "manually" updates the menus when needed.
Change description
The following logic was changed:
Edit
>Increase Font Size
/Decrease Font Size
(no behavior change is expected),Tools
>Upload SSL Root Certificates
(disabled when the dialog is opened),Tools
>WiFi101 / WiFiNINA Firmware Updater
(disabled when the dialog is opened),Sketch
>Verify/Compile
(disabled when verifying),Sketch
>Export Compiled Binary
(disabled when verifying),Sketch
>Upload
(disabled when uploading),Sketch
>Configure and Upload
(disabled when uploading), andSketch
>Upload Using Programmer
(disabled when uploading)Other expected behavior changes (my PR is a proposal, I am happy to adjust if required)
Sketch
>Verify/Compile
is disabled,Sketch
>Export Compiled Binary
is also disabled and vice versa.Sketch
>Upload
is disabled,Sketch
>Upload Using Programmer
is also disabled and vice versa. The same is true forSketch
>Configure and Upload
.Sketch
>Verify/Compile
andSketch
>Export Compiled Binary
are disabled.Sketch
>Verify/Compile
andSketch
>Export Compiled Binary
menu items are enabled, but theSketch
>Upload
,Sketch
>Upload Using Programmer
, andSketch
>Configure and Upload
menu items are still disabled until the end of the upload command.Finally, this PR eliminates the following warning on macOS, maybe on other OSs too. Can be reproduced when starting the IDE2 from a terminal, and the
window
receives ablur
and thenfocus
event. (Lose focus from IDE2 app, set focus to IDE2 app):This PR has no intention changing anything regarding the command/menu enablement in the toolbar.
Other information
Closes #1533
Closes #1722
Reviewer checklist