View¶
View is the central class in Gaphas. It shows your diagram and allows you to interact with it.
- class gaphas.view.GtkView(*args: Any, **kwargs: Any)[source]¶
GTK widget for rendering a gaphas.model.Model to a screen. The view uses Tools to handle events and Painters to draw. Both are configurable.
The widget already contains adjustment objects (hadjustment, vadjustment) to be used for scrollbars.
This view registers itself on the model, so it will receive update events.
- property bounding_box_painter: ItemPainterType¶
Special painter for calculating item bounding boxes.
- property selection: Selection¶
Selected, focused and hovered items.
- property hadjustment: gi.repository.Gtk.Adjustment¶
Gtk adjustment object for use with a scrollbar.
- property vadjustment: gi.repository.Gtk.Adjustment¶
Gtk adjustment object for use with a scrollbar.
- remove_controller(controller: gi.repository.Gtk.EventController) bool [source]¶
Remove a controller.
- get_items_in_rectangle(rect: tuple[float, float, float, float], contain: bool = False) Iterable[Item] [source]¶
Return the items in the rectangle ‘rect’ (in view coordinates).
Items are automatically sorted in model’s processing order.
- get_item_bounding_box(item: Item) Rectangle [source]¶
Get the bounding box for the item, in view coordinates.