Hey everyone, 

The patch I have come up with is at the end of the email. This seems to
work pretty well. I'm open to suggestions on how to improve it. 

I was going to use the name "zOrder" but it didn't seem to fit with the
rest of the FloatCanvas naming. As well, objects could all have the same
draw order.

Tim 'Mithro' Ansell

diff --git a/extra/wxFloatCanvas/FloatCanvas.py
b/extra/wxFloatCanvas/FloatCanvas.py
index 8dcb4a2..dc7dc51 100644
--- a/extra/wxFloatCanvas/FloatCanvas.py
+++ b/extra/wxFloatCanvas/FloatCanvas.py
@@ -150,6 +150,7 @@ class DrawObject:
              \param IsVisible (Bool)
         """
         self.InForeground = InForeground
+        self.DrawOrder = 0
 
         self._Canvas = None
 
@@ -2895,6 +2896,15 @@ class FloatCanvas(wx.Panel):
         else:
             self._DrawList.append(obj)
             self._BackgroundDirty = True
+
+        def DrawOrder(a, b):
+            try:
+                return cmp(a.DrawOrder, b.DrawOrder)
+            except AttributeError:
+                return 1
+
+        self._DrawList.sort(DrawOrder)
+
         self.BoundingBoxDirty = True
         return True

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

Reply via email to