How to use the gaphor.diagram.diagramtoolbox.ToolDef function in gaphor

To help you get started, we’ve selected a few gaphor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
item_factory=PlacementTool.new_item_factory(
                    diagram.actions.FlowFinalNodeItem, UML.FlowFinalNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-decision-node",
                gettext("Decision/merge node"),
                "gaphor-decision-node-symbolic",
                "g",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.DecisionNodeItem, UML.DecisionNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-fork-node",
                gettext("Fork/join node"),
                "gaphor-fork-node-symbolic",
                "R",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ForkNodeItem, UML.JoinNode
                ),
                handle_index=1,
            ),
            ToolDef(
                "toolbox-object-node",
                gettext("Object node"),
                "gaphor-object-node-symbolic",
                "O",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ObjectNodeItem,
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
def initial_pseudostate_config(new_item):
    new_item.subject.kind = "initial"


def history_pseudostate_config(new_item):
    new_item.subject.kind = "shallowHistory"


def metaclass_config(new_item):
    namespace_config(new_item)
    new_item.subject.name = "Class"


# Actions: ((section (name, label, icon_name, shortcut)), ...)
TOOLBOX_ACTIONS: Sequence[Tuple[str, Sequence[ToolDef]]] = (
    (
        gettext("General"),
        (
            ToolDef(
                "toolbox-pointer",
                gettext("Pointer"),
                "gaphor-pointer-symbolic",
                "Escape",
                item_factory=None,
            ),
            ToolDef(
                "toolbox-line",
                gettext("Line"),
                "gaphor-line-symbolic",
                "l",
                PlacementTool.new_item_factory(diagram.general.Line),
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ActivityFinalNodeItem, UML.ActivityFinalNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-flow-final-node",
                gettext("Flow final node"),
                "gaphor-flow-final-node-symbolic",
                "w",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.FlowFinalNodeItem, UML.FlowFinalNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-decision-node",
                gettext("Decision/merge node"),
                "gaphor-decision-node-symbolic",
                "g",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.DecisionNodeItem, UML.DecisionNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-fork-node",
                gettext("Fork/join node"),
                "gaphor-fork-node-symbolic",
                "R",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ForkNodeItem, UML.JoinNode
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
UML.Profile,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-metaclass",
                gettext("Metaclass"),
                "gaphor-metaclass-symbolic",
                "m",
                item_factory=PlacementTool.new_item_factory(
                    diagram.classes.ClassItem, UML.Class, config_func=metaclass_config
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-stereotype",
                gettext("Stereotype"),
                "gaphor-stereotype-symbolic",
                "z",
                item_factory=PlacementTool.new_item_factory(
                    diagram.classes.ClassItem,
                    UML.Stereotype,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-extension",
                gettext("Extension"),
                "gaphor-extension-symbolic",
                "E",
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
UML.UseCase,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-actor",
                gettext("Actor"),
                "gaphor-actor-symbolic",
                "t",
                item_factory=PlacementTool.new_item_factory(
                    diagram.usecases.ActorItem, UML.Actor, config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-use-case-association",
                gettext("Association"),
                "gaphor-association-symbolic",
                "B",
                item_factory=PlacementTool.new_item_factory(
                    diagram.classes.AssociationItem
                ),
            ),
            ToolDef(
                "toolbox-include",
                gettext("Include"),
                "gaphor-include-symbolic",
                "U",
                item_factory=PlacementTool.new_item_factory(
                    diagram.usecases.IncludeItem
                ),
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
item_factory=PlacementTool.new_item_factory(
                    diagram.actions.DecisionNodeItem, UML.DecisionNode
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-fork-node",
                gettext("Fork/join node"),
                "gaphor-fork-node-symbolic",
                "R",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ForkNodeItem, UML.JoinNode
                ),
                handle_index=1,
            ),
            ToolDef(
                "toolbox-object-node",
                gettext("Object node"),
                "gaphor-object-node-symbolic",
                "O",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.ObjectNodeItem,
                    UML.ObjectNode,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-partition",
                gettext("Partition"),
                "gaphor-partition-symbolic",
                "P",
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
UML.Artifact,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-node",
                gettext("Node"),
                "gaphor-node-symbolic",
                "n",
                PlacementTool.new_item_factory(
                    diagram.components.NodeItem, UML.Node, config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-device",
                gettext("Device"),
                "gaphor-device-symbolic",
                "d",
                PlacementTool.new_item_factory(
                    diagram.components.NodeItem,
                    UML.Device,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-connector",
                gettext("Connector"),
                "gaphor-connector-symbolic",
                "C",
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-package",
                gettext("Package"),
                "gaphor-package-symbolic",
                "p",
                PlacementTool.new_item_factory(
                    diagram.classes.PackageItem,
                    UML.Package,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-association",
                gettext("Association"),
                "gaphor-association-symbolic",
                "A",
                PlacementTool.new_item_factory(diagram.classes.AssociationItem),
            ),
            ToolDef(
                "toolbox-dependency",
                gettext("Dependency"),
                "gaphor-dependency-symbolic",
                "D",
                PlacementTool.new_item_factory(diagram.classes.DependencyItem),
            ),
            ToolDef(
                "toolbox-generalization",
                gettext("Generalization"),
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
UML.ObjectNode,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-partition",
                gettext("Partition"),
                "gaphor-partition-symbolic",
                "P",
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.PartitionItem
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-flow",
                gettext("Control/object flow"),
                "gaphor-control-flow-symbolic",
                "F",
                item_factory=PlacementTool.new_item_factory(diagram.actions.FlowItem),
            ),
            ToolDef(
                "toolbox-send-signal-action",
                gettext("Send signal action"),
                "gaphor-send-signal-action-symbolic",
                None,
                item_factory=PlacementTool.new_item_factory(
                    diagram.actions.SendSignalActionItem,
                    UML.SendSignalAction,
                    config_func=namespace_config,
                ),
github gaphor / gaphor / gaphor / diagram / diagramtoolbox.py View on Github external
(
        gettext("Interactions"),
        (
            ToolDef(
                "toolbox-lifeline",
                gettext("Lifeline"),
                "gaphor-lifeline-symbolic",
                "v",
                item_factory=PlacementTool.new_item_factory(
                    diagram.interactions.LifelineItem,
                    UML.Lifeline,
                    config_func=namespace_config,
                ),
                handle_index=SE,
            ),
            ToolDef(
                "toolbox-message",
                gettext("Message"),
                "gaphor-message-symbolic",
                "M",
                item_factory=PlacementTool.new_item_factory(
                    diagram.interactions.MessageItem
                ),
            ),
            ToolDef(
                "toolbox-interaction",
                gettext("Interaction"),
                "gaphor-interaction-symbolic",
                "N",
                item_factory=PlacementTool.new_item_factory(
                    diagram.interactions.InteractionItem,
                    UML.Interaction,