def convert_to_symbol(widget=None): if not root.descendItem().activelayer.currentselect: svlgui.alert("No object selected!") return else: svlgui.ConvertToSymbolWindow(root) MainWindow.stage.draw()
def run_html(self=None): global root print "RUNNING" root.descendItem().activelayer.frames[root.descendItem().activelayer.currentframe].actions = MainWindow.scriptwindow.text open(os.getenv('HOME')+"/test.html", "w").write(create_html5(root)) try: shutil.copyfile("base.js",os.getenv('HOME')+"/base.js") except IOError: svlgui.alert("Couldn't copy base.js to "+os.getenv('HOME')+"/base.js!") webbrowser.open("file://"+os.getenv('HOME')+"/test.html")
def run_file(self=None): global root 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") #TODO: Make this cross-platform compatible logloc = os.getenv('HOME')+"/Library/Preferences/Macromedia/Flash Player/Logs/flashlog.txt" try: logfile.close() except: pass logfile = open(logloc,"w") logfile.write("") logfile.close() outputwin = svlgui.Window("Output") outputwin.resize(200,500) outputtext = svlgui.TextView(False) outputwin.add(outputtext) logfile = open(logloc, "r") def updatetrace(outputtext): try: outputtext.text+=logfile.readline() outputtext.scroll_bottom() # this doesn't work except: pass r = misc_funcs.RepeatTimer(0.02, updatetrace, args=[outputtext]) print dir(outputwin.window) r.daemon = True r.start() if svlgui.PLATFORM=="osx": osx_flash_player_loc = "/Applications/Flash\ Player\ Debugger.app" success = svlgui.execute("open -a "+osx_flash_player_loc+" "+os.getenv('HOME')+"/test.swf") if not success: svlgui.alert("Oops! Didn't work. I probably couldn't find your Flash debugger!") elif svlgui.PLATFORM=='win32': 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+" test.swf")
def about(widget=None): svlgui.alert("Lightningbeam v1.0-alpha1\nLast Updated: "+update_date()+ "\nCreated by: Skyler Lehmkuhl\nBased on SWIFT")