Copy and paste
This commit is contained in:
parent
247aa3fa55
commit
d72e35add3
|
|
@ -241,6 +241,7 @@ class CodeEditor(ScrollableView):
|
|||
else:
|
||||
self.text=self.text[:self.cursorpos]+str(key)+self.text[self.cursorpos:]
|
||||
self.cursorpos += 1
|
||||
self.scursorpos = self.cursorpos
|
||||
self.invalidate_rect([0,0,self.extent[0],self.extent[1]])
|
||||
class test(Application):
|
||||
def __init__(self):
|
||||
|
|
|
|||
|
|
@ -825,6 +825,28 @@ def copy(widget=None):
|
|||
clip = svlgui.app.get_clipboard() if svlgui.app.query_clipboard() else None
|
||||
print clip
|
||||
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):
|
||||
print "af> ", root.descendItem().activeframe
|
||||
|
|
@ -927,7 +949,7 @@ svlgui.menufuncs([["File",
|
|||
("Redo", redo, "/^z"),
|
||||
"Cut",
|
||||
("Copy", copy, "/c"),
|
||||
"Paste",
|
||||
("Paste", paste, "/v"),
|
||||
"Delete",
|
||||
("Preferences",preferences,"")],
|
||||
["Timeline",
|
||||
|
|
|
|||
14
svlgui.py
14
svlgui.py
|
|
@ -341,6 +341,7 @@ if SYSTEM=="osx":
|
|||
m.undo_cmd.enabled = 1
|
||||
m.redo_cmd.enabled = 1
|
||||
m.copy_cmd.enabled = 1
|
||||
m.paste_cmd.enabled = 1
|
||||
m.run_file.enabled = 1
|
||||
m.run_html.enabled = 1
|
||||
m.create_sc.enabled = 1
|
||||
|
|
@ -572,7 +573,7 @@ def menufuncs(j):
|
|||
menus.append(menu)
|
||||
else:
|
||||
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)]
|
||||
|
||||
class VBox(Widget):
|
||||
|
|
@ -1185,6 +1186,9 @@ class Canvas(Widget):
|
|||
self.canvas.invalidate_rect((0,0,self.canvas.extent[0],self.canvas.extent[1]))
|
||||
elif SYSTEM=="html":
|
||||
jscommunicate("drawcanvas("+self.tid+")")
|
||||
def is_focused(self):
|
||||
if SYSTEM=="osx":
|
||||
return self.canvas.is_target()
|
||||
def add(self, obj, x, y):
|
||||
obj.x = x
|
||||
obj.y = y
|
||||
|
|
@ -1246,6 +1250,14 @@ class TextView(Widget):
|
|||
return self.box
|
||||
elif SYSTEM=="html":
|
||||
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):
|
||||
if SYSTEM=="osx":
|
||||
self.scroll_page_down();
|
||||
|
|
|
|||
Loading…
Reference in New Issue