Skip to content

Add more arguments for edit string popups#129

Open
MattRoyle wants to merge 4 commits intonion-software:masterfrom
MattRoyle:edit-string
Open

Add more arguments for edit string popups#129
MattRoyle wants to merge 4 commits intonion-software:masterfrom
MattRoyle:edit-string

Conversation

@MattRoyle
Copy link
Copy Markdown

@MattRoyle MattRoyle commented Mar 25, 2026

Adds arguments for the window style and Cancel and Done buttons.
Remove unnecessary call to __request_close_fn in reject that caused a console error when clicking escape.
If either button is a string then it will display the buttons, otherwise it will have the existing behavior of not having buttons.

@MattRoyle MattRoyle requested a review from cmeyer March 25, 2026 16:51
@MattRoyle MattRoyle self-assigned this Mar 25, 2026
@MattRoyle MattRoyle force-pushed the edit-string branch 2 times, most recently from cc4574c to 5d0e5a5 Compare March 26, 2026 16:21
Copy link
Copy Markdown
Collaborator

@cmeyer cmeyer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On macOS, it looks like this.

Image

On Windows, it looks like this.

Image

On both platforms, the Escape key no longer works - as expected since the self.__request_close_fn() was removed.

Tested from console with this script:

from nion.ui import Dialog
Dialog.pose_edit_string_pop_up("X", lambda x: None, window=_window)

I would recommend:

  • switch back to the old style window that does not have close/min/max buttons.
  • model it after .Net MessageBox function
  • restore the escape handling.

I cannot reproduce the escape-triggering-console message problem - so let's try to reproduce that reliably and fix it separately before this PR.

@MattRoyle
Copy link
Copy Markdown
Author

On both platforms, the Escape key no longer works - as expected since the self.__request_close_fn() was removed.

Tested from console with this script:

from nion.ui import Dialog
Dialog.pose_edit_string_pop_up("X", lambda x: None, window=_window)

The script you ran was hadn't set the window_style so it was defaulting to a window vs if you pass in a "default" it will be the modeless style. The modeless style would throw the console error when return was pressed, while the window would behave properly. I updated the code to check that the window style is not "default" before running the close function which means the escape now should work again in your tests. If there are any other dialog options that cause that error, i.e. that don't make a window, then it should check those too, but I haven't done that yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants