Closed amolenaar closed 3 years ago
I have to do some extra checks to ensure the Item protocol is the only methods used throughout Gaphas (and gaphor). Maybe some features should be moved to generic functions (?). Generic functions can provide an extra layer of decoupling.
There's one exception: segment.py
. It relies on Lines and the ability to split/merge line segments. For this the Line
class provides extra methods. Loading and using segment.py
is optional, though.
Item
is a protocol now. It contains a few methods and properties.
Is your feature request related to a problem? Please describe.
Currently all canvas items should inherit from Item. The hierarchy is exclusively maintained in the Canvas class. This is not ideal, since this requires double bookkeeping in case the application has its own data model and it makes Canvas a central component, used by all items.
Describe the solution you'd like
Allow Gaphas to visualize any tree hierarchy. E.g. for Gaphor, we have an
owner
field that defines the relation between an element and its owner. This should also be usable to display items.Additional context
It looks like the interface between GtkView and Canvas is actually quite thin:
get_all_items()
andsort()
. Painters and Tools also useget_matrix_i2c()
andget_connection()
.get_matrix_i2c()
could be replaced by aProjection
.How to deal with constaint solving, once the canvas hierarchy has been extracted? Do we still need a Canvas class?