This PR moves all Clipboard classes under dragonfly/windows for consistency with other platform-dependent code and refactors them so that they have a consistent API across platforms.
The clipboard unit tests are passing for me using Python versions 2.7 and 3.9 on Windows 10. They also pass when using the pyperclip implementation on X11 using Python versions 2.7 and 3.7.
~I still need to adjust the documentation and a few other things before merging.~
Changes
Move clipboard functionality into modules under dragonfly/windows.
Adjust the pyperclip class to emulate multiple clipboard formats: format_text and format_unicode.
Move most methods from Win32Clipboard into the base class.
Only allow strings or None when setting text clipboard formats (related: PR #319).
Use Windows clipboard format constants CF_TEXT (1) and CF_UNICODETEXT (13) for format_text and format_unicode on all platforms.
Use binary strings for the ANSI clipboard format and text strings for the Unicode clipboard format.
Fix an issue with Clipboard.copy_to_system().
Make appropriate changes to the Paste action class.
Change how Windows class handles irretrievable formats (see code comments).
Change the Windows class to update Clipboard.format_names with the names of any registered clipboard formats used (for readability).
Update clipboard toolkit documentation.
Update clipboard unit tests with more test cases.
The dragonfly.util sub-package has been kept backwards-compatible.
This PR moves all
Clipboard
classes under dragonfly/windows for consistency with other platform-dependent code and refactors them so that they have a consistent API across platforms.The clipboard unit tests are passing for me using Python versions 2.7 and 3.9 on Windows 10. They also pass when using the pyperclip implementation on X11 using Python versions 2.7 and 3.7.
~I still need to adjust the documentation and a few other things before merging.~
Changes
format_text
andformat_unicode
.Win32Clipboard
into the base class.None
when setting text clipboard formats (related: PR #319).CF_TEXT
(1) andCF_UNICODETEXT
(13) forformat_text
andformat_unicode
on all platforms.Clipboard.copy_to_system()
.Paste
action class.Clipboard.format_names
with the names of any registered clipboard formats used (for readability).The
dragonfly.util
sub-package has been kept backwards-compatible.