Closed gkuegler closed 2 months ago
Hello @gkuegler,
Thank you for opening this pull request.
You're right, it does make sense to inform the caller somehow if the clipboard wasn't changed. The name of this method implies that synchronising clipboard changes is ensured. If changes are not synchronised, my opinion is that an exception should always occur.
On Fri, 16 Aug 2024 14:26:01 -0700 George Kuegler @.***> wrote:
Currently, when using the context manager, there's no indication if the clipboard timed out when waiting for a change.
This change makes it so I could write the following and be (mostly) certain my text made it to the clipboard:
with clipboard.synchronized_changes(timeout=2, raise_exception_on_timeout=True): Key("c-c").execute()
This makes it simple to write rules that rely on getting the user's highlighted text and subsequently stop the action if not text was captured. You can view, comment on, or merge this pull request online at:
https://github.com/dictation-toolbox/dragonfly/pull/390
-- Commit Summary --
- Optionally raise a timeout exception when waiting for the clipboard to change times out under context manager.
-- File Changes --
M dragonfly/windows/win32_clipboard.py (7)
-- Patch Links --
https://github.com/dictation-toolbox/dragonfly/pull/390.patch https://github.com/dictation-toolbox/dragonfly/pull/390.diff
-- Reply to this email directly or view it on GitHub: https://github.com/dictation-toolbox/dragonfly/pull/390 You are receiving this because you are subscribed to this thread.
Message ID: @.***>
I'll publish this change in version 0.36.0. Thanks again.
Thanks! Did you want me to change the default behavior to throw an exception?
There's no need. I changed that prior to merging. All done. :+1:
Currently, when using the context manager, there's no indication if the clipboard timed out when waiting for a change.
This change makes it so I could write the following and be (mostly) certain my text made it to the clipboard:
This makes it simple to write rules that rely on getting the user's highlighted text and subsequently stop the action if not text was captured.