示例#1
0
    dest="attrs",
    action="store_true",
    help="Print class attributes",
)

(options, args) = parser.parse_args()

if len(args) != 1:
    parser.print_help()
    sys.exit(1)

# The model file to load.
model = args[0]

# Create the Gaphor application object.
Application.init()

# Get services we need.
element_factory = Application.get_service("element_factory")
file_manager = Application.get_service("file_manager")

# Load model from file.
file_manager.load(model)

# Find all classes using factory select.
for cls in element_factory.select(lambda e: e.isKindOf(UML.Class)):

    print("Found class %s" % cls.name)

    if options.attrs:
示例#2
0
def application():
    Application.init(
        services=["event_manager", "component_registry", "element_factory"])
    yield Application
    Application.shutdown()
示例#3
0
def application(services=["element_factory"]):
    Application.init(services=services)
    yield Application
    Application.shutdown()
示例#4
0
    dest="attrs",
    action="store_true",
    help="Print class attributes",
)

(options, args) = parser.parse_args()

if len(args) != 1:
    parser.print_help()
    sys.exit(1)

# The model file to load.
model = args[0]

# Create the Gaphor application object.
Application.init()

# Get services we need.
element_factory = Application.get_service("element_factory")
file_manager = Application.get_service("file_manager")

# Load model from file.
file_manager.load(model)

# Find all classes using factory select.
for cls in element_factory.select(lambda e: e.isKindOf(UML.Class)):

    print(f"Found class {cls.name}")

    if options.attrs:
示例#5
0
def application(services=["element_factory"]):
    Application.init(services=services)
    yield Application
    Application.shutdown()