corpnewt / ProperTree

Cross platform GUI plist editor written in python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Copy not working

Apethesis opened this issue · comments

Commit 638185f, aka "Workaroud for tkinter not saving clipboard" broke it for me.
Can't copy keys n stuff.

Hey there - what's your environment (OS/python version, etc)? Also - what exactly are you copying? I'll test locally and see if I can recreate it.

I tested the commit on Windows 10 with python 3.10, and macOS on python 2.7 and 3.10 and it worked here.

-CorpNewt

Also worth asking if you have the clip (should you be running Windows) or pbcopy (if you're on macOS/Linux) binaries. If not - I could wrap the copy check in a try... except block for that portion - and have it fall back on the regular tkinter clipboard functions if it fails. I might do that while I'm waiting for a reply - as it won't hurt anything regardless.

-CorpNewt

I pushed a test commit here - which may fix the issue (as I'm just guessing your system lacks clip or pbcopy). This will restore the prior behavior should neither of those binaries exist.

-CorpNewt

Hey there - what's your environment (OS/python version, etc)? Also - what exactly are you copying? I'll test locally and see if I can recreate it.

I tested the commit on Windows 10 with python 3.10, and macOS on python 2.7 and 3.10 and it worked here.

-CorpNewt

Arch LInux, Latest Python

Also worth asking if you have the clip (should you be running Windows) or pbcopy (if you're on macOS/Linux) binaries. If not - I could wrap the copy check in a try... except block for that portion - and have it fall back on the regular tkinter clipboard functions if it fails. I might do that while I'm waiting for a reply - as it won't hurt anything regardless.

-CorpNewt

Yeah I don't seem to have them, cant get them from pacman either.
I think its more convenient to use the tkinter clipboard since its already installed to use propertree.

Yeah - since it wraps the attempts in a try... except, if no supported clipboard binaries are found, it only leverages the tkinter clipboard functions. I'll close this issue though unless any other issues arise.

-CorpNewt

I think its more convenient to use the tkinter clipboard since its already installed to use propertree.

Worth mentioning that this workaround isn't strictly for convenience - it's to work around a bug in tkinter's clipboard implementation where it doesn't copy its contents to the system clipboard on exit, unless that data has already been pasted into another application. If you want to recreate this problem locally (with Linux that doesn't have xclip or xsel installed, mind you), you can do the following:

  1. Open ProperTree
  2. Copy the Root node
  3. Close ProperTree
  4. Attempt to paste the copied contents anywhere

If you close ProperTree before pasting (using just the default tkinter clipboard implementation), it likely will not work. The system clipboard is cleared, but the tkinter clipboard contents are never copied over, so they are only present when the tkinter instance is active, or if that data is pasted to another application.