Roberto Cavada <[EMAIL PROTECTED]> writes:

> On Thu, 2004-09-30 at 13:18 +0300, Ruslan wrote:
>> I would like to ask people using pygtk + glade to share their approach
>> on code decomposition. 
> I use a mvc+observer pattern from my gtkmvc (see
> <http://sra.itc.it/people/cavada/mvc>). Each pair controller+view can be
> associated to a separate glade file, or to a set of subtrees of one or
> more glade trees. In my opinion this approach helps a lot in separating
> the different parts of a GUI. The model(s) can also be splitted, so
> obtaining good a separation of the application logic as well. 
> rob

Thanks from me too!  This looks really nice and happens to fall in my
lap at just the moment I needed something like it.

For the application I'm working on my model would shadow the state of
a networked server.  The desire is to have the model sync to the
server's state through XML-RPC calls.  The model updates through
periodic polling of the server and changes to the model by the client
application should, likewise, get pushed to the server.

So, in the controller, when I do something like:

  self.model.something = new_something

I want it to trigger an XML-RPC call to set the "something" parameter
on the server.  I've implemented MyModel.__setattr__() to do this
interception and from there pass the call along to the parent by
calling Model.__setattr__().

This seems to work, but is it the best way?  For example, in the end
my __setattr__ will have a big list of if blocks, one for each
intercepted property which isn't so pretty.

Thanks,
-Brett.


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to