ok folks - Phillip has set me straight.. or at least, he came up with a
scheme, in python, that provides a reasonable compact declaration-style
mechanism for childblocks that isn't absurdly verbose, and meets most
of the criteria I outlined before :)
Lesson learned from today: when phillip says "but you can do that
easily in python" remember his understanding of python is much deeper
and his definition of "easily" is probably a lot different than yours!
I'm working on a revised version of his original proposal...
Alec
Phillip J. Eby wrote:
At 02:19 PM 8/10/2005 -0700, Alec Flett wrote:
from somewhere.cpia_templates import Menu,
MenuItem
Menu("FileMenu", _('File'), [
Menu("NewMenu", _('New...'), [
MenuItem("NewMessageItem", _("Message"), ...),
MenuItem("NewNoteItem", _("Note"), ...),
])
]).install(parcel)
Wow. If you can explain a little more about how to do this, I'll throw
away all of my XmlForCpia work - seriously :)
do you mean that "Menu" is just a template wrapper around the Menu
class, or that we're somehow making the Menu class also implement this
template class?
i.e. is this something like, in somewhere.cpia_templates:
from osaf.framework import Blocks
Menu = template(Blocks.Menu)?
You could do it that way, although I think what you'd want is to have a
'template' classmethod on Item that created template instances. Then
somewhere.cpia_templates would be defined more like:
Menu = Blocks.Menu.template
etc.
|
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Open Source Applications Foundation "Dev" mailing list
http://lists.osafoundation.org/mailman/listinfo/dev