
import gaphor.SysML.propertypages  # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems
from gaphor.RAAML import fta as raaml
from gaphor.RAAML.toolbox import raaml_toolbox_actions


class RAAMLModelingLanguage(ModelingLanguage):
    @property
    def name(self) -> str:
        return gettext("RAAML")

    @property
    def toolbox_definition(self) -> ToolboxDefinition:
        return raaml_toolbox_actions

    def lookup_element(self, name):
        element_type = getattr(raaml, name, None)
        if not element_type:
            element_type = getattr(diagramitems, name, None)
        return element_type


import gaphor.SysML.propertypages  # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems, raaml
from gaphor.RAAML.toolbox import raaml_toolbox_actions


class RAAMLModelingLanguage(ModelingLanguage):
    @property
    def name(self) -> str:
        return gettext("RAAML")

    @property
    def toolbox_definition(self) -> ToolboxDefinition:
        return raaml_toolbox_actions

    def lookup_element(self, name):
        element_type = getattr(raaml, name, None)
        if not element_type:
            element_type = getattr(diagramitems, name, None)
        return element_type

Fix STPA modeling elements can't be loaded from saved model
Fix STPA modeling elements can't be loaded from saved model

Signed-off-by: Dan Yeaw <2591e5f46f28d303f9dc027d475a5c60d8dea17a@yeaw.me>

  
  import gaphor.SysML.propertypages  # noqa
  from gaphor.abc import ModelingLanguage
  from gaphor.core import gettext
  from gaphor.diagram.diagramtoolbox import ToolboxDefinition
- from gaphor.RAAML import diagramitems
+ from gaphor.RAAML import diagramitems, raaml
- from gaphor.RAAML import fta as raaml
  from gaphor.RAAML.toolbox import raaml_toolbox_actions
  
  
  class RAAMLModelingLanguage(ModelingLanguage):
      @property
      def name(self) -> str:
          return gettext("RAAML")
  
      @property
      def toolbox_definition(self) -> ToolboxDefinition:
          return raaml_toolbox_actions
  
      def lookup_element(self, name):
          element_type = getattr(raaml, name, None)
          if not element_type:
              element_type = getattr(diagramitems, name, None)
          return element_type
  
Fix STPA modeling elements can't be loaded from saved model
## Code Before:

import gaphor.SysML.propertypages  # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems
from gaphor.RAAML import fta as raaml
from gaphor.RAAML.toolbox import raaml_toolbox_actions


class RAAMLModelingLanguage(ModelingLanguage):
    @property
    def name(self) -> str:
        return gettext("RAAML")

    @property
    def toolbox_definition(self) -> ToolboxDefinition:
        return raaml_toolbox_actions

    def lookup_element(self, name):
        element_type = getattr(raaml, name, None)
        if not element_type:
            element_type = getattr(diagramitems, name, None)
        return element_type

## Instruction:
Fix STPA modeling elements can't be loaded from saved model
## Code After:

import gaphor.SysML.propertypages  # noqa
from gaphor.abc import ModelingLanguage
from gaphor.core import gettext
from gaphor.diagram.diagramtoolbox import ToolboxDefinition
from gaphor.RAAML import diagramitems, raaml
from gaphor.RAAML.toolbox import raaml_toolbox_actions


class RAAMLModelingLanguage(ModelingLanguage):
    @property
    def name(self) -> str:
        return gettext("RAAML")

    @property
    def toolbox_definition(self) -> ToolboxDefinition:
        return raaml_toolbox_actions

    def lookup_element(self, name):
        element_type = getattr(raaml, name, None)
        if not element_type:
            element_type = getattr(diagramitems, name, None)
        return element_type
