Christian Kohlöffel wrote:
> I just tried to open up a new Thread in the Floatcanvas Mailing List but 
> I didn't succeded. So I'm contacting you in this way.

Odd - have you joined the list? you need to be a list member to post.

> I have one problem with the hiting of an element 
> combined with the Rubberband Class. If i just click on a line without 
> moving of the mouse or anything the rubberband comes on and is actively 
> drawn until i push the mouse button again.

> The current version with the problem is on the SVN Server so you can 
> have a look on the problem there. Just Click a line and see what happens.
> http://www.vegasoft.de/shares/svn/dxf2gcode/trunk/source/
>  
> My test DXF files are located here (for creating a plot):
> http://www.vegasoft.de/shares/svn/dxf2gcode/trunk/dxf/
>  
> Important lines in dxf2gcode_wx28.py (Main function to start the programm).
> 737 (Rubberband)
> 1377 (creating the hit function of the shapes)
> 1382 (Callback when a shape got hit)
>  
> I hope you have an idea to solve the problem.

I'm not sure -- it's a lot of code to look at.

However, you may need to clear the screen in NewRect:

     def NewRect(self, rect):
         print rect
         #self.Rects.append(self.Canvas.AddRectangle(*rect))
         #self.Canvas.Draw(True)
         self.Canvas.Refresh()
         self.Canvas.Update()

that will force the buffer to get blitted to the screen removing the 
Rubber Band rectangle (maybe that should have happened in 
RubberBandBox.OnLeftUp()

However, with that, I still see some odd issues.

Note that I wrote the RubberBandBox class when I wrote the DrawRect demo 
-- the idea was that I"d use it eveywehre I needed a rubber band box, 
but it hasn't seen much testing.

It's possible that's what's going on here is that the mouse even binding 
and unbinding is getting confused.

A possibility -- if LeftUp is caught in your code, and you don't call 
event.Skip(), then RubberBAndBox may never get it, so it will keep 
"Drawing" set to True, and keep drawing the box as you move.

This may be happenign with the FloatCanvas hit-testing code.

Another note: YOu may want to take a look at the GUIMode code. It's a 
later addition, so the demos don't show you how to use it, but the idea 
is that you define a set of GUI modes, which maps what all the mouse 
events do. then you can switch between them for different behaviour. 
That's how the standard FloatCanvas modes now work.

It's a good way to keep your code clean.

With subclassing, it's easy to define GUI modes that are very similar.

-Chris


> I also saw a problem with the import of the Utilities in wxpython. So i 
> had to change a line in Utilities. I saved the changed function also in 
> my directory to use it for my programm (
> wx_lib_floatcanvas_Utilities.py). The import of the FloatCanvas didn't 
> work because the path was incorrect if floatcanvas is a library of wx.
>  
> Changed line: from wx.lib.floatcanvas import FloatCanvas

yes, you are right -- it assumes that you have the floatcanvas package 
on your sys.path -- I wonder what the "right" way to do that relative 
import is?

-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