[PEAK] Connecting the Trellis to non-trellis systems
maluke at gmail.com
Tue Mar 11 11:52:03 EDT 2008
I have a (proprietary) library that does a lot of things mentioned
except for Trellis integration. I looked into it, but can't work on that
until I finish a few milestones for my current contract. I don't mind
open-sourcing the library if there's enough people interested in working
on it (as compared to just using it). One note though: why are you using
camel-case in method and function names? It's ugly, but even if that's a
personal preference, it also breaks the python code style (there's even
a PEP on that IIRC).
So far the only Trellis integration I've got is editing the properties
of the windows, so the older-style code looks like this:
ok = add(panel, Button("OK")
props(ok).border = 4
props(ok).align = RIGHT
onevent(ok, CLICK, lambda: ....)
The event handlers can decide to accept additional info from event
dispatcher (sometimes some info is only present in the event object
while the event is being processed). There also needs to be a way to
stop event propagation, so this works as expected:
if not may_close():
This library is being used for all new development of S3 Backup
(s3bk.com) and the old code is being migrated to it as well (the old one
used a declarative approach).
Also a word of advice for people just starting with GUI development --
never use visual GUI editors, XRC or whatever it's simply not worth it
-- you loose a lot of control and don't gain anything except for more
complexity -- there are no time benefits at all.
Phillip J. Eby wrote:
> At 09:50 AM 3/11/2008 +0200, Peter Damoc wrote:
>> Hi Phillip,
>> Are there any GUI examples? wxPython examples would be ideal. :)
> Not yet, but there will be at some point. Gotta finish, test, and
> document the code first!
> However, I envision having something like an "EventConnector(wxobject,
> wxevent, defaultobject)" cell, whose subscribe/unsubscribe methods will
> simply call down to bind/unbind. And then those connectors will be
> wrapped in APIs like 'getMousePosition(wxobject)' that you'll be able to
> use in rules, to have the rule get recalculated when the mouse position
> changes. Or like 'mouseDown(wxobject)', that goes true when a mouse
> down event occurs, etc.
> My general idea is to make these either generic functions, or methods of
> a context.Service, so that you can write rules that are in fact not
> specific to the GUI backend in use. That way, you could write code
> that's not only cross-platform, but would also work with Qt, wx, Tk, or
> any other unpronounceable pair of consonants that stands for a GUI
> framework. ;-)
> I'm pretty excited, though, about the part where we won't have to use
> those %$$&%%($ "bind" calls any more, or figure out how to reverse-map
> the GUI's events into our application's state machines. Instead, we'll
> get to treat the GUI like a *library* instead of a framework.
> Looks like the Trellis is going to be able to "untwist" more than just
> Twisted, in other words.
> PEAK mailing list
> PEAK at eby-sarna.com
More information about the PEAK