Copy and paste
This commit is contained in:
parent
247aa3fa55
commit
d72e35add3
|
|
@ -241,6 +241,7 @@ class CodeEditor(ScrollableView):
|
||||||
else:
|
else:
|
||||||
self.text=self.text[:self.cursorpos]+str(key)+self.text[self.cursorpos:]
|
self.text=self.text[:self.cursorpos]+str(key)+self.text[self.cursorpos:]
|
||||||
self.cursorpos += 1
|
self.cursorpos += 1
|
||||||
|
self.scursorpos = self.cursorpos
|
||||||
self.invalidate_rect([0,0,self.extent[0],self.extent[1]])
|
self.invalidate_rect([0,0,self.extent[0],self.extent[1]])
|
||||||
class test(Application):
|
class test(Application):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
||||||
|
|
@ -825,6 +825,28 @@ def copy(widget=None):
|
||||||
clip = svlgui.app.get_clipboard() if svlgui.app.query_clipboard() else None
|
clip = svlgui.app.get_clipboard() if svlgui.app.query_clipboard() else None
|
||||||
print clip
|
print clip
|
||||||
raise blearrghh
|
raise blearrghh
|
||||||
|
def paste(widget=None):
|
||||||
|
clip = svlgui.app.get_clipboard() if svlgui.app.query_clipboard() else None
|
||||||
|
if clip:
|
||||||
|
print clip
|
||||||
|
if MainWindow.stage.is_focused():
|
||||||
|
ctext = svlgui.Text(clip,200,100)
|
||||||
|
ctext.editing = False
|
||||||
|
# svlgui.CURRENTTEXT = self.ctext
|
||||||
|
ctext.onMouseDown = onMouseDownText
|
||||||
|
ctext.onMouseDrag = onMouseDragText
|
||||||
|
ctext.onMouseUp = onMouseUpText
|
||||||
|
self = root.descendItem()
|
||||||
|
self.add(ctext)
|
||||||
|
# self.add(self.ctext)
|
||||||
|
# self.ctext = None
|
||||||
|
undo_stack.append(edit("add_object", self, {"frame":self.activelayer.currentframe, "layer":self.activelayer}, \
|
||||||
|
{"frame":self.activelayer.currentframe, "layer":self.activelayer, \
|
||||||
|
"obj":self.activelayer.frames[self.activelayer.currentframe].objs[-1]}))
|
||||||
|
self.activelayer.currentselect = self.activelayer.frames[self.activelayer.currentframe].objs[-1]
|
||||||
|
MainWindow.stage.draw()
|
||||||
|
elif MainWindow.scriptwindow.is_focused():
|
||||||
|
MainWindow.scriptwindow.insert(clip)
|
||||||
|
|
||||||
def add_keyframe(widget=None):
|
def add_keyframe(widget=None):
|
||||||
print "af> ", root.descendItem().activeframe
|
print "af> ", root.descendItem().activeframe
|
||||||
|
|
@ -927,7 +949,7 @@ svlgui.menufuncs([["File",
|
||||||
("Redo", redo, "/^z"),
|
("Redo", redo, "/^z"),
|
||||||
"Cut",
|
"Cut",
|
||||||
("Copy", copy, "/c"),
|
("Copy", copy, "/c"),
|
||||||
"Paste",
|
("Paste", paste, "/v"),
|
||||||
"Delete",
|
"Delete",
|
||||||
("Preferences",preferences,"")],
|
("Preferences",preferences,"")],
|
||||||
["Timeline",
|
["Timeline",
|
||||||
|
|
|
||||||
14
svlgui.py
14
svlgui.py
|
|
@ -341,6 +341,7 @@ if SYSTEM=="osx":
|
||||||
m.undo_cmd.enabled = 1
|
m.undo_cmd.enabled = 1
|
||||||
m.redo_cmd.enabled = 1
|
m.redo_cmd.enabled = 1
|
||||||
m.copy_cmd.enabled = 1
|
m.copy_cmd.enabled = 1
|
||||||
|
m.paste_cmd.enabled = 1
|
||||||
m.run_file.enabled = 1
|
m.run_file.enabled = 1
|
||||||
m.run_html.enabled = 1
|
m.run_html.enabled = 1
|
||||||
m.create_sc.enabled = 1
|
m.create_sc.enabled = 1
|
||||||
|
|
@ -572,7 +573,7 @@ def menufuncs(j):
|
||||||
menus.append(menu)
|
menus.append(menu)
|
||||||
else:
|
else:
|
||||||
cmds={"New...":"new_cmd", "Save":"save_cmd", "Save As":"save_as_cmd", "Open":"open_cmd","About Lightningbeam...":"about_cmd",\
|
cmds={"New...":"new_cmd", "Save":"save_cmd", "Save As":"save_as_cmd", "Open":"open_cmd","About Lightningbeam...":"about_cmd",\
|
||||||
"Preferences":"preferences_cmd", "Undo":"undo_cmd", "Redo":"redo_cmd", "Copy":"copy_cmd"}
|
"Preferences":"preferences_cmd", "Undo":"undo_cmd", "Redo":"redo_cmd", "Copy":"copy_cmd", "Paste":"paste_cmd"}
|
||||||
[setattr(app,cmds[k[0]],k[1]) for k in i if (k[0] in cmds)]
|
[setattr(app,cmds[k[0]],k[1]) for k in i if (k[0] in cmds)]
|
||||||
|
|
||||||
class VBox(Widget):
|
class VBox(Widget):
|
||||||
|
|
@ -1185,6 +1186,9 @@ class Canvas(Widget):
|
||||||
self.canvas.invalidate_rect((0,0,self.canvas.extent[0],self.canvas.extent[1]))
|
self.canvas.invalidate_rect((0,0,self.canvas.extent[0],self.canvas.extent[1]))
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
jscommunicate("drawcanvas("+self.tid+")")
|
jscommunicate("drawcanvas("+self.tid+")")
|
||||||
|
def is_focused(self):
|
||||||
|
if SYSTEM=="osx":
|
||||||
|
return self.canvas.is_target()
|
||||||
def add(self, obj, x, y):
|
def add(self, obj, x, y):
|
||||||
obj.x = x
|
obj.x = x
|
||||||
obj.y = y
|
obj.y = y
|
||||||
|
|
@ -1246,6 +1250,14 @@ class TextView(Widget):
|
||||||
return self.box
|
return self.box
|
||||||
elif SYSTEM=="html":
|
elif SYSTEM=="html":
|
||||||
return self.box
|
return self.box
|
||||||
|
def is_focused(self):
|
||||||
|
if SYSTEM=="osx":
|
||||||
|
return self.box.is_target()
|
||||||
|
def insert(self, text):
|
||||||
|
if SYSTEM=="osx":
|
||||||
|
if isinstance(self.box, CodeEditor):
|
||||||
|
self.box.text = self.box.text[:self.box.scursorpos]+text+self.box.text[self.box.cursorpos:]
|
||||||
|
self.box.invalidate_rect([0,0,self.box.extent[0],self.box.extent[1]])
|
||||||
def scroll_bottom(self):
|
def scroll_bottom(self):
|
||||||
if SYSTEM=="osx":
|
if SYSTEM=="osx":
|
||||||
self.scroll_page_down();
|
self.scroll_page_down();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue