From fec7511700d958b60b5c59fb26ae1ff2168a1f2a Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:08:51 -0500 Subject: [PATCH 01/26] Depend on imagemagick for image conversion --- control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control b/control index 94f631e..09e1271 100644 --- a/control +++ b/control @@ -4,6 +4,6 @@ Section: graphics Priority: optional Architecture: all Installed-size: 27000 -Depends: bash, python, python-imaging +Depends: bash, python, python-imaging, imagemagick Maintainer: skycooler@gmail.com Description: Lightningbeam is an open-source animated content creation tool. From 20676240c4ea37738d82382d27a1a9ea495dd77e Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:18:27 -0500 Subject: [PATCH 02/26] Fixed initial image scale on Linux --- GUI/Gtk/Canvas.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/GUI/Gtk/Canvas.py b/GUI/Gtk/Canvas.py index e980a00..5344f5a 100644 --- a/GUI/Gtk/Canvas.py +++ b/GUI/Gtk/Canvas.py @@ -171,10 +171,9 @@ class Canvas(GCanvas, GCanvasPaths): #ctx.set_source_rgba(*self._state.fillcolor._rgba) if self.fillcolor.image: # surface = - ctx.set_source_pixbuf(self.fillcolor.image, 0, 0) ctx.save() - print (self.maxx-self.minx)*1.0/self.fillcolor.image.get_width() - self._gtk_ctx.scale((self.maxx-self.minx)*1.0/self.fillcolor.image.get_width(), 1) + ctx.scale((self.maxx-self.minx)*1.0/self.fillcolor.image.get_width(), (self.maxy-self.miny)*1.0/self.fillcolor.image.get_height()) + ctx.set_source_pixbuf(self.fillcolor.image, 0, 0) ctx.fill_preserve() ctx.restore() else: From 682b30540c7306790e74d59a9b6f2a29d3d42a1f Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:20:41 -0500 Subject: [PATCH 03/26] Removed a few debugging prints --- lightningbeam.py | 1 - 1 file changed, 1 deletion(-) diff --git a/lightningbeam.py b/lightningbeam.py index 20b017b..2820002 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -640,7 +640,6 @@ def import_to_stage(widget=None): os.system("convert "+thefile+" "+svlgui.SECURETEMPDIR+"/"+".".join(thefile.split("/")[-1].split(".")[:-1])+".png") thefile = svlgui.SECURETEMPDIR+"/"+".".join(thefile.split("/")[-1].split(".")[:-1])+".png" im = box(100,100,200,200,svlgui.Color(thefile)) - print im.filled im.onMouseDown = onMouseDownObj im.onMouseMove = onMouseMoveObj im.onMouseDrag = onMouseDragObj From 3354775a9a239ff9b1bb97b6be0dd2106a134a48 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:32:16 -0500 Subject: [PATCH 04/26] Gave file types names in Linux file dialogs --- svlgui.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/svlgui.py b/svlgui.py index c2fdb86..7a521ab 100644 --- a/svlgui.py +++ b/svlgui.py @@ -2888,6 +2888,14 @@ def file_dialog(mode="open",default=None,types=None,multiple=False,name=None): for i in types: ntypes.append(GUI.Files.FileType()) ntypes[-1].suffix = i + image = ["jpg", "jpeg", "png", "tiff", "tga"] + audio = ["wav", "mp3", "ogg"] + if i in image: + ntypes[-1].name = i.upper()+" Images" + elif i in audio: + ntypes[-1].name = i.upper()+" Audio" + else: + ntypes[-1].name = i.upper()+" Files" if i in mactypes: ntypes[-1].mac_type=mactypes[i] types = ntypes From ec0a4a5d4bfda70500b5cda6255b915a6e9f3e7b Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:34:18 -0500 Subject: [PATCH 05/26] Handle cancels of imports gracefully --- lightningbeam.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lightningbeam.py b/lightningbeam.py index 2820002..ab0169d 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -629,7 +629,11 @@ def save_file_as(widget=None): svlgui.FILE = thetarfile pass def import_to_stage(widget=None): - thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav"]).path + try: + thefile = svlgui.file_dialog("open",None,["jpg","png","bmp","wav"]).path + except AttributeError: + # User cancelled + return for i in ("jpg","png","bmp"): if thefile.endswith(i): # im = svlgui.Image(thefile) From 5925ca7dc2d69031ebb3e64708765f5b0bf23d8f Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 13:37:34 -0500 Subject: [PATCH 06/26] Handle other cancels gracefully --- lightningbeam.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lightningbeam.py b/lightningbeam.py index ab0169d..16758e1 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -539,7 +539,11 @@ def open_file(widget=None): global root MainWindow.stage.delete(root) shutil.rmtree(svlgui.SECURETEMPDIR) - thetarfile = tarfile.open(fileobj=svlgui.file_dialog("open").open("rb"),mode="r:gz") + try: + thetarfile = tarfile.open(fileobj=svlgui.file_dialog("open").open("rb"),mode="r:gz") + except AttributeError: + # User cancelled + return basefile = thetarfile.extractfile("basefile") root, svlgui.Library = pickle.load(basefile) svlgui.SECURETEMPDIR = tempfile.mkdtemp() @@ -566,8 +570,11 @@ def save_file(widget=None): tarinfo = tarfile.TarInfo('basefile') tarinfo.size = len(data) if svlgui.FILE.name.startswith(svlgui.TEMPDIR): - thetarfile = tarfile.open(fileobj=svlgui.file_dialog("save", name="untitled.beam").open('wb'),mode="w:gz") - print thetarfile.name + try: + thetarfile = tarfile.open(fileobj=svlgui.file_dialog("save", name="untitled.beam").open('wb'),mode="w:gz") + except AttributeError: + # User cancelled + return else: thetarfile = tarfile.open(svlgui.FILE.name,mode="w:gz") thetarfile.addfile(tarinfo, StringIO.StringIO(data)) @@ -607,7 +614,11 @@ def save_file_as(widget=None): data = pickle.dumps((root,svlgui.Library)) tarinfo = tarfile.TarInfo('basefile') tarinfo.size = len(data) - thetarfile = tarfile.open(fileobj=svlgui.file_dialog("save", name="untitled.beam").open('wb'),mode="w:gz") + try: + thetarfile = tarfile.open(fileobj=svlgui.file_dialog("save", name="untitled.beam").open('wb'),mode="w:gz") + except AttributeError: + # User cancelled + return thetarfile.addfile(tarinfo, StringIO.StringIO(data)) #Save the path so we can come back here lastpath = os.path.abspath(".") From 1e4fc31bf953b85624b1670edc91d8a8e0ec7a86 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 20:26:25 -0500 Subject: [PATCH 07/26] Turns out swfc requires libzzip. --- control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/control b/control index 09e1271..e095b54 100644 --- a/control +++ b/control @@ -4,6 +4,6 @@ Section: graphics Priority: optional Architecture: all Installed-size: 27000 -Depends: bash, python, python-imaging, imagemagick +Depends: bash, python, python-imaging, imagemagick, libzzip-0-13 Maintainer: skycooler@gmail.com Description: Lightningbeam is an open-source animated content creation tool. From 6cb2d1ea4cf23d25404f8e1d68937b031c00e1ef Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 20:28:58 -0500 Subject: [PATCH 08/26] Added export to SWF --- lightningbeam.py | 26 +++++++++++++++++++++++++- svlgui.py | 1 + 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lightningbeam.py b/lightningbeam.py index 16758e1..7142a0f 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -825,6 +825,29 @@ def convert_to_symbol(widget=None): svlgui.ConvertToSymbolWindow(root, onMouseDownMC) MainWindow.stage.draw() +def export_svg(widget=None): + pass + +def export_swf(widget=None): + global root + root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions = MainWindow.scriptwindow.text + + f = svlgui.file_dialog("save", name="untitled.swf") + if not f: + return + open(f.path+".sc",'w').write(create_sc(root)) + # svlgui.execute("swfc/swfc_"+svlgui.PLATFORM+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf") + x = os.system("swfc/swfc_"+svlgui.PLATFORM+" "+f.path+".sc -o "+f.path) + if sys.version_info < (2, 6): + if x==5: # which is the error value returned when linking libjpeg fails + if svlgui.alert("You appear to be missing libjpeg. Install it?", confirm=True): + os.system("""osascript -e 'do shell script "mkdir -p /usr/local/lib; cp swfc/libjpeg.8.dylib /usr/local/lib" with administrator privileges'""") + x = os.system("swfc/swfc_"+svlgui.PLATFORM+" "+f.path+".sc -o "+f.path) + if x==5: + svlgui.alert("Sorry, something has gone terribly wrong.") + else: + return + def about(widget=None): svlgui.alert("Lightningbeam v1.0-alpha1\nLast Updated: "+update_date()+ "\nCreated by: Skyler Lehmkuhl\nBased on SWIFT") @@ -858,10 +881,11 @@ svlgui.menufuncs([["File", ("Import to Stage",import_to_stage,"/I"), ("Import to Library",import_to_library)], ["Export", - "Export .swf", + ("Export .swf",export_swf,""), "Export HTML5", "Export Native Application", "Export .sc", + ("Export SVG",export_svg,""), "Export Image", "Export Video", "Export .pdf", diff --git a/svlgui.py b/svlgui.py index 7a521ab..4553cd0 100644 --- a/svlgui.py +++ b/svlgui.py @@ -352,6 +352,7 @@ if SYSTEM=="osx": m.send_to_back.enabled = 1 m.import_to_stage.enabled = 1 m.import_to_library.enabled = 1 + m.export_swf.enabled = 1 m.convert_to_symbol.enabled = 1 m.preferences_cmd.enabled = 1 From fd55f0854d5c9b1e47fc43c9d50204f600e85bd4 Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Sat, 19 Jan 2013 16:06:43 -0500 Subject: [PATCH 09/26] Install flash debugger on Linux --- lightningbeam.py | 29 ++++++++++++++++++++++++++--- svlgui.py | 4 ++-- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lightningbeam.py b/lightningbeam.py index 7142a0f..43e84dd 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -49,6 +49,8 @@ global undo_stack global redo_stack undo_stack = [] redo_stack = [] +global preferences +preferences={} def clear(arr): arr.__delslice__(0,len(arr)) @@ -342,12 +344,29 @@ def run_file(self=None): # Untested. logloc = os.getenv('HOME')+"\\AppData\\Roaming\\Macromedia\\Flash Player\\Logs\\flashlog.txt" elif "linux" in svlgui.PLATFORM: + logloc = os.getenv('HOME')+"/.macromedia/Flash_Player/Logs/flashlog.txt" + if not os.path.exists('/usr/bin/flashplayerdebugger'): + if os.system('which gnash')==0: + if not 'use_gnash' in preferences: + if svlgui.alert("You have GNASH installed. Do you wish to use it instead of Adobe's flash player?", confirm=True): + use_gnash = True + return + else: + result = svlgui.alert("You do not have a Flash debugger installed. Install one?", confirm=True) + if not result: + svlgui.alert("Aborting.") + return + else: + svlgui.alert("The Flash Debugger will download when you click Ok.\nThis may take some time.") + if not "PPC" in svlgui.PLATFORM: + urllib.urlretrieve("http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.i386.tar.gz", "fp.tar.gz") + os.system("tar -zxf fp.tar.gz") + os.system("gksudo mv flashplayerdebugger /usr/bin/") if not os.path.exists(os.getenv('HOME')+"/mm.cfg"): # By default, the Flash debugger on Linux does not log traces. # So, we create a configuration file to tell it to do so if the user hasn't already. with open(os.getenv('HOME')+"/mm.cfg", "w") as mm: mm.write("ErrorReportingEnable=1\nTraceOutputFileEnable=1") - logloc = os.getenv('HOME')+"/.macromedia/Flash_Player/Logs/flashlog.txt" elif svlgui.PLATFORM=="osx": logloc = os.getenv('HOME')+"/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt" if not os.path.exists('/Applications/Flash Player Debugger.app'): @@ -412,8 +431,12 @@ def run_file(self=None): win_flash_player_loc = "" svlgui.execute('start '+win_flash_player_loc+" test.swf") elif svlgui.PLATFORM.startswith('linux'): - linux_flash_player_loc = "" - svlgui.execute("xdg-open "+linux_flash_player_loc+" "+os.getenv('HOME')+"/test.swf") + linux_flash_player_loc = "/usr/bin/flashplayerdebugger" + if not svlgui.execute(linux_flash_player_loc+" "+os.getenv('HOME')+"/test.swf &"): + if '64' in svlgui.PLATFORM: + svlgui.alert("Flash debugger failed to launch! Try installing ia32-libs.") + elif '32' in svlgui.PLATFORM: + svlgui.alert("Flash debugger failed to launch! No idea why.") def create_html5(root): retval = "\n\