Skip to content

Missing dependency injection in TreeDiagram for the layout logic #131

Description

@kharybdys

Since TreeDiagram instantiates its own TreeGroups in the implementation of auto_layout, there is no option for me to provide a variation of TreeGroup in order to tweak the choices made in the layout algorithm. Eg I'd like to center the parent not above the whole level width but above the width taken by its children. From what I can see in the code that means I need to change the group's implementation of center_parent.

Probably the solution is to (optionally) provide an instantiation function for (subclasses of) TreeGroup in the init of TreeDiagram. If not specified it will be TreeGroup. I'm saying instantiation function and not class because I can imagine wanting to provide a partial function if you choose to add more attributes to the subclass.

Open to making the PR, but not until this is discussed first as this is far more debatable as the other two things I'm asking.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions