Coverage for backend/flowsheetInternals/graphicData/models/graphicObjectModel.py: 100%

25 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from types import MappingProxyType 

2from django.db import models 

3from core.auxiliary.enums import Status 

4from core.managers import AccessControlManager 

5 

6 

7class GraphicObject(models.Model): 

8 flowsheet = models.ForeignKey("core_auxiliary.Flowsheet", on_delete=models.CASCADE, related_name="GraphicObjects") 

9 simulationObject = models.ForeignKey('flowsheetInternals_unitops.SimulationObject', on_delete=models.CASCADE, related_name='graphicObject', null=True) 

10 visible = models.BooleanField(default=True) 

11 x = models.FloatField(default=0) 

12 y = models.FloatField(default=0) 

13 height = models.FloatField(default=0) 

14 width = models.FloatField(default=0) 

15 rotation = models.IntegerField(default=0) 

16 group = models.ForeignKey('flowsheetInternals_graphicData.Grouping', on_delete=models.CASCADE, related_name='graphicObjects', null=True) 

17 flipped = models.BooleanField(default=False) 

18 

19 def copy_position_from(self, other): 

20 self.x = other.x 

21 self.y = other.y 

22 self.height = other.height 

23 self.width = other.width 

24 self.rotation = other.rotation 

25 self.flipped = other.flipped 

26 self.save() 

27 

28 created_at = models.DateTimeField(auto_now_add=True) 

29 objects = AccessControlManager() 

30 

31