pyArchimate 2.0.0__tar.gz → 2.0.2__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 (64) hide show
  1. {pyarchimate-2.0.0/src/pyArchimate.egg-info → pyarchimate-2.0.2}/PKG-INFO +2 -2
  2. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/README.md +1 -1
  3. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/pyproject.toml +1 -1
  4. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/svg_export.py +16 -8
  5. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/writers/archiWriter.py +2 -0
  6. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/writers/archimateWriter.py +6 -3
  7. {pyarchimate-2.0.0 → pyarchimate-2.0.2/src/pyArchimate.egg-info}/PKG-INFO +2 -2
  8. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/LICENSE +0 -0
  9. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/setup.cfg +0 -0
  10. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/__init__.py +0 -0
  11. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/checker_rules.yml +0 -0
  12. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/constants.py +0 -0
  13. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/derivation.py +0 -0
  14. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/element.py +0 -0
  15. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/enums.py +0 -0
  16. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/exceptions.py +0 -0
  17. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/helpers/__init__.py +0 -0
  18. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/helpers/diagram.py +0 -0
  19. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/helpers/logging.py +0 -0
  20. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/helpers/parsing.py +0 -0
  21. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/helpers/properties.py +0 -0
  22. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/logger.py +0 -0
  23. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/model.py +0 -0
  24. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/pyArchimate.py +0 -0
  25. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/__init__.py +0 -0
  26. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/_archireader_helpers.py +0 -0
  27. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/_arisamlreader_helpers.py +0 -0
  28. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/archiReader.py +0 -0
  29. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/archimateReader.py +0 -0
  30. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/readers/arisAMLreader.py +0 -0
  31. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/relationship.py +0 -0
  32. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/__init__.py +0 -0
  33. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/__init__.py +0 -0
  34. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/algorithms/__init__.py +0 -0
  35. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/algorithms/force_directed.py +0 -0
  36. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/algorithms/hierarchical.py +0 -0
  37. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/core.py +0 -0
  38. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/__init__.py +0 -0
  39. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/symbols/__init__.py +0 -0
  40. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/symbols/archimate_relationships.py +0 -0
  41. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/symbols/archimate_symbols.py +0 -0
  42. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/export/symbols/color_palette.py +0 -0
  43. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/format/__init__.py +0 -0
  44. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/format/element_format.py +0 -0
  45. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/layout_engine.py +0 -0
  46. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/__init__.py +0 -0
  47. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/label_placement.py +0 -0
  48. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/layer_constraints.py +0 -0
  49. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/obstacle_map.py +0 -0
  50. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/orthogonal.py +0 -0
  51. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/routing/segment_separation.py +0 -0
  52. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/utils/__init__.py +0 -0
  53. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/utils/edge_utils.py +0 -0
  54. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/utils/geometry.py +0 -0
  55. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/view/layout/utils/graph.py +0 -0
  56. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/viewpoint.py +0 -0
  57. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/viewpoint_registry.py +0 -0
  58. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/writers/__init__.py +0 -0
  59. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate/writers/csvWriter.py +0 -0
  60. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate.egg-info/SOURCES.txt +0 -0
  61. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate.egg-info/dependency_links.txt +0 -0
  62. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate.egg-info/requires.txt +0 -0
  63. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate.egg-info/top_level.txt +0 -0
  64. {pyarchimate-2.0.0 → pyarchimate-2.0.2}/src/pyArchimate.egg-info/zip-safe +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyArchimate
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: A library to create & manage Archimate files
5
5
  Author-email: Xavier Mayeur <xavier@mayeur.be>
6
6
  License-Expression: GPL-3.0-only
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
  [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=bugs)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
31
31
  [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=security_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
32
32
  [![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=sqale_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
33
- [![Docs](https://readthedocs.org/projects/pyarchimate/badge/?version=master)](https://pyarchimate.readthedocs.io)
33
+ [![Docs](https://img.shields.io/readthedocs/pyarchimate/master)](https://pyarchimate.readthedocs.io)
34
34
 
35
35
  Documentation: [readthedocs.org](https://pyarchimate.readthedocs.io)
36
36
 
@@ -11,7 +11,7 @@
11
11
  [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=bugs)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
12
12
  [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=security_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
13
13
  [![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=sqale_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
14
- [![Docs](https://readthedocs.org/projects/pyarchimate/badge/?version=master)](https://pyarchimate.readthedocs.io)
14
+ [![Docs](https://img.shields.io/readthedocs/pyarchimate/master)](https://pyarchimate.readthedocs.io)
15
15
 
16
16
  Documentation: [readthedocs.org](https://pyarchimate.readthedocs.io)
17
17
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyArchimate"
3
- version = "2.0.0"
3
+ version = "2.0.2"
4
4
  authors = [
5
5
  { name="Xavier Mayeur", email="xavier@mayeur.be" }
6
6
  ]
@@ -181,7 +181,7 @@ class SVGExportService:
181
181
  self._add_defs(svg)
182
182
 
183
183
  # Add white background rectangle
184
- self._add_background(svg, svg_width, svg_height)
184
+ self._add_background(svg, svg_width, svg_height, svg_min_x, svg_min_y)
185
185
 
186
186
  # Build complete nodes dictionary including nested nodes (for connection rendering)
187
187
  complete_nodes_dict = self._build_complete_nodes_dict(view)
@@ -428,20 +428,24 @@ class SVGExportService:
428
428
  },
429
429
  )
430
430
 
431
- def _add_background(self, svg: ET.Element, width: float, height: float) -> None:
431
+ def _add_background(
432
+ self, svg: ET.Element, width: float, height: float, min_x: float = 0.0, min_y: float = 0.0
433
+ ) -> None:
432
434
  """Add white background rectangle to SVG canvas.
433
435
 
434
436
  Args:
435
437
  svg: SVG root element
436
438
  width: SVG canvas width
437
439
  height: SVG canvas height
440
+ min_x: left of the SVG canvas (view box), which may be negative
441
+ min_y: top of the SVG canvas (view box), which may be negative
438
442
  """
439
443
  ET.SubElement(
440
444
  svg,
441
445
  "rect",
442
446
  {
443
- "x": "0",
444
- "y": "0",
447
+ "x": str(int(min_x)),
448
+ "y": str(int(min_y)),
445
449
  "width": str(int(width)),
446
450
  "height": str(int(height)),
447
451
  "fill": "white",
@@ -860,7 +864,7 @@ class SVGExportService:
860
864
  tspan.text = line
861
865
 
862
866
  def _word_wrap_text(self, text: str, max_width: float) -> list[str]:
863
- """Word wrap text to fit within max_width.
867
+ """Word wrap text to fit within max_width, keeping its line breaks.
864
868
 
865
869
  Args:
866
870
  text: Text to wrap
@@ -869,6 +873,9 @@ class SVGExportService:
869
873
  Returns:
870
874
  List of text lines
871
875
  """
876
+ if "\n" in text:
877
+ return [line for paragraph in text.splitlines() for line in self._word_wrap_text(paragraph, max_width)]
878
+
872
879
  # Estimate characters per line (rough: ~6 pixels per character)
873
880
  chars_per_line = max(1, int(max_width / 6))
874
881
 
@@ -1087,8 +1094,9 @@ class SVGExportService:
1087
1094
  return source_node, target_node
1088
1095
 
1089
1096
  def _build_relationship_label(self, rel_type: str, conn: Any) -> str:
1090
- """Return label text, appending influence_strength for Influence relationships."""
1091
- label = self._get_short_type_name(rel_type)
1097
+ """Return label text: the relationship name, or its short type name when it has no name, with the
1098
+ influence_strength appended for Influence relationships."""
1099
+ label = getattr(conn, "name", None) or self._get_short_type_name(rel_type)
1092
1100
  if rel_type in ("Influence", "InfluenceRelationship"):
1093
1101
  strength = getattr(conn, "influence_strength", None) or getattr(conn, "_influence_strength", None)
1094
1102
  if strength:
@@ -1194,7 +1202,7 @@ class SVGExportService:
1194
1202
 
1195
1203
  # Render connection label
1196
1204
  rel_type = getattr(conn, "type", "Relationship")
1197
- label_text = self._get_short_type_name(rel_type)
1205
+ label_text = self._build_relationship_label(rel_type, conn)
1198
1206
 
1199
1207
  if label_text and len(points) >= 2:
1200
1208
  self._render_connection_label(svg, points, label_text)
@@ -406,6 +406,8 @@ def archi_writer(model: Model, file_path: str) -> str:
406
406
  """
407
407
 
408
408
  root = et.fromstring(xml)
409
+ # Without the blank text of the template, pretty_print can indent the whole document
410
+ root.text = None
409
411
  xsi_url = "http://www.w3.org/2001/XMLSchema-instance" # NOSONAR
410
412
  xsi = et.QName(xsi_url, "type")
411
413
  folders = _create_folders(root)
@@ -238,7 +238,7 @@ def _write_node_style(n_elem: _Element, n: Node) -> None:
238
238
  rgb = RGBA()
239
239
  rgb.color = n.line_color
240
240
  lc.set("r", str(rgb.r))
241
- lc.set("g", str(rgb.r))
241
+ lc.set("g", str(rgb.g))
242
242
  lc.set("b", str(rgb.b))
243
243
  lc.set("a", "100" if n.opacity is None else str(n.lc_opacity))
244
244
  if n.fill_color is not None:
@@ -374,6 +374,8 @@ def archimate_writer(model: Model, file_path: str | None = None) -> str:
374
374
  """
375
375
 
376
376
  root = et.fromstring(xml)
377
+ # Without the blank text of the template, pretty_print can indent the whole document
378
+ root.text = None
377
379
  nsp_url = "http://www.opengroup.org/xsd/archimate/3.0/" # NOSONAR
378
380
  xsi_url = "http://www.w3.org/2001/XMLSchema-instance" # NOSONAR
379
381
  xsi = et.QName(xsi_url, "type")
@@ -393,14 +395,15 @@ def archimate_writer(model: Model, file_path: str | None = None) -> str:
393
395
  _write_relationships(root, model, xsi)
394
396
  _write_organizations(root, model, ns_find)
395
397
 
398
+ # The definitions are written before the views, as required by the schema, but filled after them, so that they
399
+ # also include the definitions of the view properties
396
400
  pd = et.SubElement(root, "propertyDefinitions")
401
+ _write_views(root, model, xsi)
397
402
  for k, v in model.pdefs.items():
398
403
  p = et.SubElement(pd, "propertyDefinition", identifier=k, type="string")
399
404
  p_name = et.SubElement(p, "name")
400
405
  p_name.text = str(v)
401
406
 
402
- _write_views(root, model, xsi)
403
-
404
407
  pd_check = root.find("propertyDefinitions")
405
408
  if pd_check is not None and pd_check.find("propertyDefinition") is None:
406
409
  root.remove(pd_check)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyArchimate
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: A library to create & manage Archimate files
5
5
  Author-email: Xavier Mayeur <xavier@mayeur.be>
6
6
  License-Expression: GPL-3.0-only
@@ -30,7 +30,7 @@ Dynamic: license-file
30
30
  [![Bugs](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=bugs)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
31
31
  [![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=security_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
32
32
  [![Maintainability](https://sonarcloud.io/api/project_badges/measure?project=pyArchimate_pyArchimate&metric=sqale_rating)](https://sonarcloud.io/project/overview?id=pyArchimate_pyArchimate)
33
- [![Docs](https://readthedocs.org/projects/pyarchimate/badge/?version=master)](https://pyarchimate.readthedocs.io)
33
+ [![Docs](https://img.shields.io/readthedocs/pyarchimate/master)](https://pyarchimate.readthedocs.io)
34
34
 
35
35
  Documentation: [readthedocs.org](https://pyarchimate.readthedocs.io)
36
36
 
File without changes
File without changes