Support of multiple clipboard formats on Microsoft Windows#162
Open
nunobrum wants to merge 5 commits intoasweigart:masterfrom
Open
Support of multiple clipboard formats on Microsoft Windows#162nunobrum wants to merge 5 commits intoasweigart:masterfrom
nunobrum wants to merge 5 commits intoasweigart:masterfrom
Conversation
Now copy and paste have an optional parameter on the windows version
that specifies which clipboard format is to be used.
It does so while maintaining compatibility with the usual
usage:
copy(text)
text=paste()
The usage with formats is the following
copy(text, clipboard_format)
paste(clipboard_format)
Also, multiple formats can be copied if using
copy({CF_UNICODETEXT: "this is the unicode text",
CF_TEXT: b"This is the ascii text",
CF_BITMAP: bitmap_image})
paste_dict = paste([CF_TEXT, CF_UNICODETEXT]) # Pastes only these two
paste_all = paste([]) # This pastes all available formats into a dictionary
Reformatting code as per PEP formatting recommendations Adding PyCharm project settings
Author
|
Hi there.... |
|
@nunobrum Unfortunately, I don't think this package is actively being worked on. If you end up making a new package, I'd check it out for sure! |
Author
|
@nickdallege Thanks for your answer. I'll put it on my TODO list to make a new package. It might take a while since I'm now quite busy with my daytime job. |
|
Thanks for working on this, I wish I had stumbled on this earlier (I implemented something similar myself before I saw this). I linked #126 which does something similar for xclip/Linux. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First of all, congratulations on your python package. Well done!
I have updated your pyperclip module in order to enable the support of multiple clipboard formats.
I've kept backwards compatibility although it was not really obvious to do so because of the lazy load that is implemented.
I'm guessing that there is a very strong reason for it, so, I've kept it.
I've also couldn't just update the all assignment in the module to add more functions that would be used only on windows platform.
I've updated the usage on the README.md file to explain how the multiple clipboard formats are implemented.
I think the next step would be to see if multiple clipboard formats are available in other platforms and implement a common API that implements this a bit more elegantly as it is now.
Anyway, I'm submitting this pull request for you to look at it, and see if it is good enough for you to push it into the main code. If you think that the change has too much of a "hacking" look into it, (I can't disagree), I'll probably break compatibility and derive a completely new package.
Just let me know what are your thoughts on this.
Happy new Year,
Nuno
P.S. I did cleaned a bit the code to match the Python's PEP formatting recommendations.