[chirp_devel] [PATCH 0 of 2] Cross-instance copy/paste in Windows. ATTN: Jim
Jim,
Rich reported that copying in one instance of Chirp and pasting in another doesn't work. I tested this myself...
Linux: - can open two instances of chirpw - copy/paste works between instances
Mac OS X: - won't allow opening two instances - succeeded in opening two different versions of Chirp - copy/paste works between two different-version instances
Windows: - installed version won't allow opening two instances - standalone version allows multiple instances - copy/paste doesn't work between instances
So we can deduce Rich must be using the standalone version on Windows.
The next question is why copy/paste doesn't work between instances on the standalone Windows version. I looked at which clipboard Chirp uses and it's one built into X. My guess is that PyGTK emulates this on Windows instead of using the OS clipboard.
The first of these two patches changes the clipboard target to the normal OS clipboard. Can you test this on Windows? I don't have a Windows dev environment set up.
The second patch is another attempt to solve the same problem. It stores the clipboard data outside the app. This feature exists so that the clipboard data can remain available after the source app is closed, but my thought is it might solve the cross-instance paste issue. Can you test this patch separately from the first one?
Tom
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1464290018 25200 # Thu May 26 12:13:38 2016 -0700 # Node ID 5e201db884fbc23ea7884f312b5432c419002370 # Parent 77bd2ad5e4e37248f31d56a7aa122956848e7bb2 [ui] Change clipboard target to support cross-process copy/paste on Windows.
Clipboard target was PRIMARY, the X clipboard. Changed to CLIPBOARD thinking it might work better on Windows. Untested.
diff -r 77bd2ad5e4e3 -r 5e201db884fb chirp/ui/memedit.py --- a/chirp/ui/memedit.py Mon May 23 10:30:11 2016 -0400 +++ b/chirp/ui/memedit.py Thu May 26 12:13:38 2016 -0700 @@ -1421,7 +1421,7 @@ self._set_memory(iter, mem)
result = pickle.dumps((self._features, selection)) - clipboard = gtk.Clipboard(selection="PRIMARY") + clipboard = gtk.Clipboard(selection="CLIPBOARD") clipboard.set_text(result)
return cut # Only changed if we did a cut @@ -1515,7 +1515,7 @@ self.rthread.submit(job)
def paste_selection(self): - clipboard = gtk.Clipboard(selection="PRIMARY") + clipboard = gtk.Clipboard(selection="CLIPBOARD") clipboard.request_text(self._paste_selection)
def select_all(self):
# HG changeset patch # User Tom Hayward tom@tomh.us # Date 1464290084 25200 # Thu May 26 12:14:44 2016 -0700 # Node ID 8ba3e3590a2a26f67a85f0c26ea4ca89d5b86081 # Parent 5e201db884fbc23ea7884f312b5432c419002370 [ui] Store clipboard outside of app, so paste works after quitting.
diff -r 5e201db884fb -r 8ba3e3590a2a chirp/ui/memedit.py --- a/chirp/ui/memedit.py Thu May 26 12:13:38 2016 -0700 +++ b/chirp/ui/memedit.py Thu May 26 12:14:44 2016 -0700 @@ -1423,6 +1423,7 @@ result = pickle.dumps((self._features, selection)) clipboard = gtk.Clipboard(selection="CLIPBOARD") clipboard.set_text(result) + clipboard.store()
return cut # Only changed if we did a cut
Hi Tom,
Took me a minute to figure out how to run 2 instances of CHIRP. Here is what I found out.
The first of these two patches changes the clipboard target to the normal OS clipboard. Can you test this on Windows? I don't have a Windows dev environment set up.
This patch works.
The second patch is another attempt to solve the same problem. It stores the clipboard data outside the app. This feature exists so that the clipboard data can remain available after the source app is closed, but my thought is it might solve the cross-instance paste issue. Can you test this patch separately from the first one?
This patch does not work.
Jim KC9HI
On Thu, May 26, 2016 at 2:50 PM, Jim Unroe rock.unroe@gmail.com wrote:
Hi Tom,
Took me a minute to figure out how to run 2 instances of CHIRP. Here is what I found out.
The first of these two patches changes the clipboard target to the normal OS clipboard. Can you test this on Windows? I don't have a Windows dev environment set up.
This patch works.
The second patch is another attempt to solve the same problem. It stores the clipboard data outside the app. This feature exists so that the clipboard data can remain available after the source app is closed, but my thought is it might solve the cross-instance paste issue. Can you test this patch separately from the first one?
This patch does not work.
Jim KC9HI
Thanks for your help! That was much simpler than learning how to test on Windows myself.
I'll respin the first one with a proper issue number.
Wonder if it would be valuable to implement the second one just so someone can close and relaunch Chirp without losing their clipboard data. On the other hand, if they paste hours later into something else they'll get a bunch of gibberish. The paste data is essentially useless outside of Chirp (it's a pickled Python object).
Tom
participants (2)
-
Jim Unroe
-
Tom Hayward