Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@Shapes.bind_key('Control-V')
def paste(layer):
"""Paste any copied shapes."""
if layer._mode in (Mode.DIRECT, Mode.SELECT):
layer._paste_data()
@Shapes.bind_key('X')
def activate_vertex_remove_mode(layer):
"""Activate vertex deletion tool."""
layer.mode = Mode.VERTEX_REMOVE
@Shapes.bind_key('Escape')
def finish_drawing(layer):
"""Finish any drawing, for example when using the path or polygon tool."""
layer._finish_drawing()
@Shapes.bind_key('I')
def activate_vertex_insert_mode(layer):
"""Activate vertex insertion tool."""
layer.mode = Mode.VERTEX_INSERT
@Shapes.bind_key('E')
def activate_add_ellipse_mode(layer):
"""Activate add ellipse tool."""
layer.mode = Mode.ADD_ELLIPSE
@Shapes.bind_key('Z')
def activate_pan_zoom_mode(layer):
"""Activate pan and zoom mode."""
layer.mode = Mode.PAN_ZOOM
@Shapes.bind_key('Backspace')
def delete_selected(layer):
"""Delete any selected shapes."""
layer.remove_selected()
@Shapes.bind_key('S')
def activate_select_mode(layer):
"""Activate shape selection tool."""
layer.mode = Mode.SELECT
@Shapes.bind_key('P')
def activate_add_polygon_mode(layer):
"""Activate add polygon tool."""
layer.mode = Mode.ADD_POLYGON