Hello Chris (and List Members) Thank you, Chris, for taking the time to look at the project and reply, and for pointing me in the direction of this list. Sorry it has taken me so long to reply - last week was very hectic. I am accessing the list using gmane - hope it works! Replies are in-line.
Christopher Barker wrote: > > Andy, > >> In the documentation for FloatCanvas, you say "please let me know if >> you are using this." So I am attaching a zip file of TessMaker > > Very cool! thanks. Any chance you could put it up on the Wiki: > > http://morticia.cs.dal.ca/FloatCanvas/ > > You can put it in the "FloatCanvas Showcase" section. I'd love others to be able to see it. Thanks! I'll do so once I have resolved the HitTest issue mentioned below. >> I did need to make one slight mod to FC, because I found that >> even if I set FC.UseHitTest to False in my code, the hit test >> was still being used. So in the method "HitTest", I changed the line: >> if self.HitDict: >> to >> if self.HitDict and self.UseHitTest: >> (it is line 2326 in my version of FloatCanvas.py) >> After that it behaved exactly as I expected. >> I'm not sure whether this is a bug, because I'm not sure whether what >> I expected was what you intended. > > Well, no, that's not what I had in mind -- UseHitTest is there so that > the Canvas knows whether it needs to maintain the hittest buffer or > not. I think you could get in trouble setting it to False, then > re-sizing the canvas, then setting it to True again and expecting > hit-testing to work. Ah. Yes - I've tried it and you are correct. So UseHitTest is strictly for internal use by FloatCanvas. Well, I've got away with that so far in classroom use because there is no reason to ever re-size the canvas. > > What you are doing should be accomplished with GUIModes -- you set the > Canvas to a new GUIMode that does or doesn't do the hit testing (ir > anything else you want with the mouse events). I'm kind of in the > middle of re-factoring some examples to use GUImodes in a better way. > You might want to check out the SVN version. Thank you for the tip. I'm starting to look at the event handling process to see where the GUIMode fits in, but I haven't done anything with it yet. Is the idea that I would: -- import GUIMode -- sub-class GUIMode.GUIMouse in my own code, -- set FC.GuiMode to my new mode, and -- handle the switching on and off of hit-testing in my new GUIMode? It seems rather heavy-duty for what I need, which is a simple switch to control whether hit-testing is used or not. What I have tried (which seems to be working fine), is overriding the HitTest method of FloatCanvas in my TileCanvas class, with a method which is identical except for the line: if self.HitDict and TD.Tool == "select": (using my own variable as the switch this time!) I don't know why I didn't do this in the first place instead of thinking I had to change FloatCanvas itself. I suppose I've not really got used to the power of inheritance yet. Is there any problem with this solution? > >> If you do look at the code, I should be grateful for any comments on how >> I am using FloatCanvas, as this is my first Python program more than >> about 20 lines long. > > Nothing obvious at a quick glance. There are some layout issues on OS-X, but I haven't had a chance to poke into them yet. I don't have a Mac to test on, but a friend ran it on his Mac last week and showed me that the left hand toolbar was re-sizing strangely. Doesn't happen on Windows or Gnome (Ubuntu or Fedora). > >> Sorry this is such a long email! > > Not at all. Nice stuff! > > Please join our mailing list: > > http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas > > Also, there is a chance that we'll get a Google Summer of Code project funded to do a FloatCanvas re-factor -- so stay tuned! Just seen the message about this - sounds great. In particular moving to GraphicsContext would mean (for me) that I wouldn't have to convert ellipses to many-sided polygons before I could rotate them as (I think) GC will rotate them natively. Thanks again Andy _______________________________________________ FloatCanvas mailing list [email protected] http://mail.mithis.com/cgi-bin/mailman/listinfo/floatcanvas
