Canvas widget: should it be a ProxyWidget?
Lucas Di Pentima
lucas at di-pentima.com.ar
Thu Aug 9 19:07:21 BRT 2007
Hi Kiwi friends,
I'm writing a space-conquest strategy "board like" game with some friends,
and we're using PyGTK + Kiwi to do it. We're having some doubts about what
kind of entity should the "starmap" be.
I've written a custom gtk.DrawingArea widget to do this starmap, and now I
want to integrate it with the rest of the program, but I want to do it "the
kiwi way" :-)
The starmap is some kind of canvas widget that draws planets, ships, and
other sort of entities (model) that float in the universe, so one way to
think about the starmap is that it's the Game's view element in the MVC
Also, we accept user's click events on the starmap and the widget emit some
signal with the X,Y coordinates in light-year units, so the game can later
check if the user clicked on some ship or planet so select it. Because of
this, we also think of the starmap as some kind of controller.
>From this two points, we decided to write a ProxyWidget around this starmap
widget, so that changes on the "Game" model (that holds the planet and ship
collections, and some more data) will reflect on the starmap and user-events
on it will make changes on the model.
Our doubt is if this is a good idea because all the code and documentation
I've read points to proxy widgets that map 1-to-1 to model attributes, and
this starmap should reflect the state of several model attributes (examples:
planets collections, ship collections, selection pointer, ...) so I want to
ask your opinion about this, if this should be done this way or maybe using
a different approach.
This is our first project using Kiwi, we don't have almost any experience in
the long term :-)
Thanks in advance.
Lucas Di Pentima - Santa Fe, Argentina
------------ pr=F3xima parte ------------
Se ha borrado un adjunto en formato HTML...
More information about the Kiwi