XUL and Python Update
Gerald Bauer <[email protected]> Sun, 9 Feb 2003 11:37:03 -0500 (EST)
| Newsgroups | gmane.comp.python.anygui.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
In case anyone is interested, here's an update to
last summer's heated Python and XUL debate:
Finally I managed to release the Luxor XUL Python
example suite that sports a mini calculator, a channel
surfer, a counter and more.
If you anyone is interested how XUL and Python can
work together for building toolkit-independent UIs
grab a copy at
http://sourceforge.net/project/showfiles.php?group_id=28946
(look for the luxor-python-examples package).
In case you haven't heard about Luxor before, here's
a short blurb:
Luxor is an open-source XML User Interface Language
(XUL) toolkit in Java that supports handpicked Mozilla
XUL goodies and includes a web server, a portal engine
(supporting RSS), a template engine (Velocity), a
scripting interpreter (Python) and more.
For more info check out the Luxor site @
http://luxor-xul.sourceforge.net
If you have any comments regarding Luxor itself (not
related to anygui) I invite you to join the
luxor-xul-user mailing list @
http://lists.sourceforge.net/lists/listinfo/luxor-xul-user
- Gerald (Luxor Project Lead)
PS: Here's a sneak preview:
counter.py
================================
from java.io import File
from javax.swing import JFrame
from java.awt import BorderLayout
from luxor import XulManager, XulAction, XulInput,
XulForm
from luxor.core.loader import ChromeFileResourceLoader
from houston import Status, StatusConsole
class CounterForm( XulForm ):
def __init__( self ):
XulForm.__init__( self, "COUNTER" )
self.setup()
def init( self ):
self.display = XulInput( self, "DISPLAY" )
def setCounter( self, counter ):
self.display.text = str( counter )
class AppFrame( JFrame ):
def __init__( self ):
JFrame.__init__( self, "Luxor Counter Example" )
self.defaultCloseOperation =
JFrame.EXIT_ON_CLOSE
self.counter = 0
DynXulAction( "inc", self.onIncCounter )
DynXulAction( "clear", self.onClearCounter )
DynXulAction( "dec", self.onDecCounter )
xul = XulMan(
"c:/sandbox/python/src/counter/chrome" )
self.counterForm = CounterForm()
self.contentPane.layout = BorderLayout()
self.contentPane.add(
self.counterForm.getJComponent(), BorderLayout.CENTER
)
self.updateCounter()
self.pack()
self.show()
def updateCounter( self ):
self.counterForm.setCounter( self.counter )
def onIncCounter( self ):
self.counter += 1
self.updateCounter()
def onDecCounter( self ):
self.counter -= 1
self.updateCounter()
def onClearCounter( self ):
self.counter = 0
self.updateCounter()
if __name__ == '__main__':
Status.addListener( StatusConsole() )
AppFrame()
counter.xul:
================================
<xul>
<vbox id="COUNTER">
<groupbox>
<caption label="Counter"/>
<textbox id="DISPLAY"
style="align: center; color: yellow;
background: black; font: 24 bold monospace;" />
</groupbox>
<hbox>
<button label="Dec (-)" command="dec"
style="width: 90px" />
<button label="Clear" command="clear"
style="width: 90px" />
<button label="Inc (+)" command="inc"
style="width: 90px" />
</hbox>
</vbox>
</xul>
______________________________________________________________________
Post your free ad now! http://personals.yahoo.ca
-------------------------------------------------------
This SF.NET email is sponsored by:
SourceForge Enterprise Edition + IBM + LinuxWorld = Something 2 See!
http://www.vasoftware.com