SEPY 1.0.6.3 testing version

I just uploaded a new version on the sourceforge site (1.0.6.3).
With this version I started with some testing on various features I would like to use in the version 2 of SEPY.
In fact I left the old XML based system for internationalization in order to start using python gettext and wxPython i18n support. It also has been added a feature in the preference panel (under autocompletion tab) which allow user to define the builtin classpath used by the program It’s a testing version, for this reason pay attention with it and please report to me problems.

P.S. Actually there are is english, french and italian translation (because this is only for testing purposes), if you’re interested on how to had your language support i will write the steps for install more languages

SE|PY ActionScript editor 1.0.3.3

I’ve just uploaded a new version (1.0.3.3) of SEPY ActionScript Editor.
In this version:

  • Minor graphical changes
  • fixed: [ 994202 ] Cancel New project Error
  • fixed: [ 994203 ] Missing tooltip (minor bug)
  • Removed “;” after closing bracket “}” in the autoformat code.
  • Added option for use the auto-indent feature
  • Switched to wxPython 2.5.2.3pu-20040722
  • Changes in the Flash Help window.

Download the Windows installer
Download the source code

As always, thanks to all the people who help me with bugs reporting. It’s essential for the project development.
P.S. I’ve noticed that python group just released the first alpha of python 2.4. Once released the final release I will switch to the new version.

wxPython and Flash, first test


Today I make the first test integrating a Flash movie into a python application and using a communication between the two applications using FSCommand and the flashvars.
The result (surprendent easy) it’s a simple movie which enables text files saving in the local computer (through a prompt dialog window), but it has already opened my mind to future real cool applications 😉

This is the python code, the core part it’s the “wx.lib.flashwin” import, which enable to use Flash ActiveX in a python frame

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx, sys, os
import string, codecs
from wx.lib.flashwin import FlashWindow
from wx.lib.flashwin import EVT_FSCommand
#----------------------------------------

class TestPanel(wx.Panel):
    def __init__(self, parent, base, swf):
        wx.Panel.__init__(self, parent, -1)
        self.base = base
        sizer = wx.BoxSizer(wx.VERTICAL)
        self.flash = FlashWindow(self, style=wx.SUNKEN_BORDER)   
        dlg = wx.MessageDialog(self, "This will work only under Windows!","Warning!",wx.OK | wx.ICON_INFORMATION)
        dlg.Center()
        dlg.ShowModal()        
        wx.BeginBusyCursor()
        try:
            self.flash.LoadMovie(0, swf)
        except:
            wx.MessageDialog(self, "could not load the swf file","Error",wx.OK | wx.ICON_ERROR).ShowModal()
            sys.exit(2)
        wx.EndBusyCursor()        
        self.flash.Stop()      
        self.flash.SetSize((self.flash.GetSize()[0],self.flash.GetSize()[1]))
        # sizer
        sizer.Add(self.flash, 1, wx.EXPAND)
        self.SetSizer(sizer)
        self.SetAutoLayout(True)
        sizer.Fit(self)
        sizer.SetSizeHints(self)        
        self.SetFlashOptions()
        self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
        self.Bind(EVT_FSCommand, self.CallMethod)
        
    def SetFlashOptions(self):
        self.flash.menu = False
        self.flash._set_FlashVars("data=Server started on " + sys.platform)
        self.flash.Play()
        
    def OnDestroy(self, evt):
        if self.flash:
            self.flash.Cleanup()
            self.flash = None

    # Called from Flash FSCommand
    def CallMethod(self, evt):
        try:
            arguments = string.split(evt.args,"###")
            filename = arguments[0]
            body = arguments[1]
            if filename == "" or body == "":
                wx.MessageDialog(self, "Please check data inserted", "An Error occurred", wx.OK | wx.ICON_INFORMATION).ShowModal()
            else:
                dlg = wx.FileDialog(self, "Save as..." , os.getcwd(), filename, "*.*", wx.SAVE | wx.OVERWRITE_PROMPT )
                if dlg.ShowModal() == wx.ID_OK:
                    try:
                        f = codecs.open(os.path.normpath(dlg.GetPath()), "w", "utf-8", "ignore")
                        f.write(codecs.utf_8_decode(codecs.BOM_UTF8)[0])
                        f.write(body)
                        f.close()
                        self.flash._set_FlashVars("data=Succesfully saved text file")
                    except:
                        wx.MessageDialog(self, "%s %s %s" % sys.exc_info(), "An Error occurred", wx.OK | wx.ICON_ERROR).ShowModal()
                        self.flash._set_FlashVars("data=%s %s %s" % sys.exc_info())
        except:
            wx.MessageDialog(self, "Please check data inserted","An Error occurred",wx.OK | wx.ICON_INFORMATION).ShowModal()
            self.flash._set_FlashVars("data=%s %s %s" % sys.exc_info())
#-------------------------------------------
if __name__ == '__main__':
    class TestFrame(wx.Frame):
        def __init__(self):
            wx.Frame.__init__(self, None, -1, "ActiveX -- Flash", size=(640, 480), style=wx.DEFAULT_FRAME_STYLE )
            base = os.path.normpath(os.path.abspath(os.path.dirname(sys.argv[0])))
            swf = os.path.normpath(os.path.join(base, "movie.swf"))
            self.tp = TestPanel(self, base, swf)
    app = wx.PySimpleApp()
    frame = TestFrame()
    frame.Center()
    frame.Show(True)    
    app.MainLoop()

the flash part is really easy. Two text field, one button and one line of code!:

on (click) {	fscommand("saveFile", this._parent.fnome.text + "###" + this._parent.ftesto.text)}

P.S. Moreover today I read in wxPython mailing list a coming new version of wxPython. I hope this will begin to fix varoius problems with Mac installation of SE|PY