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.
- add_controller(*controllers: gi.repository.Gtk.EventController) None [source]
Add a controller.
A convenience method, so you have a place to store the event controllers. Events controllers are linked to a widget (in GTK3) on creation time, so calling this method is not necessary.
- remove_controller(controller: gi.repository.Gtk.EventController) bool [source]
Remove a controller.
The event controller’s propagation phase is set to Gtk.PropagationPhase.NONE to ensure it’s not invoked anymore.
- NB. The controller is only really removed from the widget when it’s destroyed!
This is a Gtk3 limitation.
- 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.
- request_update(items: Iterable[Item], removed_items: Iterable[Item] = ()) None [source]
Request update for items.
- all_dirty_items() set[gaphas.item.Item] [source]
Return all dirty items, clearing the marked items.