You are not logged in Log in Join
You are here: Home » Members » sspickle » Zope SWF Output Object » Zwiff (SWF Output) 0.0.5 Released » View NewsItem

Log in
Name

Password

 

Zwiff (SWF Output) 0.0.5 Released

The initial testing release of Zwiff is ready. Here is the README.txt

==========================================================================

README for Zwiff Version 0.0.5

$Revision: 1.13 $

==========================================================================

Zwiff is a swf file generator using ming.

A Zwiff is a subclass of PythonMethod that includes the ming wrapper to build swf objects into a movie that can be played with a swf player in the browser.

The current version works with a patched version of ming-0.0.4 [email protected] (Ming's author... ) has given me permission to include a full distribution of ming with Zwiff (including whatever monkeybusiness needed to get it to work with Zope!)

INSTALLATION:

Unpack the Zwiff-x.x.x.tgz in the root Zope directory. You'll need to build mingcmodule.so and install it (follow instructions from the ming distribution.... ). You'll also need to put ming.py (from the ming/py_ext directory) somewhere on your PYTHONPATH (the Zwiff directory is OK, but if you want to use ming in other python programs, you'll want to install it somewhere more globally accessable...). (I usually just build ming in the Zwiff/ming directory and mingcmodule.so in the Zwiff/ming/py_ext directory and then make symbolic links back to the Zwiff directory. I have included build.py as a simple minded attempt to automate this... YMMV.. )

You must also have PythonMethod (0.1.7) installed for Zwiff to work.

HOW DO I USE IT?

You can find lots of ming (php) examples on opaque.net. The python syntax differs from the php version, but it's close enough so that you can fairly easily convert from one to the other. There are also some ready-made swf files that you can automatically compare to those made by your python module at oapque.net .

Here is an example that draws a couple of polygons on the screen and the words "Zwiff on Zope!". When you create this object, be sure to include the RESPONSE object in the attributes!:

        m = zwiff_mod.SWFMovie()
        m.setRate(12.0)
        m.setDimension(200*20, 120*20)
        m.setBackground(0xff, 0xff, 0xff)

        x=zwiff_mod.SWFShape()
        x.setLine(50,0xff,0,0,0xff)
        sf = x.addSolidFill(0x00, 0x00, 0xff, 0xaf)
        x.setLeftFill(sf)
        x.moveTo(10*20,100*20)
        x.lineTo(100*20,100*20)
        x.lineTo(90*20,70*20)
        x.lineTo(20*20,70*20)
        x.lineTo(10*20,100*20)
        m.add(x)

        x=zwiff_mod.SWFShape()
        x.setLine(50,0xff,0,0,0xff)
        sf = x.addSolidFill(0x00, 0xff, 0x00, 0x9f)
        x.setLeftFill(sf)
        x.moveTo(20*20,90*20)
        x.lineTo(70*20,70*20)
        x.lineTo(90*20,40*20)
        x.lineTo(20*20,70*20)
        x.lineTo(20*20,90*20)
        m.add(x)

        f = zwiff_mod.SWFFont(zwiff_mod.packageDir + "/ming/examples/common/test.fdb")
        t = zwiff_mod.SWFText()
        t.setFont(f)
        t.setXY(10*20, 40*20)
        t.setColor(0x00, 0x00, 0x00, 0xff)
        t.setHeight(20*20)
        t.addString("Zwiff on Zope!")

        m.add(t)

        m.nextFrame()

        return zwiff_mod.handleMovieOutput(m, RESPONSE)

Good Luck!

-steve

  1. S. There is now a zwiff_examples.zexp included. You'll need to download examples.tgz to use these. Unpack them into your Zwiff/ming directory.