Skip to content

Commit 3fca663

Browse files
committed
copy paste fix
1 parent a6e61e2 commit 3fca663

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

CE.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import json
2+
13
import render
24
from menuclass import *
35
from lingotojson import *
@@ -126,12 +128,12 @@ def camdown(self):
126128

127129
def copycamera(self):
128130
if self.held:
129-
pyperclip.copy(str(self.data["CM"]["quads"][self.heldindex]))
131+
pyperclip.copy(json.dumps(self.data["CM"]["quads"][self.heldindex]))
130132

131133
def pastedata(self):
132134
if not self.held:
133135
try:
134-
geodata = eval(pyperclip.paste())
136+
geodata = json.loads(pyperclip.paste())
135137
if type(geodata) != list or len(pyperclip.paste()) <= 2:
136138
return
137139
self.historyappend(["CM", "cameras"], makearr([0, 0], "point"))

FE.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import json
2+
13
from menuclass import *
24
from lingotojson import *
35
import random
@@ -183,7 +185,7 @@ def blit(self):
183185
if self.copymode:
184186
data1 = self.data["FE"]["effects"][self.selectedeffect]["mtrx"][rect.x:rect.w + rect.x]
185187
data1 = [i[rect.y:rect.h + rect.y] for i in data1]
186-
pyperclip.copy(str(data1))
188+
pyperclip.copy(json.dumps(data1))
187189
print("Copied!")
188190
self.updatehistory()
189191
#self.detecthistory(["FE", "effects", self.selectedeffect, "mtrx"])
@@ -227,7 +229,7 @@ def copytool(self):
227229

228230
def pastedata(self):
229231
try:
230-
geodata = eval(pyperclip.paste())
232+
geodata = json.loads(pyperclip.paste())
231233
if type(geodata) != list:
232234
return
233235
for xi, x in enumerate(geodata):

GE.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import traceback
23

34
from menuclass import *
@@ -188,7 +189,7 @@ def blit(self):
188189
pg.draw.rect(self.surface, mirror, [self.field.rect.x, py, self.field.field.get_width(), 3])
189190
if pg.key.get_pressed()[pg.K_LCTRL]:
190191
try:
191-
geodata = eval(pyperclip.paste())
192+
geodata = json.loads(pyperclip.paste())
192193
if type(geodata) is not list:
193194
return
194195
pos = self.field.rect.topleft + (self.pos * self.size if self.onfield else pg.Vector2(0, 0))
@@ -369,7 +370,7 @@ def replacestate(self):
369370
def pastegeo(self):
370371
try:
371372
self.emptyarea()
372-
geodata = eval(pyperclip.paste())
373+
geodata = json.loads(pyperclip.paste())
373374
if type(geodata) != list:
374375
return
375376
for xi, x in enumerate(geodata):

TE.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import json
12
import traceback
23
from menuclass import *
34
from lingotojson import *
@@ -228,7 +229,7 @@ def blit(self):
228229
block = self.data["TE"]["tlMatrix"][xpos][ypos][self.layer]
229230
if block["tp"] == "material" or block["tp"] == "tileHead":
230231
history.append([x, y, block])
231-
pyperclip.copy(str(history))
232+
pyperclip.copy(json.dumps(history))
232233
elif self.tileimage["tp"] == "pattern":
233234
self.insertpattern_rect(rect)
234235
self.detecthistory(["TE", "tlMatrix"])
@@ -241,7 +242,7 @@ def blit(self):
241242
self.selector.blittooltip()
242243
if pg.key.get_pressed()[pg.K_LCTRL]:
243244
try:
244-
geodata: list = eval(pyperclip.paste())
245+
geodata: list = json.loads(pyperclip.paste())
245246
if type(geodata) != list:
246247
return
247248
pos = self.field.rect.topleft + (self.pos * self.size if self.onfield else pg.Vector2(0, 0))
@@ -503,7 +504,7 @@ def cats(self):
503504
def pastedata(self):
504505
try:
505506
print("pasting data")
506-
geodata = eval(pyperclip.paste())
507+
geodata = json.loads(pyperclip.paste())
507508
if type(geodata) != list or len(pyperclip.paste()) <= 2:
508509
print("Error pasting data!")
509510
return

0 commit comments

Comments
 (0)