diff --git a/examples/all-elements.gaphor b/examples/all-elements.gaphor index 22da986a7..edf0cfdda 100644 --- a/examples/all-elements.gaphor +++ b/examples/all-elements.gaphor @@ -1509,5 +1509,5 @@ val - + \ No newline at end of file diff --git a/gaphor/UML/uml.py b/gaphor/UML/uml.py index 137dec685..e41c341b8 100644 --- a/gaphor/UML/uml.py +++ b/gaphor/UML/uml.py @@ -16,7 +16,7 @@ from gaphor.core.modeling import ( Element, NamedElement, PackageableElement, - Stylesheet, + StyleSheet, ) from gaphor.core.modeling.properties import ( association, diff --git a/gaphor/core/modeling/__init__.py b/gaphor/core/modeling/__init__.py index a036f2368..e395e9769 100644 --- a/gaphor/core/modeling/__init__.py +++ b/gaphor/core/modeling/__init__.py @@ -7,4 +7,4 @@ from gaphor.core.modeling.coremodel import ( from gaphor.core.modeling.diagram import Diagram from gaphor.core.modeling.elementfactory import ElementFactory from gaphor.core.modeling.event import * -from gaphor.core.modeling.presentation import Presentation, Stylesheet +from gaphor.core.modeling.presentation import Presentation, StyleSheet diff --git a/gaphor/core/modeling/coremodel.py b/gaphor/core/modeling/coremodel.py index a92f3218d..c946e9dd8 100644 --- a/gaphor/core/modeling/coremodel.py +++ b/gaphor/core/modeling/coremodel.py @@ -50,13 +50,13 @@ class Comment(Element): annotatedElement: relation_many[Element] -# 40: override Stylesheet +# 40: override StyleSheet # defined in gaphor.core.modeling.presentation NamedElement.name = attribute("name", str) Comment.body = attribute("body", str) -# 43: override Stylesheet.stylesheet +# 43: override StyleSheet.styleSheet # defined in gaphor.core.modeling.presentation # 52: override Presentation.subject diff --git a/gaphor/core/modeling/presentation.py b/gaphor/core/modeling/presentation.py index 9b3816de1..bf624af7f 100644 --- a/gaphor/core/modeling/presentation.py +++ b/gaphor/core/modeling/presentation.py @@ -26,7 +26,7 @@ def read_style_py(): import os.path import ast - sheet_py = os.path.join(get_config_dir(), "stylesheet.py") + sheet_py = os.path.join(get_config_dir(), "styleSheet.py") try: with open(sheet_py) as f: return ast.literal_eval(f.read()) @@ -34,12 +34,12 @@ def read_style_py(): return {} -class Stylesheet(Element): +class StyleSheet(Element): def __init__(self, id=None, model=None): super().__init__(id, model) self._style = read_style_py() - stylesheet: attribute[str] = attribute("stylesheet", str) + styleSheet: attribute[str] = attribute("styleSheet", str) def item_style(self, item): return self._style @@ -65,12 +65,12 @@ class Presentation(Element, Generic[S]): ) @property - def stylesheet(self) -> Optional[Stylesheet]: - return next(self.model.select(Stylesheet), None,) # type: ignore[arg-type] + def styleSheet(self) -> Optional[StyleSheet]: + return next(self.model.select(StyleSheet), None,) # type: ignore[arg-type] @property def style(self): - sheet = self.stylesheet + sheet = self.styleSheet return sheet and sheet.item_style(self) or {} handles: Callable[[Presentation], List[Handle]] diff --git a/gaphor/core/modeling/tests/test_presentation.py b/gaphor/core/modeling/tests/test_presentation.py index 0bcbe4ca5..5507f1296 100644 --- a/gaphor/core/modeling/tests/test_presentation.py +++ b/gaphor/core/modeling/tests/test_presentation.py @@ -4,7 +4,7 @@ from gaphas.item import Item from gaphor.core.eventmanager import EventManager from gaphor.core.modeling.diagram import Diagram from gaphor.core.modeling.elementfactory import ElementFactory -from gaphor.core.modeling.presentation import Presentation, Stylesheet +from gaphor.core.modeling.presentation import Presentation, StyleSheet class StubItem(Presentation, Item): @@ -23,13 +23,13 @@ def diagram(element_factory): def test_presentation_stylesheet(diagram, element_factory): - stylesheet = element_factory.create(Stylesheet) + styleSheet = element_factory.create(StyleSheet) presentation = diagram.create(StubItem) - assert presentation.stylesheet is stylesheet + assert presentation.styleSheet is styleSheet def test_presentation_stylesheet_is_absent(diagram): presentation = diagram.create(StubItem) - assert presentation.stylesheet is None + assert presentation.styleSheet is None diff --git a/gaphor/diagram/general/simpleitem.py b/gaphor/diagram/general/simpleitem.py index e45ef80eb..5748861e0 100644 --- a/gaphor/diagram/general/simpleitem.py +++ b/gaphor/diagram/general/simpleitem.py @@ -10,7 +10,7 @@ from gaphas.item import NW, Element from gaphas.item import Line as _Line from gaphas.util import path_ellipse -from gaphor.core.modeling import Presentation, Stylesheet +from gaphor.core.modeling import Presentation from gaphor.diagram.shapes import DrawContext, combined_style, stroke diff --git a/models/Core.gaphor b/models/Core.gaphor index b154eeb23..a9ecdc6e2 100644 --- a/models/Core.gaphor +++ b/models/Core.gaphor @@ -87,7 +87,7 @@ (1.0, 0.0, 0.0, 1.0, 174.91839599609347, 521.4187622070312) -184.0 +186.0 66.0 @@ -231,7 +231,7 @@ 0 -[(0.0, 0.0), (0.0, 74.77569580078125), (-312.4324951171878, 74.77569580078125), (-312.4324951171878, 400.1944580078125)] +[(0.0, 0.0), (0.0, 74.77569580078125), (-311.43589451002066, 74.77569580078125), (-311.43589451002066, 400.1944580078125)] @@ -371,7 +371,7 @@ (1.0, 0.0, 0.0, 1.0, 405.7207298415308, 523.8687744140625) -147.0 +149.0 66.0 @@ -397,7 +397,7 @@ 0 -[(0.0, 0.0), (0.0, 74.77569580078125), (-99.67199572428763, 74.77569580078125), (-99.67199572428763, 402.64447021484375)] +[(0.0, 0.0), (0.0, 74.77569580078125), (-98.67207745885685, 74.77569580078125), (-98.67207745885685, 402.64447021484375)] @@ -422,7 +422,7 @@ -(1.0, 0.0, 0.0, 1.0, 431.7618408203125, 523.8687744140625) +(1.0, 0.0, 0.0, 1.0, 432.1161416499558, 523.8687744140625) 0 @@ -431,7 +431,7 @@ 0 -[(0.0, 0.0), (-50.89434814453125, -45.74224853515625)] +[(0.0, 0.0), (-51.24864897417456, -45.74224853515625)] @@ -844,10 +844,10 @@ 1 -stylesheet +styleSheet -Stylesheet +StyleSheet @@ -857,7 +857,7 @@ -Stylesheet +StyleSheet @@ -883,7 +883,7 @@ -stylesheet +styleSheet String diff --git a/models/Core.override b/models/Core.override index b8dc0bc41..a702ae646 100644 --- a/models/Core.override +++ b/models/Core.override @@ -37,10 +37,10 @@ NamedElement.qualifiedName = derived( lambda obj: [_namedelement_qualifiedname(obj)], ) %% -override Stylesheet +override StyleSheet # defined in gaphor.core.modeling.presentation %% -override Stylesheet.stylesheet +override StyleSheet.styleSheet # defined in gaphor.core.modeling.presentation %% override Presentation diff --git a/models/UML.override b/models/UML.override index 818babe14..9b215fe87 100644 --- a/models/UML.override +++ b/models/UML.override @@ -30,7 +30,7 @@ override PackageableElement from gaphor.core.modeling import PackageableElement %% override Diagram -from gaphor.core.modeling import Diagram, Stylesheet +from gaphor.core.modeling import Diagram, StyleSheet %% override Transition # Invert order of superclasses to avoid MRO issues