mi-flatland 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. mi_flatland-2.0.0/MANIFEST.in +2 -0
  2. mi_flatland-2.0.0/PKG-INFO +84 -0
  3. mi_flatland-2.0.0/README.md +56 -0
  4. mi_flatland-2.0.0/pyproject.toml +31 -0
  5. mi_flatland-2.0.0/setup.cfg +4 -0
  6. mi_flatland-2.0.0/src/flatland/__init__.py +1 -0
  7. mi_flatland-2.0.0/src/flatland/__main__.py +162 -0
  8. mi_flatland-2.0.0/src/flatland/configuration/__init__.py +0 -0
  9. mi_flatland-2.0.0/src/flatland/configuration/configDB.py +51 -0
  10. mi_flatland-2.0.0/src/flatland/configuration/connector_type.yaml +65 -0
  11. mi_flatland-2.0.0/src/flatland/configuration/diagram_type.yaml +223 -0
  12. mi_flatland-2.0.0/src/flatland/configuration/frame.yaml +102 -0
  13. mi_flatland-2.0.0/src/flatland/configuration/layout_specification.yaml +42 -0
  14. mi_flatland-2.0.0/src/flatland/configuration/metadata.yaml +20 -0
  15. mi_flatland-2.0.0/src/flatland/configuration/name_placement.yaml +83 -0
  16. mi_flatland-2.0.0/src/flatland/configuration/notation.yaml +99 -0
  17. mi_flatland-2.0.0/src/flatland/configuration/sheet.yaml +22 -0
  18. mi_flatland-2.0.0/src/flatland/configuration/titleblock.yaml +50 -0
  19. mi_flatland-2.0.0/src/flatland/connector_subsystem/__init__.py +0 -0
  20. mi_flatland-2.0.0/src/flatland/connector_subsystem/anchored_leaf_stem.py +19 -0
  21. mi_flatland-2.0.0/src/flatland/connector_subsystem/anchored_stem.py +92 -0
  22. mi_flatland-2.0.0/src/flatland/connector_subsystem/anchored_tree_stem.py +28 -0
  23. mi_flatland-2.0.0/src/flatland/connector_subsystem/bending_binary_connector.py +188 -0
  24. mi_flatland-2.0.0/src/flatland/connector_subsystem/binary_connector.py +32 -0
  25. mi_flatland-2.0.0/src/flatland/connector_subsystem/branch.py +76 -0
  26. mi_flatland-2.0.0/src/flatland/connector_subsystem/connector.py +131 -0
  27. mi_flatland-2.0.0/src/flatland/connector_subsystem/floating_binary_stem.py +60 -0
  28. mi_flatland-2.0.0/src/flatland/connector_subsystem/floating_leaf_stem.py +24 -0
  29. mi_flatland-2.0.0/src/flatland/connector_subsystem/floating_stem.py +30 -0
  30. mi_flatland-2.0.0/src/flatland/connector_subsystem/grafted_branch.py +112 -0
  31. mi_flatland-2.0.0/src/flatland/connector_subsystem/interpolated_branch.py +65 -0
  32. mi_flatland-2.0.0/src/flatland/connector_subsystem/rut_branch.py +35 -0
  33. mi_flatland-2.0.0/src/flatland/connector_subsystem/stem.py +263 -0
  34. mi_flatland-2.0.0/src/flatland/connector_subsystem/straight_binary_connector.py +183 -0
  35. mi_flatland-2.0.0/src/flatland/connector_subsystem/ternary_stem.py +71 -0
  36. mi_flatland-2.0.0/src/flatland/connector_subsystem/tree_connector.py +249 -0
  37. mi_flatland-2.0.0/src/flatland/connector_subsystem/trunk_stem.py +38 -0
  38. mi_flatland-2.0.0/src/flatland/connector_subsystem/unary_connector.py +87 -0
  39. mi_flatland-2.0.0/src/flatland/database/__init__.py +0 -0
  40. mi_flatland-2.0.0/src/flatland/database/flatland_db.py +100 -0
  41. mi_flatland-2.0.0/src/flatland/database/instances/__init__.py +0 -0
  42. mi_flatland-2.0.0/src/flatland/database/instances/connector_subsystem.py +73 -0
  43. mi_flatland-2.0.0/src/flatland/database/instances/node_subsystem.py +50 -0
  44. mi_flatland-2.0.0/src/flatland/database/instances/sheet_subsystem.py +103 -0
  45. mi_flatland-2.0.0/src/flatland/database/pop_connector_subsys.py +234 -0
  46. mi_flatland-2.0.0/src/flatland/database/pop_layout_spec.py +37 -0
  47. mi_flatland-2.0.0/src/flatland/database/pop_node_subsys.py +95 -0
  48. mi_flatland-2.0.0/src/flatland/database/pop_sheet_subsys.py +307 -0
  49. mi_flatland-2.0.0/src/flatland/database/relvars.py +455 -0
  50. mi_flatland-2.0.0/src/flatland/datatypes/__init__.py +0 -0
  51. mi_flatland-2.0.0/src/flatland/datatypes/command_interface.py +69 -0
  52. mi_flatland-2.0.0/src/flatland/datatypes/connection_types.py +138 -0
  53. mi_flatland-2.0.0/src/flatland/datatypes/general_types.py +16 -0
  54. mi_flatland-2.0.0/src/flatland/datatypes/geometry_types.py +34 -0
  55. mi_flatland-2.0.0/src/flatland/exceptions.py +309 -0
  56. mi_flatland-2.0.0/src/flatland/geometry_domain/__init__.py +0 -0
  57. mi_flatland-2.0.0/src/flatland/geometry_domain/linear_geometry.py +139 -0
  58. mi_flatland-2.0.0/src/flatland/log.conf +42 -0
  59. mi_flatland-2.0.0/src/flatland/makeframe.py +35 -0
  60. mi_flatland-2.0.0/src/flatland/names.py +3 -0
  61. mi_flatland-2.0.0/src/flatland/node_subsystem/__init__.py +0 -0
  62. mi_flatland-2.0.0/src/flatland/node_subsystem/canvas.py +193 -0
  63. mi_flatland-2.0.0/src/flatland/node_subsystem/compartment.py +118 -0
  64. mi_flatland-2.0.0/src/flatland/node_subsystem/diagram.py +81 -0
  65. mi_flatland-2.0.0/src/flatland/node_subsystem/grid.py +434 -0
  66. mi_flatland-2.0.0/src/flatland/node_subsystem/node.py +146 -0
  67. mi_flatland-2.0.0/src/flatland/node_subsystem/single_cell_node.py +71 -0
  68. mi_flatland-2.0.0/src/flatland/node_subsystem/spanning_node.py +79 -0
  69. mi_flatland-2.0.0/src/flatland/sheet_subsystem/__init__.py +0 -0
  70. mi_flatland-2.0.0/src/flatland/sheet_subsystem/frame.py +197 -0
  71. mi_flatland-2.0.0/src/flatland/sheet_subsystem/sheet.py +65 -0
  72. mi_flatland-2.0.0/src/flatland/sheet_subsystem/titleblock_placement.py +45 -0
  73. mi_flatland-2.0.0/src/flatland/text/__init__.py +0 -0
  74. mi_flatland-2.0.0/src/flatland/text/text_block.py +72 -0
  75. mi_flatland-2.0.0/src/flatland/xuml/__init__.py +0 -0
  76. mi_flatland-2.0.0/src/flatland/xuml/xuml_classdiagram.py +530 -0
  77. mi_flatland-2.0.0/src/flatland/xuml/xuml_statemachine_diagram.py +327 -0
  78. mi_flatland-2.0.0/src/mi_flatland.egg-info/PKG-INFO +84 -0
  79. mi_flatland-2.0.0/src/mi_flatland.egg-info/SOURCES.txt +83 -0
  80. mi_flatland-2.0.0/src/mi_flatland.egg-info/dependency_links.txt +1 -0
  81. mi_flatland-2.0.0/src/mi_flatland.egg-info/entry_points.txt +2 -0
  82. mi_flatland-2.0.0/src/mi_flatland.egg-info/requires.txt +18 -0
  83. mi_flatland-2.0.0/src/mi_flatland.egg-info/top_level.txt +1 -0
  84. mi_flatland-2.0.0/tests/test_elevator_cd.py +41 -0
  85. mi_flatland-2.0.0/tests/test_xUML_cd_pdf.py +67 -0
@@ -0,0 +1,2 @@
1
+ include src/flatland/log.conf
2
+ include src/flatland/configuration/*.yaml
@@ -0,0 +1,84 @@
1
+ Metadata-Version: 2.2
2
+ Name: mi-flatland
3
+ Version: 2.0.0
4
+ Summary: Model text file + layout text file -> beautiful diagram
5
+ Author-email: Leon Starr <leon_starr@modelint.com>
6
+ Project-URL: repository, https://github.com/modelint/flatland
7
+ Project-URL: documentation, https://github.com/modelint/flatland
8
+ Keywords: 2D,draw,graphics,canvas,mbse,xuml,xtuml,sysml
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: >=3.12
13
+ Description-Content-Type: text/markdown
14
+ Requires-Dist: mi-configurator
15
+ Requires-Dist: mi-pyral
16
+ Requires-Dist: mi-tabletqt
17
+ Requires-Dist: mls-parser
18
+ Requires-Dist: numpy
19
+ Requires-Dist: xcm-parser
20
+ Requires-Dist: xsm-parser
21
+ Requires-Dist: tomli; python_version < "3.12"
22
+ Provides-Extra: build
23
+ Requires-Dist: build; extra == "build"
24
+ Requires-Dist: twine; extra == "build"
25
+ Provides-Extra: dev
26
+ Requires-Dist: bump2version; extra == "dev"
27
+ Requires-Dist: pytest; extra == "dev"
28
+
29
+ # Flatland Model Diagram (non) Editor
30
+
31
+ NEW Status January 13, 2025
32
+
33
+ I have recently rebuilt the entire application based on a series of modules available on GitHub and PyPI.
34
+ Will be deploying in ernest in the coming days.
35
+
36
+ Am de-commisioning the old version on GitHub and PyPI named 'flatland-model-diagram-editor'
37
+ Now it is just 'flatland' here on GitHub and 'mi-flatland' on PyPI
38
+
39
+ Ah yes, yet another tool for generating diagrams from text. But this one is different (otherwise I wouldn't have wasted all this time building it!)
40
+
41
+ I built Flatland because the following benefits are critical for productive model development:
42
+
43
+ 1. Complete separation of the model semantics from the diagram layout
44
+ 2. Complete separation of model semantics from model notation
45
+ 3. Consistent layout of model diagrams without forcing the user to accept or hack awkard, non-sensical placements of nodes and connectors (yeah, I'm lookin at YOU PlantUML)
46
+ 4. Maximum layout power with minimal specification: No more carpal tunnel pixel pushing!
47
+ 5. Beautiful, readable diagram output in many output formats (pdf, svg, etc)
48
+ 6. Support for industrial strength modeling (many hundreds and thousands of model elements)
49
+ 7. Use your favorite text editor and all the advanced facilities of it and whatever IDE you like without having to learn yet another draw tool that makes you and your team's life difficult.
50
+ 8. And since we're here on GitHub, wouldn't it be nice if all of your models were under proper configuration management where you and your team can diff and merge to your heart's content? Wouldn't it be nice to update a diagram layout without touching the underlying model (and vice versa)?
51
+
52
+ Basically, I have wasted way too many hours of my career pushing pixels around and I just couldn't take it anymore!
53
+
54
+ Flatland is a model diagram non-editor written by me [Leon Starr](mailto:leon_starr@modelint.com) that generates
55
+ beautiful PDFs (and other output formats) based on two very
56
+ human-readable input text files. The model file specifies model semantics
57
+ (state transitions, generalizations, classes etc)
58
+ while the layout file specifies (node placement and alignment, connector anchors) and lightly refers to some elements
59
+ in the model file. You can think of the layout file as a "style sheet" for your models.
60
+ Some benefits:
61
+
62
+ Follow me on BlueSky and [LinkedIn](https://linkedin.com/in/modelint) for updates.
63
+
64
+ ## Models to Code
65
+
66
+ In the meantime, if you are curious about the whole MBSE thing that this tool supports, take a look at our [book](https://modelstocode.com).
67
+ Also, various resources at the [Model Integration](https://modelint.com/mbse) website.
68
+
69
+ ## Installation
70
+
71
+ Notes here are for those familiar with python installation procedures. I will write a more detailed set of procedures
72
+ for those who are not in a later release.
73
+
74
+ You should also ensure that you have Python 3.12+ installed. A virtual environment is highly recommended.
75
+
76
+ You can install the Flatland Model Diagram Editor from [PyPI](https://pypi.org/project/flatland-model-diagram-editor/):
77
+
78
+ $ pip install mi-flatland
79
+
80
+ Flatland is supported on Python 3.12 and above
81
+
82
+ ## How to use
83
+
84
+ At this point I refer you to the [wiki](https://github.com/modelint/flatland/wiki) on this site for all of the user documentation. Enjoy (and feel free to contact me if you have any questions.
@@ -0,0 +1,56 @@
1
+ # Flatland Model Diagram (non) Editor
2
+
3
+ NEW Status January 13, 2025
4
+
5
+ I have recently rebuilt the entire application based on a series of modules available on GitHub and PyPI.
6
+ Will be deploying in ernest in the coming days.
7
+
8
+ Am de-commisioning the old version on GitHub and PyPI named 'flatland-model-diagram-editor'
9
+ Now it is just 'flatland' here on GitHub and 'mi-flatland' on PyPI
10
+
11
+ Ah yes, yet another tool for generating diagrams from text. But this one is different (otherwise I wouldn't have wasted all this time building it!)
12
+
13
+ I built Flatland because the following benefits are critical for productive model development:
14
+
15
+ 1. Complete separation of the model semantics from the diagram layout
16
+ 2. Complete separation of model semantics from model notation
17
+ 3. Consistent layout of model diagrams without forcing the user to accept or hack awkard, non-sensical placements of nodes and connectors (yeah, I'm lookin at YOU PlantUML)
18
+ 4. Maximum layout power with minimal specification: No more carpal tunnel pixel pushing!
19
+ 5. Beautiful, readable diagram output in many output formats (pdf, svg, etc)
20
+ 6. Support for industrial strength modeling (many hundreds and thousands of model elements)
21
+ 7. Use your favorite text editor and all the advanced facilities of it and whatever IDE you like without having to learn yet another draw tool that makes you and your team's life difficult.
22
+ 8. And since we're here on GitHub, wouldn't it be nice if all of your models were under proper configuration management where you and your team can diff and merge to your heart's content? Wouldn't it be nice to update a diagram layout without touching the underlying model (and vice versa)?
23
+
24
+ Basically, I have wasted way too many hours of my career pushing pixels around and I just couldn't take it anymore!
25
+
26
+ Flatland is a model diagram non-editor written by me [Leon Starr](mailto:leon_starr@modelint.com) that generates
27
+ beautiful PDFs (and other output formats) based on two very
28
+ human-readable input text files. The model file specifies model semantics
29
+ (state transitions, generalizations, classes etc)
30
+ while the layout file specifies (node placement and alignment, connector anchors) and lightly refers to some elements
31
+ in the model file. You can think of the layout file as a "style sheet" for your models.
32
+ Some benefits:
33
+
34
+ Follow me on BlueSky and [LinkedIn](https://linkedin.com/in/modelint) for updates.
35
+
36
+ ## Models to Code
37
+
38
+ In the meantime, if you are curious about the whole MBSE thing that this tool supports, take a look at our [book](https://modelstocode.com).
39
+ Also, various resources at the [Model Integration](https://modelint.com/mbse) website.
40
+
41
+ ## Installation
42
+
43
+ Notes here are for those familiar with python installation procedures. I will write a more detailed set of procedures
44
+ for those who are not in a later release.
45
+
46
+ You should also ensure that you have Python 3.12+ installed. A virtual environment is highly recommended.
47
+
48
+ You can install the Flatland Model Diagram Editor from [PyPI](https://pypi.org/project/flatland-model-diagram-editor/):
49
+
50
+ $ pip install mi-flatland
51
+
52
+ Flatland is supported on Python 3.12 and above
53
+
54
+ ## How to use
55
+
56
+ At this point I refer you to the [wiki](https://github.com/modelint/flatland/wiki) on this site for all of the user documentation. Enjoy (and feel free to contact me if you have any questions.
@@ -0,0 +1,31 @@
1
+ [build-system]
2
+ requires = ["setuptools>=75.0.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "mi-flatland"
7
+ version = "2.0.0"
8
+ description = "Model text file + layout text file -> beautiful diagram"
9
+ readme = "README.md"
10
+ authors = [{ name = "Leon Starr", email = "leon_starr@modelint.com" }]
11
+ license = { file = "LICENSE" }
12
+ classifiers = [
13
+ "License :: OSI Approved :: MIT License",
14
+ "Programming Language :: Python",
15
+ "Programming Language :: Python :: 3",
16
+ ]
17
+ keywords = ["2D", "draw", "graphics", "canvas", "mbse", "xuml", "xtuml", "sysml"]
18
+ dependencies = ['mi-configurator', 'mi-pyral', 'mi-tabletqt', 'mls-parser', 'numpy',
19
+ 'xcm-parser', 'xsm-parser', 'tomli; python_version < "3.12"']
20
+ requires-python = ">=3.12"
21
+
22
+ [project.optional-dependencies]
23
+ build = ["build", "twine"]
24
+ dev = ["bump2version", "pytest"]
25
+
26
+ [project.scripts]
27
+ tablet = "flatland.__main__:main"
28
+
29
+ [project.urls]
30
+ repository = "https://github.com/modelint/flatland"
31
+ documentation = "https://github.com/modelint/flatland"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ version = "2.0.0"
@@ -0,0 +1,162 @@
1
+ """
2
+ Flatland Diagram Editor
3
+
4
+ """
5
+ # System
6
+ import logging
7
+ import logging.config
8
+ import sys
9
+ import atexit
10
+ import argparse
11
+ from pathlib import Path
12
+
13
+ # Flatland
14
+ from flatland.xuml.xuml_classdiagram import XumlClassDiagram
15
+ from flatland.xuml.xuml_statemachine_diagram import XumlStateMachineDiagram
16
+ from flatland.database.flatland_db import FlatlandDB
17
+ from flatland import version
18
+
19
+ _logpath = Path("flatland.log")
20
+
21
+ def clean_up():
22
+ """Normal and exception exit activities"""
23
+ _logpath.unlink(missing_ok=True)
24
+
25
+ def get_logger():
26
+ """Initiate the logger"""
27
+ log_conf_path = Path(__file__).parent / 'log.conf' # Logging configuration is in this file
28
+ logging.config.fileConfig(fname=log_conf_path, disable_existing_loggers=False)
29
+ return logging.getLogger(__name__) # Create a logger for this module
30
+
31
+ # Configure the expected parameters and actions for the argparse module
32
+ def parse(cl_input):
33
+ parser = argparse.ArgumentParser(description='Flatland model diagram generator')
34
+ parser.add_argument('-m', '--model', action='store',
35
+ help='xuml model file name defining model connectivity without any layout information')
36
+ parser.add_argument('-l', '--layout', action='store',
37
+ help='Flatland layout file defining all layout information with light\
38
+ references to model file.')
39
+ parser.add_argument('-d', '--diagram', action='store', default='diagram.pdf',
40
+ help='Name of file to generate, .pdf extension automatically added')
41
+ parser.add_argument('-D', '--docs', action='store_true',
42
+ help='Copy the project documentation directory into the local directory')
43
+ parser.add_argument('-CF', '--configuration', action='store_true',
44
+ help="Create a new configuration directory in user's flatland home")
45
+ parser.add_argument('-E', '--examples', action='store_true',
46
+ help='Create a directory of examples in the current directory')
47
+ parser.add_argument('-L', '--log', action='store_true',
48
+ help='Generate a diagnostic flatland.log file')
49
+ parser.add_argument('-N', '--nodes_only', action='store_true',
50
+ help='Do not draw any connectors. Helpful to diagnose connector failures due\
51
+ to bad node cplace.')
52
+ parser.add_argument('-NC', '--no_color', action='store_true',
53
+ help='Use white instead of the specified sheet color. Useful when creating printer output.'),
54
+ parser.add_argument('-V', '--version', action='store_true',
55
+ help='Print the current version of flatland')
56
+ parser.add_argument('-G', '--grid', action='store_true',
57
+ help='Print the grid so you can diagnose output with row and column boundaries visible')
58
+ parser.add_argument('-RT', '--show_ref_types', action='store_true',
59
+ help='Display referential attribute types on class diagrams')
60
+ parser.add_argument('-RUL', '--rulers', action='store_true',
61
+ help='Print the ruler grid so you check canvas positions')
62
+ parser.add_argument('-R', '--rebuild', action='store_true',
63
+ help='Rebuild the flatland database. Necessary only if corrupted.')
64
+ return parser.parse_args(cl_input)
65
+
66
+
67
+ def main():
68
+ # Start logging
69
+ logger = get_logger()
70
+ logger.info(f'Flatland version: {version}')
71
+
72
+ # Keep track of whether or not Config has been run by some command line option so we don't re-run it
73
+ already_configured = False
74
+
75
+ # Parse the command line args
76
+ args = parse(sys.argv[1:])
77
+
78
+ if not args.log:
79
+ # If no log file is requested, remove the log file before termination
80
+ atexit.register(clean_up)
81
+
82
+ if args.version:
83
+ # Just print the version and quit
84
+ print(f'Flatland version: {version}')
85
+ sys.exit(0)
86
+
87
+ # if args.examples:
88
+ # # Copy the entire example directory into the users local dir if it does not already exist
89
+ # import shutil
90
+ # ex_path = Path(__file__).parent / 'examples'
91
+ # local_ex_path = Path.cwd() / 'examples'
92
+ # if local_ex_path.exists():
93
+ # logger.warning("Examples already exist in the current directory. Delete or move it if you want the latest.")
94
+ # else:
95
+ # logger.info("Copying example directory users local directory")
96
+ # shutil.copytree(ex_path, local_ex_path) # Copy the example directory
97
+ # test_gen_path = Path(__file__).parent / 'tests' / 'gen_example_diagrams.py'
98
+ # shutil.copy(test_gen_path, local_ex_path) # Copy the gen_example file into the copied example dir
99
+ #
100
+ # if args.docs:
101
+ # # Copy the entire docs directory into the users local dir if it does not already exist
102
+ # import shutil
103
+ # docs_path = Path(__file__).parent / 'documentation'
104
+ # local_docs_path = Path.cwd() / 'documentation'
105
+ # if local_docs_path.exists():
106
+ # logger.warning("Documentation already exists in the current directory.\
107
+ # Delete or move it if you want the latest.")
108
+ # else:
109
+ # logger.info("Copying doc directory to users local directory")
110
+ # shutil.copytree(docs_path, local_docs_path)
111
+ #
112
+ if args.model and not args.layout:
113
+ logger.error("A layout file must be specified for your model.")
114
+ sys.exit(1)
115
+
116
+ if args.layout and not args.model:
117
+ logger.error("A model file must be specified to layout.")
118
+ sys.exit(1)
119
+
120
+ # At this point we either have both model and layout or neither
121
+ # If neither, the only thing we might do at this point is rebuild the database if requested
122
+
123
+ # Do any configuration tasks necessary before starting up the app
124
+ # The database will be rebuilt if requested
125
+ if not already_configured:
126
+ FlatlandDB.create_db(rebuild=args.rebuild)
127
+
128
+ # if args.model and args.layout: # Just making sure we have them both
129
+ model_path = Path(args.model)
130
+ layout_path = Path(args.layout)
131
+ diagram_path = Path(args.diagram)
132
+
133
+ # Generate the xuml class diagram (we don't do anything with the returned variable yet)
134
+ mtype = model_path.suffix
135
+ if mtype == '.xcm':
136
+ XumlClassDiagram(
137
+ xuml_model_path=model_path,
138
+ flatland_layout_path=layout_path,
139
+ diagram_file_path=diagram_path,
140
+ show_grid=args.grid,
141
+ nodes_only=args.nodes_only,
142
+ no_color=args.no_color,
143
+ show_rulers=args.rulers,
144
+ show_ref_types=args.show_ref_types
145
+ )
146
+ elif mtype == '.xsm':
147
+ statemodel_diagram = XumlStateMachineDiagram(
148
+ xuml_model_path=model_path,
149
+ flatland_layout_path=layout_path,
150
+ diagram_file_path=diagram_path,
151
+ show_grid=args.grid,
152
+ nodes_only=args.nodes_only,
153
+ show_rulers=args.rulers,
154
+ no_color=args.no_color,
155
+ )
156
+
157
+ logger.info("No problemo") # We didn't die on an exception, basically
158
+ print("No problemo")
159
+
160
+
161
+ if __name__ == "__main__":
162
+ main()
@@ -0,0 +1,51 @@
1
+ """ configDB.py - Load configuration data """
2
+
3
+ # System
4
+ from pathlib import Path
5
+ from collections import namedtuple
6
+ from typing import NamedTuple
7
+
8
+ # Model Integration
9
+ from mi_config.config import Config
10
+
11
+ # Flatland
12
+ from flatland.names import app
13
+
14
+ ConfigItem = namedtuple('ConfigItem', 'name collector')
15
+
16
+ class SheetData(NamedTuple):
17
+ standard: str
18
+ height: float
19
+ width: float
20
+ size_group: str
21
+
22
+ class ConfigDB:
23
+ """
24
+ A set of yaml config files are processed to build a dictionary of
25
+ config item data
26
+ """
27
+
28
+ config_path = Path(__file__).parent # Location of the system yaml files
29
+
30
+ item_data = {}
31
+
32
+ config_items = [ # Yaml file prefix and tuple, if any, to load data from file
33
+ ConfigItem(name="metadata", collector=None),
34
+ ConfigItem(name="sheet", collector=SheetData),
35
+ ConfigItem(name="titleblock", collector=None),
36
+ ConfigItem(name="frame", collector=None),
37
+ ConfigItem(name="notation", collector=None),
38
+ ConfigItem(name="layout_specification", collector=None),
39
+ ConfigItem(name="diagram_type", collector=None),
40
+ ConfigItem(name="connector_type", collector=None),
41
+ ConfigItem(name="name_placement", collector=None),
42
+ ]
43
+
44
+ @classmethod
45
+ def __init__(cls):
46
+ """
47
+ Load all config items in corresponding yaml files into item_data dictionary
48
+ """
49
+ for item in cls.config_items:
50
+ c = Config(app_name=app, lib_config_dir=cls.config_path, fspec={item.name:item.collector})
51
+ cls.item_data[item.name] = c.loaded_data[item.name]
@@ -0,0 +1,65 @@
1
+ # cconnector_type_name.yaml – Connector type data
2
+
3
+ # Diagram type / Connector Type / Stem Type, etc
4
+
5
+ # TODO: clarify meaning of stem type geometry in comment below
6
+
7
+ class: # Diagram type
8
+ stem semantics: [ Mc mult, 1c mult, 1 mult, M mult, superclass, ordinal ] # stem semantics
9
+ connector types:
10
+ binary association: # Connector type
11
+ geometry: binary # unary, binary, or tree
12
+ about: Connects an anchor point on one node to an anchor point on the same or another node
13
+ stem positions:
14
+ class face: # Name of stem position
15
+ about: How many instances may be associated
16
+ minimum length: 20
17
+ stretch: fixed # fixed, hanging, or free
18
+ association:
19
+ about: How many association class instances per pair of associated instances
20
+ minimum length: 24
21
+ stretch: hanging
22
+ generalization:
23
+ geometry: tree
24
+ about: A superset class compeletely split into disjoint subset classes
25
+ stem positions:
26
+ superclass face:
27
+ about: The superset of all subclass instances
28
+ minimum length: 15
29
+ stretch: fixed
30
+ subclass face:
31
+ about: A disjoint subset of the superclass set of instances
32
+ minimum length: 10
33
+ stretch: fixed
34
+
35
+ state machine:
36
+ stem semantics: [ target state, initial pseudo state, final pseudo state ] # stem semantics
37
+ connector types:
38
+ initial transition:
39
+ geometry: unary
40
+ about: Designates an initial state
41
+ stem positions:
42
+ to initial state:
43
+ about: Points to a designated state as an initial state
44
+ minimum length: 60
45
+ stretch: free
46
+ deletion transition:
47
+ geometry: unary
48
+ about: Designates implicit instance deletion after a state executes its activity
49
+ stem positions:
50
+ from final state:
51
+ about: Points away from a final state to indicate deletion
52
+ minimum length: 10
53
+ stretch: free
54
+ transition:
55
+ geometry: binary
56
+ about: Defines a path from one state to another
57
+ stem positions:
58
+ from state:
59
+ about: Points to the source state in a transition
60
+ minimum length: 10
61
+ stretch: fixed
62
+ to state:
63
+ about: Points to the destination state in a transition
64
+ minimum length: 15
65
+ stretch: fixed