Skip to content

Async actions and event handlers #3772

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

Merged
merged 7 commits into from
Mar 19, 2025
Merged

Async actions and event handlers #3772

merged 7 commits into from
Mar 19, 2025

Conversation

amolenaar
Copy link
Member

@amolenaar amolenaar commented Feb 23, 2025

PR Type

What kind of change does this PR introduce?

  • Bug fix
  • Feature
  • Chore (refactoring, formatting, local variables, other cleanup)
  • Documentation content changes

What is the current behavior?

We need to schedule special "background tasks" in order to perform async code.

What is the new behavior?

For EventManager events, allow event handlers to be async functions. This makes it more ideomatic to work with async code.

Actions can also be async. However, an action can only be executed one at a time.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Cleaned out the gaphor.asyncio module. Now it only has 2 functions that can be removed once PyGObject 3.52 has been released.

@github-actions github-actions bot added the python Pull requests that update Python code label Feb 23, 2025
@amolenaar amolenaar marked this pull request as draft February 23, 2025 14:54
Just tell all sessions to shut down, perform application shutdown if no
sessions exist anymore.
@amolenaar amolenaar force-pushed the async-event-handlers branch from 2bbcec9 to 18c7bc0 Compare February 23, 2025 15:52
This makes it easier to support async workloads.

File opening has been made async already.
@amolenaar amolenaar changed the title Async event handlers Async actions and event handlers Feb 23, 2025
@amolenaar amolenaar marked this pull request as ready for review February 23, 2025 20:15
@amolenaar amolenaar requested a review from danyeaw February 23, 2025 20:16
@danyeaw danyeaw added feature A new feature and removed python Pull requests that update Python code labels Mar 18, 2025
Copy link
Member

@danyeaw danyeaw left a comment

Choose a reason for hiding this comment

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

Thanks @amolenaar, this is a really nice improvement for working with the async code 🤩

@danyeaw danyeaw merged commit b79683f into main Mar 19, 2025
24 checks passed
@danyeaw danyeaw deleted the async-event-handlers branch March 19, 2025 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants