Commits

German Larrain committed e6991fa

model.simulator: removed signals from '__init__' module, instead the new 'signals' module is used.

Comments (0)

Files changed (2)

ars/app/__init__.py

 import ars.exceptions as exc
 import ars.graphics.adapters as gp
 from ars.lib.pydispatch import dispatcher
-from ars.model.simulator import Simulation, SIM_PRE_FRAME_SIGNAL
+from ars.model.simulator import Simulation, signals
+
 
 class Program():
 
 		if periodically:
 			period = 1.0 / self.FPS
 			self._screenshot_recorder.period = period
-		dispatcher.connect(self.record_frame, SIM_PRE_FRAME_SIGNAL)
+		dispatcher.connect(self.record_frame, signals.SIM_PRE_FRAME)
 
 	def record_frame(self):
 		"""

ars/model/simulator/__init__.py

 import ars.utils.geometry as gemut
 import ars.utils.mathematical as mu
 
-
-SIM_PRE_STEP_SIGNAL = 'simulation pre step'
-SIM_POST_STEP_SIGNAL = 'simulation post step'
-SIM_PRE_FRAME_SIGNAL = 'simulation pre frame'
-SIM_POST_FRAME_SIGNAL = 'simulation post frame'
+from ars.model.simulator import signals
 
 
 class Simulation:
 		self.num_frame += 1
 
 		try:
-			dispatcher.send(SIM_PRE_FRAME_SIGNAL) # before each visualization frame
+			dispatcher.send(signals.SIM_PRE_FRAME) # before each visualization frame
 		except Exception as e:
 			print(e)
 
 		self.perform_sim_steps_per_frame()
 
 		try:
-			dispatcher.send(SIM_POST_FRAME_SIGNAL) # after each visualization frame
+			dispatcher.send(signals.SIM_POST_FRAME) # after each visualization frame
 		except Exception as e:
 			print(e)
 
 			# before each integration step of the physics engine
 			try:
 				# send the signal so subscribers do their stuff in time
-				dispatcher.send(SIM_PRE_STEP_SIGNAL)
+				dispatcher.send(signals.SIM_PRE_STEP)
 				# call all registered functions before each step of the next frame
 				for callback_ in self.all_frame_steps_callbacks:
 					callback_()
 
 			# after each integration step of the physics engine
 			try:
-				dispatcher.send(SIM_POST_STEP_SIGNAL)
+				dispatcher.send(signals.SIM_POST_STEP)
 			except Exception as e:
 				print(e)
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.