How to use the gaphas.state.observed function in gaphas

To help you get started, we’ve selected a few gaphas 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 DLR-RM / RAFCON / source / rafcon / gui / mygaphas / items / ports.py View on Github external
    @side.setter
    @observed
    def side(self, side):
        self._side = side
        self.direction = None
        if self.side is SnappedSide.LEFT:
            self.direction = Direction.RIGHT if self._is_in_port else Direction.LEFT
        elif self.side is SnappedSide.TOP:
            self.direction = Direction.DOWN if self._is_in_port else Direction.UP
        elif self.side is SnappedSide.RIGHT:
            self.direction = Direction.LEFT if self._is_in_port else Direction.RIGHT
        elif self.side is SnappedSide.BOTTOM:
            self.direction = Direction.UP if self._is_in_port else Direction.DOWN
github gaphor / gaphor / gaphor / diagram / classes / klass.py View on Github external
    @observed
    def _set_show_operations(self, value):
        """Sets the show operations property.  This will either show or hide
        the operations compartment of the ClassItem.  This is part of the
        show_operations property."""
        
        self._operations.visible = value
        self._operations.use_extra_space = value
        self._attributes.use_extra_space = not self._operations.visible
github gaphor / gaphor / gaphor / diagram / actions / activitynodes.py View on Github external
    @observed
    def _set_combined(self, value):
        # self.preserve_property('combined')
        self._combined = value
github DLR-RM / RAFCON / source / rafcon / gui / mygaphas / items / ports.py View on Github external
    @observed
    def side(self, side):
        self._side = side
        self.direction = None
        if self.side is SnappedSide.LEFT:
            self.direction = Direction.RIGHT if self._is_in_port else Direction.LEFT
        elif self.side is SnappedSide.TOP:
            self.direction = Direction.DOWN if self._is_in_port else Direction.UP
        elif self.side is SnappedSide.RIGHT:
            self.direction = Direction.LEFT if self._is_in_port else Direction.RIGHT
        elif self.side is SnappedSide.BOTTOM:
            self.direction = Direction.UP if self._is_in_port else Direction.DOWN
github gaphor / gaphor / gaphor / diagram / classes / klass.py View on Github external
    @observed
    def _set_show_attributes(self, value):
        """Sets the show attributes property.  This will either show or hide
        the attributes compartment of the ClassItem.  This is part of the
        show_attributes property."""
        
        self._attributes.visible = value
github gaphor / gaphor / gaphor / diagram / actions / objectnode.py View on Github external
    @observed
    def _set_show_ordering(self, value):
        self._show_ordering = value
        self.request_update()
github gaphor / gaphor / gaphor / diagram / classes / interface.py View on Github external
    @observed
    def set_drawing_style(self, style):
        """
        In addition to setting the drawing style, the handles are
        make non-movable if the icon (folded) style is used.
        """
        super(InterfaceItem, self).set_drawing_style(style)
        if self._drawing_style == self.DRAW_ICON:
            self.folded = self.FOLDED_PROVIDED # set default folded mode
        else:
            self.folded = self.FOLDED_NONE # unset default folded mode
github gaphor / gaphor / gaphor / diagram / compartment.py View on Github external
    @observed
    def set_drawing_style(self, style):
        """
        Set the drawing style for this classifier: DRAW_COMPARTMENT,
        DRAW_COMPARTMENT_ICON or DRAW_ICON.
        """
        if style != self._drawing_style:
            self._drawing_style = style
            self.request_update()

        if self._drawing_style == self.DRAW_COMPARTMENT:
            self.draw = self.draw_compartment
            self.pre_update = self.pre_update_compartment
            self.post_update = self.post_update_compartment

        elif self._drawing_style == self.DRAW_COMPARTMENT_ICON:
            self.draw = self.draw_compartment_icon
github gaphor / gaphor / gaphor / diagram / diagramitem.py View on Github external
    @observed
    def _set_show_stereotypes_attrs(self, value):
        self._show_stereotypes_attrs = value
        self.update_stereotypes_attrs()