Skip to content

interact() defaults to ON_ACTION behavior and accepts runActionTemplate argument#2432

Merged
ntjess merged 3 commits intopyqtgraph:masterfrom
ntjess:interactive-refactoring
Sep 27, 2022
Merged

interact() defaults to ON_ACTION behavior and accepts runActionTemplate argument#2432
ntjess merged 3 commits intopyqtgraph:masterfrom
ntjess:interactive-refactoring

Conversation

@ntjess
Copy link
Copy Markdown
Contributor

@ntjess ntjess commented Sep 27, 2022

I ported a substantial number of parameter use cases to rely on interact and found that the majority don't favor running on change. The main motivation for that default was to avoid creating a child Run parameter, but this is no longer a concern with the introduction of ActionGroupParameter. This also aligns with the principle of least astonishment, that a (potentially expensive) function shouldn't automatically run unless a button is pressed.

Along with this, the PR also allows interact() to listen for button-specific keywords like shortcut and icon in its argument list.

@ntjess ntjess changed the title Interactive refactoring interact() defaults to ON_ACTION behavior and accepts runActionTemplate argument Sep 27, 2022
host = interact(interactive, runOptions=RunOptions.ON_CHANGED)
interactive.disconnect()
host["a"] = 20
assert value == 10

Check warning

Code scanning / CodeQL

Redundant comparison

Test is always true, because of [this condition](1)
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.

1 participant