From 6cb2d1ea4cf23d25404f8e1d68937b031c00e1ef Mon Sep 17 00:00:00 2001 From: Skyler Lehmkuhl Date: Fri, 18 Jan 2013 20:28:58 -0500 Subject: [PATCH] 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