diff --git a/kt.py b/kt.py index dcac836..6036c9c 100644 --- a/kt.py +++ b/kt.py @@ -2,6 +2,7 @@ from random import random from kivy.app import App from kivy.lang import Builder from kivy.uix.widget import Widget +from kivy.uix.codeinput import CodeInput from kivy.uix.tabbedpanel import TabbedPanel from kivy.uix.button import Button from kivy.graphics import Color, Ellipse, Line diff --git a/lightningbeam.kv b/lightningbeam.kv index b71478d..d786086 100644 --- a/lightningbeam.kv +++ b/lightningbeam.kv @@ -1,11 +1,12 @@ #:kivy 1.0 +#:import ActionScriptLexer pygments.lexers.ActionScriptLexer : do_default_tab: False TabbedPanelItem: text: 'Drawing' BoxLayout: - orientation: "Vertical" + orientation: "vertical" TabbedPanelItem: text: 'Tools' @@ -27,6 +28,7 @@ text: "Painbrush" TabbedPanelItem: text: 'ActionScript' - TextInput: + CodeInput: multiline: True + lexer: ActionScriptLexer() font_name: 'UbuntuMono-R.ttf' \ No newline at end of file diff --git a/lightningbeam.py b/lightningbeam.py index 35662fe..574ffc7 100755 --- a/lightningbeam.py +++ b/lightningbeam.py @@ -3,7 +3,10 @@ # © 2012 Skyler Lehmkuhl # Released under the GPLv3. For more information, see gpl.txt. -import os, shutil, tarfile, tempfile, StringIO, urllib, subprocess +from __future__ import with_statement + +import os, shutil, tarfile, tempfile, StringIO, urllib, subprocess, sys + # Workaround for broken menubar under Ubuntu os.putenv("UBUNTU_MENUPROXY", "0") @@ -323,7 +326,17 @@ def run_file(self=None): print "RUNNING" root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions = MainWindow.scriptwindow.text open(os.getenv('HOME')+"/test.sc", "w").write(create_sc(root)) - svlgui.execute("swfc/swfc_"+svlgui.PLATFORM+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf") + # svlgui.execute("swfc/swfc_"+svlgui.PLATFORM+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf") + x = os.system("swfc/swfc_"+svlgui.PLATFORM+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf") + 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+" "+os.getenv('HOME')+"/test.sc -o "+os.getenv('HOME')+"/test.swf") + if x==5: + svlgui.alert("Sorry, something has gone terribly wrong.") + else: + return #TODO: Make this cross-platform compatible if svlgui.PLATFORM=="win32": # Untested. @@ -344,11 +357,15 @@ def run_file(self=None): svlgui.alert("Aborting.") return else: - svlgui.alert("The file will download when you click Ok.\nThis may take some time.") - urllib.urlretrieve("http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.app.zip", "fp.app.zip") + svlgui.alert("The Flash Debugger will download when you click Ok.\nThis may take some time.") + if sys.version_info < (2, 6): + # Newer flash players won't run on Leopard + urllib.urlretrieve("http://download.macromedia.com/pub/flashplayer/updaters/10/flashplayer_10_sa_debug.app.zip", "fp.app.zip") + else: + urllib.urlretrieve("http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_sa_debug.app.zip", "fp.app.zip") # Unzip the file. Apparently ditto is better for OSX apps than unzip. os.system('ditto -V -x -k --sequesterRsrc --rsrc fp.app.zip .') - shutil.move('Flash Player Debugger.app', '/Applications') + shutil.move('Flash Player Debugger.app', '/Applications/Flash Player Debugger.app') # Generally it is not recognized until it is opened os.system('open -a "/Applications/Flash Player Debugger.app"') # Set Flash Player Debugger as the default app for .swf files diff --git a/svlgui.py b/svlgui.py index 2a0d700..ba983d0 100644 --- a/svlgui.py +++ b/svlgui.py @@ -216,7 +216,7 @@ if sys.platform=="linux2": from GUI import GL try: from PIL import Image as PILImage - except ImportError as err: + except ImportError: import Image as PILImage from GUI.Geometry import offset_rect, rect_sized @@ -257,7 +257,7 @@ elif sys.platform=="win32": from GUI import GL try: from PIL import Image as PILImage - except ImportError as err: + except ImportError: import Image as PILImage media_path = "" SYSTEM="osx" @@ -297,7 +297,7 @@ elif sys.platform=="darwin": from GUI import GL try: from PIL import Image as PILImage - except ImportError as err: + except ImportError: import Image as PILImage SYSTEM="osx" ''' @@ -2739,7 +2739,7 @@ class Group (object): class TemporaryGroup(Group): """Created when selecting multiple items, for ease of use.""" def __init__(self, *args, **kwargs): - super(TemporaryGroup, self).__init__(*args, **kwargs) + (TemporaryGroup, self).__init__(*args, **kwargs) # def draw(self, cr=None, transform=None, rect=None): # super(TemporaryGroup, self).draw(cr, transform, rect) # print self.x, self.activelayer.x diff --git a/swfc/libjpeg.8.dylib b/swfc/libjpeg.8.dylib new file mode 100755 index 0000000..e637fcc Binary files /dev/null and b/swfc/libjpeg.8.dylib differ diff --git a/swfc/swfc_osx b/swfc/swfc_osx index da37a48..f59234e 100755 Binary files a/swfc/swfc_osx and b/swfc/swfc_osx differ