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

preferences.txt is not saved when closing Processing under certain circumstances #608

Closed
processing-bot opened this issue Nov 27, 2022 · 4 comments

Comments

@processing-bot
Copy link
Collaborator

Created by: Zetrypio

Description

When I close Processing using the button on the right of the window title bar or by pressing Alt-F4, changes to preferences (except language for some reasons) are not saved after a restart. The problem also include the Welcome Screen and the Theme Selector (see below). However, there are no problems if I close using Menu Bar -> File -> Quit or by pressing Ctrl-Q.

Expected Behavior

Preferences should be saved whatever the way I close Processing.

Current Behavior

Preferences are not saved when I close Processing using the button on the right of the window title bar or by pressing Alt-F4.
This includes:

  • Preferences from the Preference Window (except language selection)
  • The Welcome Screen (if I close that window using the button on the right of the window title bar or by pressing Alt-F4 (and not by the "Get Started" button), and then closing Processing the same way)
  • Theme Selection (however this has been fixed in Theme is not kept after relaunch #565 by another way, but it was exactly the same base problem (if you look closely in the comments from the original poster of that issue, you will see that the problem was there, because changing the font size was also not saved)).
  • Basically, every things that are saved in preferences.txt and that are editable from Processing itself (except language selection).

Steps to Reproduce

These steps assume the Welcome Screen is disabled at the start.

  1. Open a new instance of Processing and go to Preferences
  2. Change some preferences (it doesn't matter if these needs a restart or not)
  3. You may also change the language
  4. Close the preference window using the "Ok" button at the bottom of the preference window
  5. Close Processing using the button on the right of the window title bar or by pressing Alt-F4
  6. Restart Processing
  7. You should see in Preferences that only the language has been updated. If you didn't do step 3, you should see that nothing has been saved.
  8. Change some other Preferences
  9. Close the preference window using the "Ok" button at the bottom of the preference window
  10. Close Processing using Menu Bar -> File -> Quit or by pressing Ctrl-Q
  11. Restart Processing
  12. You should see in Preferences that this time everything has been updated.
  13. Now, go to Menu Bar -> Help -> Welcome to Processing to show the welcome screen
  14. Tick the box to "Show this message on startup" so it is now active (assuming it was not active before).
  15. Close the Welcome Screen using the button on the right of the window title bar or by pressing Alt-F4
  16. Close Processing using the button on the right of the window title bar or by pressing Alt-F4
  17. Restart Processing
  18. You should see that the Welcome Screen is NOT present.
  19. Go back to the Welcome Screen and re-enable it once again.
  20. Either
  • a) Close the Welcome Screen using the button on the right of the window title bar or by pressing Alt-F4 then close Processing using Menu Bar -> File -> Quit or by pressing Ctrl-Q
  • b) Or close the Welcome Screen using the "Get Started" button and then close Processing (any ways are possible here)
  1. Restart Processing
  2. This time, you should see the Welcome Screen shows up correctly.

Your Environment

  • Processing version: Processing 4.0.2
  • Operating System and OS version: Windows 10 22H2
  • Other information: This problem is not happening to me with Processing 3.x, but it is happening in Processing 4.0.1, and one of the beta for Processing 4 that I once tested before (don't remember which one). I've also asked another person who just installed Processing on Windows 11 and that person had the exact same problem.

Possible Causes / Solutions

The Preference.save() method is not executed when the user closes Processing whatever the way.
Doing the saving in the Preference window and the Welcome Screen is a good idea, but that only may not be sufficient since it means that this problem can be raised again in the future if another window needs to save some preferences.

@processing-bot
Copy link
Collaborator Author

Created by: benfry

From what I understand of the report, this sounds like the correct behavior: closing the Preferences window without confirming (without clicking OK) will not save any changes. Closing the Preferences window or quitting the application (which just closes the window) is the same as clicking Cancel.

This is standard UI behavior, not a Processing thing. I can't find an exact reference, but this has related information: https://learn.microsoft.com/en-us/windows/win32/appuistart/-user-interface-principles#use-custom-message-boxes

The bug here is that it's actually changing the language preference even without confirmation, but the language setting is much more complicated. I could add extra code to only change that after hitting OK if someone feels strongly that it's a significant problem, but it seems like a much lower priority.

@processing-bot
Copy link
Collaborator Author

Created by: Zetrypio

I think there has been a misunderstanding here.

closing the Preferences window without confirming (without clicking OK) will not save any changes

This is NOT what I've reported, look steps 4 and 9 clearly describe to close the Preferences window with the OK button:

  1. Close the preference window using the "Ok" button at the bottom of the preference window

When later I said to close the window with Alt-F4 or the close button of the title bar (step 5), I was NOT talking about the Preferences window, but the main Processing window AFTER CONFIRMATION of the preference changes and the closing of the Preferences window.

Carefully look at steps 4, 5, 6 and 9, 10, 11. See the difference between 5 and 10 are NOT on the Preferences window, and these steps are always AFTER having confirmed and saw changes of preferences.

One user would expect that after changing preferences like font size, confirming with OK and then seeing the new font size in the editor, that should be persistent after a full restart of Processing, whatever the way the main Processing window was closed.

The bug here is that it's actually changing the language preference even without confirmation

Once again, this is not what I've reported, because I am confirming the preference changes, and the language changes are in fact the only changes that do work correctly.
When I try to change but then cancel it, it does not apply which is intended, even after restart.
When I try to change and then confirm it, it does apply on restart, which is also intended.

I may be wrong about the behavior this should have, but I also am under the impression that you had not correctly understood what the problem I was talking really was, and that there is a problem in the saving of preferences.

Another point is the fact that this bug was not present in Processing 3.x for me, so this is an inconsistency between the 2 versions.

Every other applications that I know saves preferences when confirming them, even if I close the main window with Alt-F4 or the close button in the title bar AFTER confirming those preferences.

What I think is that there should be a call to Preferences.save() when clicking on OK on the preferences pages.

What is weirder is the Welcome Screen. It is not saving changes only when both the Welcome Screen and the main Processing window are closed with the close button of the window (or Alt-F4).

@processing-bot
Copy link
Collaborator Author

Created by: benfry

Got it, thanks. Fixed for 4.1.3.

@processing-bot
Copy link
Collaborator Author

Created by: github-actions[bot]

This issue has been automatically locked. To avoid confusion with reports that have already been resolved, closed issues are automatically locked 30 days after the last comment. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 17, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant