Brought lightningbeam files into source control

This commit is contained in:
Skyler Lehmkuhl 2012-01-04 13:39:41 -05:00
parent aac192a920
commit f224a27141
51 changed files with 2382 additions and 0 deletions

19
colors.py Normal file
View File

@ -0,0 +1,19 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2011 Skyler Lehmkuhl
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
def colorArray(i):
return [[[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]], [[0,0,0],[0.2,0.2,0.2],[0.4,0.4,0.4],[0.6,0.6,0.6],[0.8,0.8,0.8],[1,1,1],[1,0,0],[0,1,0],[0,0,1],[1,1,0],[0,1,1],[1,0,1]], [[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0],[0,0,0]], [[0,0,0],[0,0,0.2],[0,0,0.4],[0,0,0.6],[0,0,0.8],[0,0,1],[0.6,0,0],[0.6,0,0.2],[0.6,0,0.4],[0.6,0,0.6],[0.6,0,0.8],[0.6,0,1]],[[0,0.2,0],[0,0.2,0.2],[0,0.2,0.4],[0,0.2,0.6],[0,0.2,0.8],[0,0.2,1],[0.6,0.2,0],[0.6,0.2,0.2],[0.6,0.2,0.4],[0.6,0.2,0.6],[0.6,0.2,0.8],[0.6,0.2,1]],[[0,0.4,0],[0,0.4,0.2],[0,0.4,0.4],[0,0.4,0.6],[0,0.4,0.8],[0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,1,1],[1,1,0],[1,1,0.2],[1,1,0.4],[1,1,0.6],[1,1,0.8],[1,1,1]]][i]

294
lightningbeam Normal file
View File

@ -0,0 +1,294 @@
#! /usr/bin/python
#SVLGUI - my custom GUI wrapper to abstract the GUI
import svlgui
#swift_window - builds the application windows
import lightningbeam_windows
#specify the current version and what version files it can still open
LIGHTNINGBEAM_VERSION = "1.0-alpha1"
LIGHTNINGBEAM_COMPAT = ["1.0-alpha1"]
#Global variables. Used to keep stuff together.
global root
global layers
def update_date():
return "Thu, October 27, 2011"
def onLoadFrames(self):
'''for i in range(2000):
if i%5==0:
j = box(i*16,0,16,32,svlgui.Color([0.5,0.5,0.5]))
self.add(j)
else:
j = box(i*16,0,16,32,svlgui.Color([1,1,1]))
self.add(j)'''
def onClickFrame(self, x, y):
print x, int(x/16)
self.activelayer.activeframe = int(x/16)
def onMouseDownGroup(self, x, y):
if svlgui.MODE in [" ", "s"]:
if self.hitTest(x, y):
self.clicked = True
elif svlgui.MODE in ["r", "e"]:
if svlgui.MODE=="r":
self.cshape = box(x, y, 0, 0)
elif svlgui.MODE=="e":
self.cshape = ellipse(x, y, 0, 0)
#self.cshape.rotation = 5
self.cshape.initx,self.cshape.inity = x, y
self.add(self.cshape)
self.cshape.onMouseDown = onMouseDownObj
self.cshape.onMouseMove = onMouseMoveObj
self.cshape.onMouseDrag = onMouseDragObj
self.cshape.onMouseUp = onMouseUpObj
self.clicked = True
def onMouseDownObj(self, x, y):
self.clicked = True
self.initx,self.inity = x-self.x, y-self.y
if svlgui.MODE == "b":
self.filled = True
self.fillcolor = svlgui.FILLCOLOR
def onMouseDownFrame(self, x, y):
pass
def onMouseUpGroup(self, x, y):
self.clicked = False
if svlgui.MODE in ["r", "e"]:
self.cshape = None
def onMouseUpObj(self, x, y):
self.clicked = False
def onMouseMoveGroup(self, x, y):
pass
root.rotation+=0.01
def onMouseMoveObj(self, x, y):
pass
def onMouseDragGroup(self, x, y):
if svlgui.MODE in [" ", "s"]:
self.x = x
self.y = y
elif svlgui.MODE == "r":
sd = self.cshape.shapedata
x=x-self.cshape.initx
y=y-self.cshape.inity
self.cshape.shapedata = [sd[0],["L",x,sd[0][2]],["L",x,y],["L",sd[0][1],y],sd[4]]
elif svlgui.MODE == "e":
sd = self.cshape.shapedata
x=x-self.cshape.initx
y=y-self.cshape.inity
self.cshape.shapedata = [["M",x/2,0],["C",4*x/5,0,x,y/5,x,y/2],["C",x,4*y/5,4*x/5,y,x/2,y],["C",x/5,y,0,4*y/5,0,y/2],["C",0,y/5,x/5,0,x/2,0]]
def onMouseDragObj(self, x, y):
self.x = x-self.initx
self.y = y-self.inity
def create_sc(root):
retval = ".flash bbox=500x500 background=#ffffff\n"+root.print_sc()+".end"
return retval
def run_file(self=None):
global root
print "RUNNING"
#open("../Desktop/test.sc", "w").write(create_sc(root))
def box(x, y, width, height, fill=None):
global objects
box = svlgui.Shape(x, y)
box.shapedata = [["M",0,0],["L",width,0],["L",width,height],["L",0,height],["L",0,0]]
box.onMouseDown = onMouseDownObj
box.onMouseUp = onMouseUpObj
if fill:
box.fillcolor = fill
box.linecolor = svlgui.Color([0,0,0,0])
box.filled = True
return box
def ellipse(x, y, width, height, fill=svlgui.FILLCOLOR):
global objects
ellipse = svlgui.Shape(x, y)
ellipse.shapedata = [["M",width/2,0],["C",4*width/5,0,width,height/5,width,height/2], ["C",width,4*height/5,4*width/5,height,width/2,height], ["C",width/5,height,0,4*height/5,0,height/2], ["C",0,height/5,width/5,0,width/2,0]]
# must figure out shapedata...
return ellipse
def shape(x, y, fill):
shape = svlgui.Shape()
return shape
root = svlgui.Group()
root.level = True
root.onMouseDown = onMouseDownGroup
root.onMouseUp = onMouseUpGroup
root.onMouseMove = onMouseMoveGroup
root.onMouseDrag = onMouseDragGroup
e=ellipse(100,100,10,10,None)
e.onMouseDown = onMouseDownObj
e.onMouseMove = onMouseMoveObj
e.onMouseDrag = onMouseDragObj
e.onMouseUp = onMouseUpObj
root.add(e)
if svlgui.SYSTEM == "gtk":
overlaywindow = svlgui.OverlayWindow()
MainWindow = lightningbeam_windows.MainWindow()
elif svlgui.SYSTEM=="osx":
MainWindow = lightningbeam_windows.MainWindowOSX()
elif svlgui.SYSTEM=="html":
MainWindow = lightningbeam_windows.MainWindowHTML()
elif svlgui.SYSTEM=="android":
MainWindow = lightningbeam_windows.MainWindowAndroid()
MainWindow.stage.add(root, 0,0)
layers = svlgui.Group()
b = svlgui.Image("media/object_active.png",0,0,True,MainWindow.layerbox,16,1)
layers.add(b)
MainWindow.layerbox.add(layers,0,0)
frames = svlgui.Group(onload=onLoadFrames)
b = svlgui.Image("media/keyframe_active.png",0,0,True,MainWindow.timelinebox,16,1)
frames.add(b)
frames.onMouseDown = onClickFrame
MainWindow.timelinebox.add(frames,0,0)
def new_file(widget):
global root
MainWindow.stage.delete(root)
root = svlgui.Group()
root.level = True
root.onMouseDown = onMouseDownGroup
root.onMouseUp = onMouseUpGroup
root.onMouseMove = onMouseMoveGroup
MainWindow.stage.add(root,0,0)
def open_file(widget):
pass
def open_sc_file(widget):
pass
def save_file(widget):
pass
def save_file_as(widget):
pass
def quit(widget):
svlgui.quit()
def add_keyframe(widget=None):
root.descendItem().add_frame(True)
def add_layer(widget=None):
root.descendItem().add_layer(root.descendItem()._al)
layers.add(svlgui.Image("media/object_active.png",0,root.descendItem().layers.index(root.descendItem().activelayer)*32,True,MainWindow.layerbox,16,1))
print root.descendItem().layers.index(root.descendItem().activelayer)*32
#MainWindow.layerbox.draw()
def delete_layer(widget=None):
root.descendItem().delete_layer(root.descendItem()._al)
#layers.delete(box(0,(root.layers.index(root.activelayer))*32,128,32,svlgui.Color("media/object_inactive.png")))
MainWindow.timelineref.draw()
def send_to_back(widget=None):
rac = root.descendItem().activelayer.currentFrame()
index = rac.index(root.descendItem().activelayer.currentselect)
if index>0:
a = rac[:index]
b = rac[index+1:]
del rac[:index]
del rac[1:]
[rac.append(i) for i in a]
[rac.append(i) for i in b]
print rac
MainWindow.stage.draw()
def send_backward(widget=None):
rac = root.descendItem().activelayer.currentFrame()
index = rac.index(root.descendItem().activelayer.currentselect)
if index>0:
rac[index-1], rac[index] = rac[index], rac[index-1]
MainWindow.stage.draw()
def bring_forward(widget=None):
rac = root.descendItem().activelayer.currentFrame()
print rac
index = rac.index(root.descendItem().activelayer.currentselect)
if index+1<len(rac):
rac[index+1], rac[index] = rac[index], rac[index+1]
MainWindow.stage.draw()
def bring_to_front(widget=None):
rac = root.descendItem().activelayer.currentFrame()
index = rac.index(root.descendItem().activelayer.currentselect)
if index<len(rac):
a = rac[index]
del rac[index]
rac.append(a)
MainWindow.stage.draw()
def about(widget):
svlgui.alert("Lightningbeam v1.0-alpha1\nLast Updated: "+update_date()+
"\nCreated by: Skyler Lehmkuhl\nBased on SWIFT")
svlgui.menufuncs([["File",
("New...", new_file,"<Control>N"),
("Open", open_file,"<Control>O"),
("Open .sc", open_sc_file),
("Save",save_file,"<Control>S"),
("Save As", save_file_as,"<Shift><Control>S"),
["Import",
("Import to Stage"),
("Import to Library")],
["Export",
"Export .swf",
"Export HTML5",
"Export Native Application",
"Export .sc",
"Export Image",
"Export Video",
"Export .pdf",
"Export Animated GIF"],
"Publish",
("Quit",quit,"<Control>Q")],
["Edit",
"Undo",
"Redo",
"Cut",
"Copy",
"Paste",
"Delete",
"Preferences"],
["Timeline",
("Add Keyframe",add_keyframe,"F5"),
"Add Blank Keyframe",
("Add Layer",add_layer,"<Shift><Control>N"),
("Delete Layer",delete_layer,"<Shift><Control>Delete")],
["Tools",
("Execute",run_file,"<Alt>Return")],
["Modify",
"Document",
"Convert to Symbol",
("Send to Back",send_to_back,"<Shift><Control>Down"),
("Send Backwards",send_backward,"<Control>Down"),
("Bring Forwards",bring_forward,"<Control>Up"),
("Bring to Front",bring_to_front,"<Shift><Control>Up")],
["Help",
"Lightningbeam Help",
"Actionscript Reference",
("About Lightningbeam...",about)]])
#open("/home/skyler/Desktop/test.sc","w").write(create_sc(root))
if not svlgui.SYSTEM=="android":
svlgui.main()
else:
import os
svlgui.droid.webViewShow('{0}/lightningbeam_ui.html'.format(str(os.curdir)))
while True:
result = svlgui.droid.eventWaitFor('pythonevent').result
svlgui.droid.eventClearBuffer()
print result
exec result["data"]

265
lightningbeam_windows.py Normal file
View File

@ -0,0 +1,265 @@
#! /usr/bin/python
import svlgui
from misc_funcs import *
class MainWindow:
def __init__(self):
self.window = svlgui.Window("Lightningbeam")
self.window.maximize()
self.menu = svlgui.Menu(1, [[ "File",
"New",
"Open",
"Open .sc",
"Save",
"Save As...",
["Import...",
"Import to Stage",
"Import to Library"],
["Export...",
"Export .swf",
"Export HTML5",
"Export Native Application",
"Export .sc",
"Export Image",
"Export Video",
"Export .pdf",
"Export Animated GIF"],
"Publish",
"Quit"],
["Edit",
"Undo",
"Redo",
"Cut",
"Copy",
"Paste",
"Delete",
"Preferences"],
["Timeline",
"Add Keyframe",
"Add Blank Keyframe",
"Add Layer",
"Delete Current Layer"],
["Tools",
"Execute"],
["Modify",
"Document",
"Convert to Symbol",
"Send to Back",
"Send Backwards",
"Bring Forwards",
"Bring to Front"],
["Help",
"Lightningbeam Help",
"Actionscript Reference",
"About Lightningbeam"]])
#self.window.add(self.menu)
self.hbox1 = svlgui.HBox()
self.buttonbox = svlgui.ButtonBox(6,2)
self.buttonbox.buttons[0][0].set_image("media/left_ptr.png")
self.buttonbox.buttons[0][1].set_image("media/lasso.png")
self.buttonbox.buttons[1][0].set_image("media/resize.png")
self.buttonbox.buttons[1][1].set_image("media/text.png")
self.buttonbox.buttons[2][0].set_image("media/rectangle.png")
self.buttonbox.buttons[2][1].set_image("media/ellipse.png")
self.buttonbox.buttons[3][0].set_image("media/curve.png")
self.buttonbox.buttons[3][1].set_image("media/paintbrush.png")
self.buttonbox.buttons[4][0].set_image("media/pen.png")
self.buttonbox.buttons[4][1].set_image("media/paintbucket.png")
self.buttonbox.buttons[0][0].onPress = select_any
self.buttonbox.buttons[0][1].onPress = lasso
self.buttonbox.buttons[1][0].onPress = resize_any
self.buttonbox.buttons[1][1].onPress = text
self.buttonbox.buttons[2][0].onPress = rectangle
self.buttonbox.buttons[2][1].onPress = ellipse
self.buttonbox.buttons[3][0].onPress = curve
self.buttonbox.buttons[3][1].onPress = paintbrush
self.buttonbox.buttons[4][0].onPress = pen
self.buttonbox.buttons[4][1].onPress = paint_bucket
self.linebutton = svlgui.Button()
self.fillbutton= svlgui.Button()
self.linecanvas = svlgui.Canvas(60, 30)
self.fillcanvas = svlgui.Canvas(60, 30)
self.linebutton.set_content(self.linecanvas)
self.fillbutton.set_content(self.fillcanvas)
linegroup = svlgui.Layer()
linegroup.add(box(0,0,100,30,"#cccccc"))
linegroup.add(box(0,0,30,30,"media/curve.png"))
lbox = box(35,0,65,30,svlgui.LINECOLOR.rgb)
linegroup.add(lbox)
self.linecanvas.add(linegroup,0,0)
fillgroup = svlgui.Layer()
fillgroup.add(box(0,0,100,30,"#cccccc"))
fillgroup.add(box(0,0,30,30,"media/paintbucket.png"))
fbox = box(35,0,65,30,svlgui.FILLCOLOR.rgb)
fillgroup.add(fbox)
self.fillcanvas.add(fillgroup,0,0)
self.linebutton.onPress = lambda self1: svlgui.ColorSelectionWindow("line",linegroup,self.linecanvas)
self.fillbutton.onPress = lambda self1: svlgui.ColorSelectionWindow("fill",fillgroup,self.fillcanvas)
self.buttonbox.add(self.linebutton)
self.buttonbox.add(self.fillbutton)
self.hbox1.add(self.buttonbox)
self.vbox1 = svlgui.VBox(700,-1)
self.hbox1.add(self.vbox1)
self.stage = svlgui.Canvas(800,600)
self.timeline = svlgui.Canvas(2048,100)
self.timelineref = svlgui.Canvas(128,100)
self.timelinehbox = svlgui.HBox()
self.stagesw = svlgui.ScrolledWindow()
self.timelinesw = svlgui.ScrolledWindow()
#self.stagesw.add(self.stage)
#self.timelinesw.add(self.timeline)
self.timelinehbox.add(self.timelineref)
self.timelinehbox.add(self.timeline,True,True)
self.vbox1.add(self.timelinehbox)
self.vbox1.add(self.stage, True)
self.vbox2 = svlgui.VBox(-1,100)
self.actions = svlgui.TextView(True,200,200)
self.vbox2.add(self.actions)
self.hbox1.add(self.vbox2)
self.s1 = svlgui.Shape()
self.s1.shapedata=[["m",0,0],["l",200,0],["l",200,300],["l",0,300],["l",200,400],["l",0,400]]
self.s1.filled=True
group = svlgui.Group(self.s1)
#self.stage.add(group,23,42)
#self.stage.add(self.s1,0,0)
self.window.add(self.hbox1, True)
class MainWindowAndroid:
def __init__(self):
class stagewrapper:
def add(self, obj, x, y):
pass
self.stage = stagewrapper()
self.menu = svlgui.Menu(1, [[ "File",
"New",
"Open",
"Open .sc",
"Save",
"Save As...",
["Import...",
"Import to Stage",
"Import to Library"],
["Export...",
"Export .swf",
"Export HTML5",
"Export .sc",
"Export Image",
"Export Video",
"Export .pdf",
"Export Animated GIF"],
"Publish",
"Quit"],
["Edit",
"Undo",
"Redo",
"Cut",
"Copy",
"Paste",
"Delete",
"Preferences"],
["Timeline",
"Add Keyframe",
"Add Blank Keyframe"],
["Tools",
"Execute"],
["Modify",
"Document",
"Convert to Symbol",
"Send to Back",
"Send Backwards",
"Bring Forwards",
"Bring to Front"],
["Help",
"Lightningbeam Help",
"Actionscript Reference",
"About Lightningbeam"]])
class MainWindowOSX:
def __init__(self):
self.window = svlgui.Window("Lightningbeam")
self.menu = svlgui.Menu(True, None)
self.stage = svlgui.Canvas(800,600)
self.layerbox = svlgui.Canvas(128,320)
self.timelinebox = svlgui.Canvas(2000,320)
self.frame = svlgui.Frame()
self.toolbox = svlgui.Grid([svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")])
self.toolbox.buttons[0][0].set_image("media/left_ptr.png")
self.toolbox.buttons[0][1].set_image("media/lasso.png")
self.toolbox.buttons[1][0].set_image("media/resize.png")
self.toolbox.buttons[1][1].set_image("media/text.png")
self.toolbox.buttons[2][0].set_image("media/rectangle.png")
self.toolbox.buttons[2][1].set_image("media/ellipse.png")
self.toolbox.buttons[3][0].set_image("media/curve.png")
self.toolbox.buttons[3][1].set_image("media/paintbrush.png")
self.toolbox.buttons[4][0].set_image("media/pen.png")
self.toolbox.buttons[4][1].set_image("media/paintbucket.png")
self.toolbox.buttons[0][0].onPress = select_any
self.toolbox.buttons[0][1].onPress = lasso
self.toolbox.buttons[1][0].onPress = resize_any
self.toolbox.buttons[1][1].onPress = text
self.toolbox.buttons[2][0].onPress = rectangle
self.toolbox.buttons[2][1].onPress = ellipse
self.toolbox.buttons[3][0].onPress = curve
self.toolbox.buttons[3][1].onPress = paintbrush
self.toolbox.buttons[4][0].onPress = pen
self.toolbox.buttons[4][1].onPress = paint_bucket
self.frame.layout_self( [self.toolbox,0,None,0,0,"nws",""],
[self.timelinebox,self.toolbox._int()+148,0,0,None,"new","hv"],
[self.layerbox,self.toolbox._int(),self.toolbox._int().width+150,0,None,"n","v"],
[self.stage,self.toolbox._int(),0,self.timelinebox._int()+2,0,"nsew", "hv"])
self.window.add(self.frame)
# use mainwindowosx, this is just to comment things out
class MainWindowHTML:
def __init__(self):
self.window = svlgui.Window("Lightningbeam")
self.menu = svlgui.Menu(True, None)
self.stage = svlgui.Canvas(800,600)
self.layerbox = svlgui.Canvas(128,320)
self.timelinebox = svlgui.Canvas(2000,320)
self.frame = svlgui.Frame()
self.toolbox = svlgui.Grid([svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")],
[svlgui.Button("------"),svlgui.Button("------")])
self.toolbox.buttons[0][0].set_image("media/left_ptr.png")
self.toolbox.buttons[0][1].set_image("media/lasso.png")
self.toolbox.buttons[1][0].set_image("media/resize.png")
self.toolbox.buttons[1][1].set_image("media/text.png")
self.toolbox.buttons[2][0].set_image("media/rectangle.png")
self.toolbox.buttons[2][1].set_image("media/ellipse.png")
self.toolbox.buttons[3][0].set_image("media/curve.png")
self.toolbox.buttons[3][1].set_image("media/paintbrush.png")
self.toolbox.buttons[4][0].set_image("media/pen.png")
self.toolbox.buttons[4][1].set_image("media/paintbucket.png")
self.toolbox.buttons[0][0].onPress = select_any
self.toolbox.buttons[0][1].onPress = lasso
self.toolbox.buttons[1][0].onPress = resize_any
self.toolbox.buttons[1][1].onPress = text
self.toolbox.buttons[2][0].onPress = rectangle
self.toolbox.buttons[2][1].onPress = ellipse
self.toolbox.buttons[3][0].onPress = curve
self.toolbox.buttons[3][1].onPress = paintbrush
self.toolbox.buttons[4][0].onPress = pen
self.toolbox.buttons[4][1].onPress = paint_bucket
self.frame.layout_self( [self.toolbox,0,None,0,0,"nws",""],
[self.timelinebox,148,0,0,None,"new","hv"],
[self.layerbox,140,150,0,None,"n","v"],
[self.stage,140,0,2,0,"nsew", "hv"])
self.window.add(self.frame)
if __name__=="__main__":
a = MainWindow()

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

BIN
media/cursor_curve.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 657 B

BIN
media/cursor_paintbrush.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 819 B

BIN
media/cursor_paintbucket.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
media/cursor_pen.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

BIN
media/cursor_resize.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 770 B

BIN
media/curve.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 576 B

BIN
media/ellipse.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 714 B

BIN
media/eraser.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 775 B

BIN
media/folder.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
media/frame_active_tween.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 857 B

BIN
media/frame_inactive_tween.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 656 B

BIN
media/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 198 KiB

BIN
media/icon.xcf Normal file

Binary file not shown.

BIN
media/icon2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 347 KiB

BIN
media/icon2.png.zip Normal file

Binary file not shown.

BIN
media/icon2.xcf Normal file

Binary file not shown.

BIN
media/icon_128.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

BIN
media/icon_16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
media/icon_256.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 101 KiB

BIN
media/icon_32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
media/icon_512.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 KiB

BIN
media/icon_small.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
media/keyframe_active.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

BIN
media/keyframe_inactive.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 750 B

BIN
media/lasso.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 527 B

BIN
media/left_ptr.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

BIN
media/logo-transparent.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 KiB

BIN
media/logo.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 279 KiB

150
media/logo.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 86 KiB

BIN
media/logo.xcf Normal file

Binary file not shown.

BIN
media/logoclouds.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 267 KiB

BIN
media/logosmall-blog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 115 KiB

BIN
media/logosmall.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

BIN
media/object_active.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

BIN
media/object_inactive.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

BIN
media/object_inactive.xcf Executable file

Binary file not shown.

BIN
media/paintbrush.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 876 B

BIN
media/paintbucket.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
media/pen.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 811 B

BIN
media/rectangle.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 244 B

BIN
media/resize.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 296 B

BIN
media/sphere.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 KiB

BIN
media/text.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 575 B

85
misc_funcs.py Normal file
View File

@ -0,0 +1,85 @@
import svlgui
from threading import Event, Thread
def select_any(self):
svlgui.MODE = " "
def resize_any(self):
svlgui.MODE = " "
def lasso(self):
svlgui.MODE = "l"
def text(self):
svlgui.MODE = "t"
def rectangle(self):
svlgui.MODE = "r"
def ellipse(self):
svlgui.MODE = "e"
def curve(self):
svlgui.MODE = "c"
def paintbrush(self):
svlgui.MODE = "p"
def pen(self):
svlgui.MODE = "n"
def paint_bucket(self):
svlgui.MODE = "b"
def box(x, y, width, height, fill):
global objects
box = svlgui.Shape(x, y)
box.shapedata = [["M",0,0],["L",width,0],["L",width,height],["L",0,height],["L",0,0]]
box.fillcolor = svlgui.Color(fill)
box.linecolor = svlgui.Color("#cccccc")
box.filled = True
return box
# Timer module - not mine
# Copyright (c) 2009 Geoffrey Foster
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following
# conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
class RepeatTimer(Thread):
def __init__(self, interval, function, iterations=0, args=[], kwargs={}):
Thread.__init__(self)
self.interval = interval
self.function = function
self.iterations = iterations
self.args = args
self.kwargs = kwargs
self.finished = Event()
def run(self):
count = 0
while not self.finished.is_set() and (self.iterations <= 0 or count < self.iterations):
try:
self.finished.wait(self.interval)
if not self.finished.is_set():
#print self.function
self.function(*self.args, **self.kwargs)
count += 1
except Exception as e:
self.cancel()
def cancel(self):
self.finished.set()

1569
svlgui.py Normal file

File diff suppressed because it is too large Load Diff