Trellis: setting @maintain attributes / initialization rollback

"Sergey Schetinin" <[email protected]>
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
Consider this example:

class C(Component):
    @maintain(optional=True)
    def calc(self):
        return 0

    @maintain
    def getx(self):
        print 'get'
        self.calc

    @maintain
    def set(self):
        print 'set'
        self.calc = 1

c = C()

Depending on luck (order of hashes of get / set attr names I suppose)
we either get InputConflict or not.
If the get rule runs first, set rule is a conflict because the Cell is
set by the calc rule.
If set gets to run first, there's no conflict because calc rule
doesn't need to run.

Is it possible to have calc / get rules rollback even when set runs last?

It matters for nested windows layouts. For example there a frame with
a panel and a button in that panel. One layout rule reads
frame.client_size and sets panel.size, another one reads
panel.client_size, sets button.size.

If the second rule runs first, the maintain rule for Panel.client_size
is initialized by reading wx values and the frame layout rule fails to
override it due to an InputConflict. If rules run in reverse order,
everything works fine. I'm not sure there's a good way to make inner
layout rule depend on the outer one, and if it's not clear why I can
explain.


-- 
Best Regards,
Sergey Schetinin

http://s3bk.com/ -- S3 Backup
http://word-to-html.com/ -- Word to HTML Converter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.