def OnEndDragLeft(self, x, y, keys=0, attachment=0): shape = self.GetShape() oldpos = getpos(shape) ogl.ShapeEvtHandler.OnEndDragLeft(self, x, y, keys, attachment) # super if not shape.Selected(): self.OnLeftClick(x, y, keys, attachment) newpos = getpos(shape) try: #print shape.node.id, "moved from", oldpos, "to", newpos # Adjust the GraphNode to match the shape x,y shape.node.left, shape.node.top = newpos except: print "no node model attached to this shape!" self.UpdateStatusBar(shape) shape.GetCanvas().canvas_resizer.resize_virtual_canvas_tofit_bounds( bounds_dirty=True) # Invoke overlap removal (unless hold down shift key) KEY_SHIFT = 1 if keys & KEY_SHIFT: #shape.GetCanvas().stateofthenation() # do we need this? did quite well without it before pass else: canvas = shape.GetCanvas() if canvas.remove_overlaps(): canvas.stateofthenation()
def OnEndDragLeft(self, x, y, keys = 0, attachment = 0): shape = self.GetShape() oldpos = getpos(shape) ogl.ShapeEvtHandler.OnEndDragLeft(self, x, y, keys, attachment) # super if not shape.Selected(): self.OnLeftClick(x, y, keys, attachment) newpos = getpos(shape) try: #print shape.node.id, "moved from", oldpos, "to", newpos # Adjust the GraphNode to match the shape x,y shape.node.left, shape.node.top = newpos except: print "no node model attached to this shape!" self.UpdateStatusBar(shape) shape.GetCanvas().canvas_resizer.resize_virtual_canvas_tofit_bounds(bounds_dirty=True) # Invoke overlap removal (unless hold down shift key) KEY_SHIFT = 1 if keys & KEY_SHIFT: #shape.GetCanvas().stateofthenation() # do we need this? did quite well without it before pass else: canvas = shape.GetCanvas() if canvas.remove_overlaps(): canvas.stateofthenation()
def UpdateStatusBar(self, shape): x, y = shape.GetX(), shape.GetY() x, y = getpos(shape) width, height = shape.GetBoundingBoxMax() msg = "" node = getattr(shape, "node", None) if node: colour_index = getattr(node, "colour_index", None) if colour_index <> None: msg += "colour_index %d" % colour_index self.frame.SetStatusText("Pos: (%d,%d) Size: (%d, %d) %s" % (x, y, width, height, msg))
def OnSizingEndDragLeft(self, pt, x, y, keys, attch): shape = self.GetShape() # super ogl.ShapeEvtHandler.OnSizingEndDragLeft(self, pt, x, y, keys, attch) width, height = shape.GetBoundingBoxMin() if hasattr(shape, 'node'): #print shape.node, "resized to", width, height #print shape.node.id, shape.node.left, shape.node.top, "resized to", width, height # Adjust the GraphNode to match the shape x,y shape.node.width, shape.node.height = width, height shape.node.left, shape.node.top = getpos(shape) self.UpdateStatusBar(self.GetShape()) canvas = shape.GetCanvas() if canvas.remove_overlaps(): canvas.stateofthenation()