On Thu, Feb 28, 2008 at 11:44 AM, Christopher Barker <[EMAIL PROTECTED]> wrote: > You can add a custom Object with a _draw method that used GC now -- but > I would like to better integrate it.
Yes better integration is always good so someone does not have to subclass every object and write their own _draw method > > > mouseover/click > there > > /drag/drop/ > can be done, but not so elegant... > > show/hide > you can show/hide objects, but I'm not sure what you mean by events -- > do you want en event raised when a object is shown/hidden? Yes I would need events for all of those, and looking back at my old code, which I did have these events, it shouldnt be to hard to add them to FC > hmm -- that's tough. To do that, you need a drawing abstraction layer. > At the moment, FloatCanvas is pretty tied to wx. However, I did try (and > want to make this cleaner) to keep the Objects separated from the canvas > -- i.e. they can exist without a canvas, the same object can be on > multiple canvases, etc. So you could have objects that require a > different Draw Method for each back-end. If you don't want that, it gets > trickier, maybe it's worth looking at Enthought's Kiva, but I don't know > that we'll get the performance we need with that. Looks like Enthought has not released anything since 2006 and does not support Python 2.5. So I would not use their code, but looking at it to see how they did their drawing layer abstraction might be good. How I have this mapped out in my design docs for what I was writing is each object contains all the info that would be required to draw it regardless of toolkit, but not the drawing method (as thats tied to the toolkit), the canvas would have a registerObject method that would accept the Object Class and a Render function, and use instancemethod to insert that function into the class when it gets added to the Canvas. The reason I need the abstraction is I will be sending the objects around the network and one person may be using wxPython, another might be using pyqt and yet another might be using a browser with AJAX, so for my needs the object cannot be tied to a toolkit, it should be the particular canvases job to inset the proper drawing method. > > If you want to handle all the events, too , then you need some kind of > event abstraction layer too. I had all the events I listed plus selection and deselection events and didnt have an event abstraction layer, I just used wx.PyEventBinder to create the events _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
