Minor bugfixes

This commit is contained in:
Sven Heidemann 2022-01-18 21:13:56 +01:00
parent cc56bf33ce
commit 405dded626
8 changed files with 16 additions and 20 deletions

View File

@ -16,7 +16,7 @@ class ClassImplementation:
return self._subclass
def __str__(self):
return f'{self._subclass.name} -> {self._base.name}'
return f'<{self._subclass.name} -> {self._base.name}>'
def __repr__(self):
return f'{self._subclass.name} -> {self._base.name}'
return f'<{self._subclass.name} -> {self._base.name}>'

View File

@ -21,7 +21,7 @@ class Dimension:
self._height = value
def __str__(self):
return f'(w:{self._width}, h:{self._height})'
return f'<{type(self).__name__} w:{self._width}, h:{self._height}>'
def __repr__(self):
return f'(w:{self._width}, h:{self._height})'
return f'<{type(self).__name__} w:{self._width}, h:{self._height}>'

View File

@ -21,7 +21,7 @@ class Position:
self._y = value
def __str__(self):
return f'(x:{self._x}, y:{self._y})'
return f'<{type(self).__name__} x:{self._x}, y:{self._y}>'
def __repr__(self):
return f'(x:{self._x}, y:{self._y})'
return f'<{type(self).__name__} x:{self._x}, y:{self._y}>'

View File

@ -30,7 +30,7 @@ class PythonClass:
self._attributes.append(attribute)
def __str__(self):
return f'{self._name}'
return f'<{type(self).__name__} {self._name} a:{len(self._attributes)} f:{len(self._functions)}>'
def __repr__(self):
return f'{self._name}'
return f'<{type(self).__name__} {self._name} a:{len(self._attributes)} f:{len(self._functions)}>'

View File

@ -21,7 +21,7 @@ class PythonClassAttribute:
return self._type
def __str__(self):
return f'{self._name}: {self._type}'
return f'<{type(self).__name__} {self._name}: {self._type}>'
def __repr__(self):
return f'{self._name}: {self._type}'
return f'<{type(self).__name__} {self._name}: {self._type}>'

View File

@ -13,7 +13,7 @@ class PythonFunctionArgument:
return self._type
def __str__(self):
return f'{self._name}: {self._type}'
return f'<{type(self).__name__} {self._name}: {self._type}>'
def __repr__(self):
return f'{self._name}: {self._type}'
return f'<{type(self).__name__} {self._name}: {self._type}>'

View File

@ -44,10 +44,10 @@ class UMLClass:
self._dimension = value
def __str__(self):
return f'{self._cls}: {self._position} {self._dimension}'
return f'<{type(self).__name__} {self._cls}: {self._position} {self._dimension}>'
def __repr__(self):
return f'{self._cls}: {self._position} {self._dimension}'
return f'<{type(self).__name__} {self._cls}: {self._position} {self._dimension}>'
def implementation_as_xml(self, base_class: 'UMLClass') -> str:
base_point = Position(

View File

@ -78,7 +78,7 @@ class UmletCreatorService(UmletCreatorABC):
cls.position.x = new_x
last_base.x = cls.position.x + cls.dimension.width
else:
last_base.x = 0
last_base.x = self._padding
last_base.y = highest_y + self._padding * 2
if cls.position.y + cls.dimension.height > highest_y:
@ -88,15 +88,11 @@ class UmletCreatorService(UmletCreatorABC):
uml_classes = List(UMLClass)
xml_classes = ''
xml_relations = ''
default_width = 80
default_height = 80
next_x = self._padding
for cls in classes:
uml_cls = UMLClass(cls, Position(next_x, self._padding), Dimension(default_width, default_height))
uml_cls = UMLClass(cls, Position(0, self._padding), Dimension(80, 80))
# trigger xml generation to render coordinates
uml_cls.create_xml_body()
next_x += round(uml_cls.dimension.width, -1) + self._padding
uml_classes.append(uml_cls)
self._sort_by_implementation(uml_classes, implementations)