Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Publisher: Do not show help dialog when pressing enter#5838

Closed
BigRoy wants to merge 5 commits intoynput:developfrom
BigRoy:enhancement/publisher_enter_key_no_help_dialog
Closed

Publisher: Do not show help dialog when pressing enter#5838
BigRoy wants to merge 5 commits intoynput:developfrom
BigRoy:enhancement/publisher_enter_key_no_help_dialog

Conversation

@BigRoy
Copy link
Copy Markdown
Collaborator

@BigRoy BigRoy commented Oct 30, 2023

Changelog Description

Do not show help dialog when pressing enter; avoid Help button taking focus

Additional info

Fix #5791

Testing notes:

  1. Pressing enter key in e.g. variant field to create instance should not pop-up help dialog

Note that this already wasn't the case in Maya, but everywhere else it did occur. So in Maya it should show no difference in behavior.

@BigRoy BigRoy added type: enhancement Enhancements to existing functionality community contribution tool: Publisher labels Oct 30, 2023
@ynbot ynbot added the size/XS Denotes a PR changes 0-99 lines, ignoring general files label Oct 30, 2023
Copy link
Copy Markdown
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

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

Did tested in max 2023 and it fixes the issue with showing up help pop up window but introduces strange switching to the other publish pane....see the vid for more insight.

Need to be addressed.

Publisher_Enter_Confirm.mp4

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Oct 31, 2023

Did tested in max 2023 and it fixes the issue with showing up help pop up window but introduces strange switching to the other publish pane....see the vid for more insight.

Need to be addressed.
Publisher_Enter_Confirm.mp4

@LiborBatek Ok, so this is due to the Help button not receiving focus but now the Create tab (top left) takes the focus and thus enter clicks that tab entry. When I disable the focus policy for the tabs themselves then the next focus is the "Save" icon bottom right. As such clicking enter "saves" the settings which I'm not sure is preferred either.

@iLLiCiTiT I feel like we're better off ensuring that the KeyPressEvents doesn't pass through to begin with from the Create Options Widgets and the Instance Publish Option widgets

Currently whenever actively being in any of the fields in this part of the UI:
image

And this one:
image

For example:

  • Typing in the "Filter assets..." field and pressing enter
  • Typing a comment and clicking enter
  • In Publish tab typing the variant name for an instance and pressing enter
  • In Publish tab instance options on a text/numerical field pressing enter
  • In Create tab pressing enter in variant field or text/numerical options and pressing enter
  • In Details tab selecting a plug-in, then pressing enter

Each of these then pass the enter key to the active focus object of the Window, which defaults to the "?" button and if like this PR focus policy is removed there proceeds to the Tabs (Create tab by default) and if disabled there proceeds to the bottom controls like "Save" icon.

Actually applies the Enter key event to the focused object, like the Help button, the Tabs above it or the Controls below it. I'd actually argue however that if currently any of the entries in the screenshotted areas above are active that it should not pass through key events (or at least not enter keys?) We'd still want to be able to TAB out of it however?

Basically what we want is that when active in those areas to not proceed to pass the key events to the other widgets outside of it.

@BigRoy BigRoy requested a review from LiborBatek October 31, 2023 14:00
Copy link
Copy Markdown
Member

@LiborBatek LiborBatek left a comment

Choose a reason for hiding this comment

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

All good when hitting Enter key and no any unwanted changes happening!

image

@iLLiCiTiT
Copy link
Copy Markdown
Member

Can we add the ignore logic to existing method in window?

if event.key() in {
    QtCore.Qt.Key_Return,
    QtCore.Qt.Key_Enter,
}:
    event.accept()
    return

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Nov 6, 2023

Can we add the ignore logic to existing method in window?

if event.key() in {
    QtCore.Qt.Key_Return,
    QtCore.Qt.Key_Enter,
}:
    event.accept()
    return

As far as I know we can not put it on the Window itself - because children widgets as far as I know will still be first receiving the event before it hits the Windows' event upstream. We could install an event filter on the window which triggers for ALL children events but that'd just be slower / getting way more events than we'd like.

Basically the logic is this:

  • text field, press enter. does the text field process the event?
  • while not processed, does the parent process the event? (recursively going up the parents to the first one dealing with the event)

@iLLiCiTiT
Copy link
Copy Markdown
Member

iLLiCiTiT commented Nov 6, 2023

As far as I know we can not put it on the Window itself - because children widgets as far as I know will still be first receiving the event before it hits the Windows' event upstream

I've tried and it does not trigger the button... I think the default (button with default set as True) is triggered only if the event is not accepted at any child of the window hierarchy.

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Dec 21, 2023

@iLLiCiTiT seems to work - like this?

@BigRoy BigRoy requested a review from iLLiCiTiT December 21, 2023 21:58
Copy link
Copy Markdown
Member

@antirotor antirotor left a comment

Choose a reason for hiding this comment

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

Weird - If you open for example max and publisher, hit enter, then help window will appear. But after reset, enter won't open it anymore. Same thing in Houdini

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Dec 22, 2023

Weird - If you open for example max and publisher, hit enter, then help window will appear. But after reset, enter won't open it anymore. Same thing in Houdini

That's because the active button then has changed to the reset button most likely (or some other field). Anyway, that goes to show that this new fix with the event capture on the window does not work and we should likely revert again to this commit 4606484

@antirotor can you confirm that commit instead works as intended?

@antirotor
Copy link
Copy Markdown
Member

antirotor commented Dec 22, 2023

@antirotor can you confirm that commit instead works as intended?

it doesn't work either - I replicated the original change from 4606484 in the new code:

    def keyPressEvent(self, event):
        # Ignore escape button to close window
        if event.key() == QtCore.Qt.Key_Escape:
            event.accept()
            return

        # Avoid enter key to activate the "help" dialog, fix #5791
        return super().keyPressEvent(event)

also it behaves differently when you click on different parts of the publisher window. On some parts, the help window won't pop-up, but on the others it will.

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Dec 22, 2023

@antirotor can you confirm that commit instead works as intended?

it doesn't work either - I replicated the original change from 4606484 in the new code:

    def keyPressEvent(self, event):
        # Ignore escape button to close window
        if event.key() == QtCore.Qt.Key_Escape:
            event.accept()
            return

        # Avoid enter key to activate the "help" dialog, fix #5791
        return super().keyPressEvent(event)

also it behaves differently when you click on different parts of the publisher window. On some parts, the help window won't pop-up, but on the others it will.

Note that it was on a different class - not on the window. Did you do that? Best to just checkout that commit actually.

also it behaves differently when you click on different parts of the publisher window. On some parts, the help window won't pop-up, but on the others it will.

Correct - it will propagate "upwards" - in our case we're looking to just avoid it opening the help dialog I suppose.

@antirotor
Copy link
Copy Markdown
Member

Note that it was on a different class - not on the window. Did you do that? Best to just checkout that commit actually.

Well, the original commit works, but not for the first time - when you open the Publisher and immediately hit enter, help will open. But once you click on anything inside or reset, enter will no longer open help window.

@BigRoy
Copy link
Copy Markdown
Collaborator Author

BigRoy commented Dec 22, 2023

Note that it was on a different class - not on the window. Did you do that? Best to just checkout that commit actually.

Well, the original commit works, but not for the first time - when you open the Publisher and immediately hit enter, help will open. But once you click on anything inside or reset, enter will no longer open help window.

That sounds fine - maybe somewhat confusing, but more acceptable than pressing enter in the text fields doing it.

@iLLiCiTiT thoughts? Revert to that commit - other options?

@mkolar
Copy link
Copy Markdown
Member

mkolar commented Feb 8, 2024

This issue was resolved by merging #6107

closing.

@mkolar mkolar closed this Feb 8, 2024
@ynbot ynbot added this to the next-patch milestone Feb 8, 2024
@jakubjezek001 jakubjezek001 removed this from the next-patch milestone Feb 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

community contribution size/XS Denotes a PR changes 0-99 lines, ignoring general files tool: Publisher type: enhancement Enhancements to existing functionality

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Bug: Pressing Enter in publisher unexpectedly pops up Help dialog

7 participants