[Pythonmac-SIG] Python RAD tools
Adam Eijdenberg
adam@switchedonsoftware.com
Mon, 14 Jan 2002 00:27:32 +1100
Hello all,
I'm toying around with the idea of developing a Python rapid application
development tool, initially just for the Mac. This tool is written in C
for Carbon, so it is native in all regards and uses the Unix mach-o
version of Python.
Basically what I'm working on is a tool that allows the graphic design
of user interfaces, similar in nature to "Interface Builder" that then
allows Python scripts to be executed as a result of user actions, for
example, when a button is clicked, a user action occurs. The native file
format for a program description is XML.
I always think examples are the best way to explain these things, so
below is the description of a program that displays a window with a text
field and a button. Upon clicking the button what is in the text field
is evaluated and replaces the current content. It is a fairly trivial
example but may make a nice little calculator. :)
I'm not going to explain exactly how it is interpreted (it's too late at
night :), but it should be fairly obvious. Basically upon runtime the
param named "init" is run, which references a global variable "app" that
is passed to it. Then it just goes from there.
<project>
<param name="init">
win = app.getWindow ("Main").instantiate ()
win.show ()
</param>
<window name="Main">
<param name="onclose">
self.hide ()
app.quit ()
</param>
<param name="minimumsize">235 139</param>
<param name="title">Calculator</param>
<button name="">
<param name="bounds">* 120 * * 20 23</param>
<param name="action">
textField = self.getParentWindow ().getControl ("evalTF")
textField.setText (str (eval (textField.getText ())))
</param>
<param name="title">Evaluate</param>
</button>
<textfield name="evalTF">
<param name="bounds">28 * 28 57 16 *</param>
<param name="default"></param>
</textfield>
<label name="">
<param name="bounds">* 159 * 16 29 *</param>
<param name="style">heading</param>
<param name="align">centre</param>
<param name="title">Calculator</param>
</label>
</window>
</project>
(if you read that carefully and are wondering about the *'s in the
bounds, that is to do with handling of window resizing)
At the moment I have written an interface builder that produced the XML
above, and a runtime that will "run" this.
Both are still _way_ too buggy for any form of public release. But give
them a week or so. :)
But my question is, would a tool like this be welcomed? Is it a
duplication of existing effort or could it find a niche? What do you all
think?
Oh, and BTW I've called the project Viper. Sort of a mix of "Visual
Python", "rapid development" and "snakes".
Kind regards,
Adam Eijdenberg
Switched on Software
adam@switchedonsoftware.com
http://www.switchedonsoftware.com/
Phone: +61 3 6231 3467
Fax: +61 3 6231 3476
Mobile: +61 4 0704 6857
47 Molle Street
Hobart TAS 7000
Australia