Tools

Tools are used to interact with the view.

Each tool is basically a function that produces a Gtk.EventController. The event controllers are already configured.

gaphas.tool.hover_tool(view: gaphas.view.gtkview.GtkView)gi.repository.Gtk.EventController[source]

Highlight the currenly hovered item.

gaphas.tool.item_tool(view: gaphas.view.gtkview.GtkView)gi.repository.Gtk.GestureDrag[source]

Handle item movement and movement of handles.

gaphas.tool.placement_tool(view: gaphas.view.gtkview.GtkView, factory: Callable[], gaphas.item.Item], handle_index: int)gi.repository.Gtk.GestureDrag[source]

Place a new item on the model.

gaphas.tool.rubberband_tool(view, rubberband_state)[source]

Rubberband selection tool.

Should be used in conjunction with RubberbandPainter.

gaphas.tool.scroll_tool(view: gaphas.view.gtkview.GtkView, speed: int = 5)gi.repository.Gtk.EventControllerScroll[source]

Scroll tool recognized 2 finger scroll gestures.

gaphas.tool.zoom_tool(view: gaphas.view.gtkview.GtkView)gi.repository.Gtk.GestureZoom[source]

Create a zoom tool as a Gtk.Gesture.

Note: we need to keep a reference to this gesture, or else it will be destroyed.