Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Commit

Permalink
Preserve order if need be when copying
Browse files Browse the repository at this point in the history
  • Loading branch information
corpnewt authored May 19, 2019
1 parent 380d15e commit 23379a8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions ProperTree.command
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ class ProperTree:
# Nothing to copy
return
try:
clipboard_string = plist.dumps(window.nodes_to_values(node,{}),sort_keys=window.sort_dict)
clipboard_string = plist.dumps(window.nodes_to_values(node,{}),sort_keys=self.sort_dict)
# Get just the values
self.tk.clipboard_clear()
self.tk.clipboard_append(clipboard_string)
Expand All @@ -294,7 +294,7 @@ class ProperTree:
if window == self.tk:
return
try:
clipboard_string = plist.dumps(window.nodes_to_values("",{}),sort_keys=window.sort_dict)
clipboard_string = plist.dumps(window.nodes_to_values("",{}),sort_keys=self.sort_dict)
# Get just the values
self.tk.clipboard_clear()
self.tk.clipboard_append(clipboard_string)
Expand All @@ -314,12 +314,12 @@ class ProperTree:
# Try to format the clipboard contents as a plist
clip = self.tk.clipboard_get()
try:
plist_data = plist.loads(clip)
plist_data = plist.loads(clip,dict_type=dict if self.sort_dict else OrderedDict)
except:
# May need the header
cb = self.plist_header + "\n" + clip + "\n" + self.plist_footer
try:
plist_data = plist.loads(cb)
plist_data = plist.loads(cb,dict_type=dict if self.sort_dict else OrderedDict)
except Exception as e:
# Let's throw an error
self.tk.bell()
Expand Down

0 comments on commit 23379a8

Please sign in to comment.