How to use the gaphor.diagram.items 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 / ui / objectinspector.py View on Github external
attributesColumn = gtk.TreeViewColumn('Attributes', textRenderer, text=0)
        
        attributesTreeView.append_column(attributesColumn)
        self.attach(attributesTreeView, 0, 2, 2, 3, xoptions=gtk.FILL|gtk.EXPAND, yoptions=0)
        
    def changeName(self, entry):
        self.context.subject.name = entry.get_text()
        
    def changeAbstract(self, checkButton):
        self.context.subject.isAbstract=checkButton.get_active()
        
        
component.provideAdapter(
    factory=ClassPropertyPage,
    adapts=[items.ClassItem],
    provides=IDetailsPage,
    name='Properties')

class TaggedValuePage(gtk.VBox):
    """An editor for tagged values associated with elements."""
    def __init__(self, context):
        super(TaggedValuePage, self).__init__()
        self.context = context
        
        taggedValues = gtk.ListStore(str, str)
        
        
        for taggedValue in self.context.subject.taggedValue:
            tag, value = taggedValue.value.split("=")
            taggedValues.append([tag, value])
        taggedValues.append(['',''])
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
#    tooltip = 'Create a new assembly connector item'
#    stock_id = 'gaphor-assembly-connector'
#    name = 'AssemblyConnector'
#    type = diagram.AssemblyConnectorItem
#    subject_type = UML.Connector
#
#register_action(AssemblyConnectorPlacementAction)


class ArtifactPlacementAction(NamespacePlacementAction):
    id = 'InsertArtifact'
    label = '_Artifact'
    tooltip = 'Create a new artifact item'
    stock_id = 'gaphor-artifact'
    name = 'Artifact'
    type = items.ArtifactItem
    subject_type = UML.Artifact

register_action(ArtifactPlacementAction)


class NodePlacementAction(NamespacePlacementAction):
    id = 'InsertNode'
    label = '_Node'
    tooltip = 'Create a new node item'
    stock_id = 'gaphor-node'
    name = 'Node'
    type = items.NodeItem
    subject_type = UML.Node

register_action(NodePlacementAction)
github gaphor / gaphor / gaphor / actions / itemactions.py View on Github external
def update(self):
        try:
            item = get_parent_focus_item(self._window)
        except NoFocusItemError:
            pass
        else:
            if isinstance(item, items.LifelineItem):
                self.active = item.props.has_lifetime
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
tooltip = 'Create a new package item'
    stock_id = 'gaphor-package'
    name = 'Package'
    type = items.PackageItem
    subject_type = UML.Package

register_action(PackagePlacementAction)


class InitialNodePlacementAction(PlacementAction):
    id = 'InsertInitialNode'
    label = 'Initial Node'
    tooltip = 'Create a new initial node'
    stock_id = 'gaphor-initial-node'
    name = 'InitialNode'
    type = items.InitialNodeItem
    subject_type = UML.InitialNode

register_action(InitialNodePlacementAction)


class ActivityFinalNodePlacementAction(PlacementAction):
    id = 'InsertActivityFinalNode'
    label = 'Activity Final Node'
    tooltip = 'Create a new activity final node'
    stock_id = 'gaphor-activity-final-node'
    name = 'ActivityFinalNode'
    type = items.ActivityFinalNodeItem
    subject_type = UML.ActivityFinalNode

register_action(ActivityFinalNodePlacementAction)
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
tooltip = 'Create a new artifact item'
    stock_id = 'gaphor-artifact'
    name = 'Artifact'
    type = items.ArtifactItem
    subject_type = UML.Artifact

register_action(ArtifactPlacementAction)


class NodePlacementAction(NamespacePlacementAction):
    id = 'InsertNode'
    label = '_Node'
    tooltip = 'Create a new node item'
    stock_id = 'gaphor-node'
    name = 'Node'
    type = items.NodeItem
    subject_type = UML.Node

register_action(NodePlacementAction)
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
stock_id = 'gaphor-fork-node'
    name = 'ForkNode'
    type = items.ForkNodeItem
#    subject_type = UML.ForkNode
    subject_type = UML.JoinNode

register_action(ForkNodePlacementAction)


class ActionPlacementAction(NamespacePlacementAction):
    id = 'InsertAction'
    label = 'Action'
    tooltip = 'Create a new action'
    stock_id = 'gaphor-action'
    name = 'Action'
    type = items.ActionItem
    subject_type = UML.Action

register_action(ActionPlacementAction)


class ObjectNodePlacementAction(NamespacePlacementAction):
    id = 'InsertObjectNode'
    label = 'Object Node'
    tooltip = 'Create a new object node'
    stock_id = 'gaphor-object-node'
    name = 'Object'
    type = items.ObjectNodeItem
    subject_type = UML.ObjectNode

register_action(ObjectNodePlacementAction)
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
tooltip = 'Create a new object node'
    stock_id = 'gaphor-object-node'
    name = 'Object'
    type = items.ObjectNodeItem
    subject_type = UML.ObjectNode

register_action(ObjectNodePlacementAction)


class CommentPlacementAction(PlacementAction):
    id = 'InsertComment'
    label = 'C_omment'
    tooltip = 'Create a new comment item'
    stock_id = 'gaphor-comment'
    name = 'Comment'
    type = items.CommentItem
    subject_type = UML.Comment

register_action(CommentPlacementAction)


class CommentLinePlacementAction(PlacementAction):
    id = 'InsertCommentLine'
    label = 'Comment _line'
    tooltip = 'Create a new comment line'
    stock_id = 'gaphor-comment-line'
    name = 'Comment line'
    type = items.CommentLineItem

register_action(CommentLinePlacementAction)
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
label = '_Generalization'
    tooltip = 'Create a new generalization'
    stock_id = 'gaphor-generalization'
    name = 'Generalization'
    type = items.GeneralizationItem

register_action(GeneralizationPlacementAction)


class ImplementationPlacementAction(PlacementAction):
    id = 'InsertImplementation'
    label = '_Implementation'
    tooltip = 'Create a new implementation'
    stock_id = 'gaphor-implementation'
    name = 'Implementation'
    type = items.ImplementationItem

register_action(ImplementationPlacementAction)


class FlowPlacementAction(PlacementAction):
    id = 'InsertFlow'
    label = 'Control/Object _Flow'
    tooltip = 'Create a new control/object flow'
    stock_id = 'gaphor-control-flow'
    name = 'Flow'
    type = items.FlowItem

register_action(FlowPlacementAction)


class ComponentPlacementAction(NamespacePlacementAction):
github gaphor / gaphor / gaphor / actions / placementactions.py View on Github external
tooltip = 'Create a new use case item'
    stock_id = 'gaphor-usecase'
    name = 'UseCase'
    type = items.UseCaseItem
    subject_type = UML.UseCase

register_action(UseCasePlacementAction)


class IncludePlacementAction(PlacementAction):
    id = 'InsertInclude'
    label = '_Include'
    tooltip = 'Create a new include'
    stock_id = 'gaphor-include'
    name = 'Include'
    type = items.IncludeItem

register_action(IncludePlacementAction)


class ExtendPlacementAction(PlacementAction):
    id = 'InsertExtend'
    label = '_Extend'
    tooltip = 'Create a new extend'
    stock_id = 'gaphor-extend'
    name = 'Extend'
    type = items.ExtendItem

register_action(ExtendPlacementAction)


class ClassPlacementAction(NamespacePlacementAction):
github gaphor / gaphor / gaphor / plugins / pynsource / engineer.py View on Github external
def _find_class_by_name(self, classname):
        try:
            superclass = self.parser.classlist[classname].gaphor_class
            superclass_item = self.parser.classlist[classname].gaphor_class_item
        except KeyError as e:
            print('No class found named', classname)
            others = self.element_factory.lselect(lambda e: isinstance(e, uml2.Class) and e.name == classname)
            if others:
                superclass = others[0]
                print('Found class in factory: %s' % superclass.name)
                superclass_item = self.diagram.create(items.ClassItem)
                superclass_item.subject = superclass
            else:
                return None, None
        return superclass, superclass_item