Werner F. Bruhin wrote:
So, I am trying to get the "Edit" mode to work in EditingModes, i.e. to at least allow moving of a circle.

It more or less works.
- run the attached (your latest code with some hacks (some pretty ugly) of mine)
- click "edit" button
- click "zoom to fit"
- click the "x" in the circle
- click and move the "move handle"

Questions:
- Why do I have to click "zoom to fit" to have the "move handle" showing

I thought changing the mode should force a Draw, but I guess not. I added:

        self.Canvas.Draw(Force=True)

at the end of SetEditMode(). does that gix it for you? for me, it still doesn't show it until I click -- which I think is an OS-X thing.

- I changed the code to use the SetEditMode and BindAll methods you had in there but which where not called. Is this approach o.k. or should I go down another road?

I think the Binding should happen when you call Canvas.SetMode, but I don't have the time to figure that out now. However, I think the idea there was that that would set it up so that you could click on any object to put that object in edit mode -- you shouldn't need it if you are using the button to put it in edit mode.

- In the original code a "Center" variable was used, but was not always available - I hacked it but I can't figure out a reliable way of calculating the center of a selected object.

I'm not sure there is a way for any object. Any of the objects that derive from XYObject should have a XY attribute, which you've used.

"known" issues:
- The size of the "moving" circle is not correct - not sure why.


changing: self.Radius = Circle.WH[0] / 2
to:       self.Radius = Circle.WH[0]

fixed that.

- The moving handle and "x" are not reset - there is no code for it yet.

The moving handle resets for me -- though the circle was getting moved twice as far as it should. I removed the call to:

            #self.CenterHandle.Move(dxyw)

I think the CenterHandle and Circle share the same XY object.

I also just made the "cross" object an attribute of the Circle, so it can be moved in the LeftUp handler also. However, the cross and Circle really should be a group object or custom object or something.

I've enclosed a version with these changes. I hope this helps, I"m sorry I don't have more time to work on this right now.

-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]

Attachment: EditingModes2.py
Description: application/python

_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to