Browse Source

offer refactored way to remove subject collection

Bastien Sevajol 7 years ago
parent
commit
b6ab205fb0
1 changed files with 7 additions and 0 deletions
  1. 7 0
      synergine2/simulation.py

+ 7 - 0
synergine2/simulation.py View File

@@ -120,6 +120,13 @@ class Subject(IdentifiedObject):
120 120
         for collection in self.collections:
121 121
             self.simulation.collections.setdefault(collection, []).append(self.id)
122 122
 
123
+    def remove_collection(self, collection_name: str) -> None:
124
+        self.collections.remove(collection_name)
125
+        # Manipulate as shared property
126
+        simulation_collection = self.simulation.collections[collection_name]
127
+        simulation_collection.remove(self.id)
128
+        self.simulation.collections[collection_name] = simulation_collection
129
+
123 130
     def __str__(self):
124 131
         return self.__repr__()
125 132