David Poundall wrote:
> Has anyone been able to pickle the contents of a canvas thereby
> enabling a drawing to be saved for later presentation?

I've never tried, and I'm afraid that I haven't kept this in mind at all 
when designing it. It may "just work", but there are enough 
interconnected classes that it may not.

I think the way this "should" be done is for FloatCanvas to be a bit 
more oriented toward some sort of "document" structure -- that is, have 
a document (or drawing) class that holds all the draw objects ans stuff 
-- everything you'd want to pickle, I suppose and have the FloatCanvas 
work with that class, rather than storing the bits in different attributes.

This may not be that big a re-factor, actually, at the moment, all I can 
think of that it would need to contain is the ForeDrawList and 
DrawListDrawList. Which means you might get away with pickling just 
those two (or just one, if you're not using the foreground). Restoring 
the Canvas would require a little work, but it would probably be as easy 
as looping through your un-pickled list and adding all the objects back 
in (except event binding -- that would get lost -- hmmm, more 
refactoring in order).

So, the short version is:

  * Try pickling at see what happens, you may get lucky!

  * It's going to take some re-factoring to really so this right, but 
depending on your needs, you can probably cobble something together 
yourself that covers just what you need.


Others have had the need to save stuff, but I think we've all used some 
sort of document model that isn't integrated with the FloatCanvas, and 
used that to populate the FloatCanvas. See the BNAEditor for a pretty 
simple example. Also the stuff Sam just posted, under: Using OGR with 
Floatcanvas.

-Chris




-- 
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[EMAIL PROTECTED]
_______________________________________________
FloatCanvas mailing list
[email protected]
http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to