+ def OnRightClick(self, event):
+ """ force selection underneath right click position. """
+ self.Activate()
+ self._canvas.SetFocus()
+
+ dc = wx.ClientDC(self._canvas)
+ self._canvas.PrepareDC(dc)
+ x, y = event.GetLogicalPosition(dc) # this takes into account scrollbar offset
+ self.SetLastRightClick(x, y)
+ shape = self._canvas.FindShape(x, y)[0]
+
+ model = None
+ if not shape:
+ self.SetSelection(None)
+ self.SetPropertyShape(None)
+ elif hasattr(shape, "GetModel"):
+ self.BringToFront(shape)
+ self.SetPropertyShape(shape)
+ self.SetSelection(shape)
+ shape.Select(True, dc)
+ model = shape.GetModel()
+ elif shape.GetParent() and isinstance(shape.GetParent(), ogl.CompositeShape): # ComplexTypeHeader for ComplexTypeShape
+ self.BringToFront(shape)
+ self.SetPropertyShape(shape.GetParent())
+ self.SetSelection(shape.GetParent())
+ shape.GetParent().Select(True, dc)
+ model = shape.GetParent().GetModel()
+
+ self.SetPropertyModel(model)
+
+ return (shape, model)
+
+