Commits

German Larrain  committed f896d63

graphics.adapters.VtkAdapter: renamed attribute 'iren' to 'interactor'.

  • Participants
  • Parent commits 2d26c0f

Comments (0)

Files changed (1)

File ars/graphics/adapters.py

 		super(VtkAdapter, self).__init__()
 		self.renderer = vtk.vtkRenderer()
 		self.render_window = None
-		self.iren = None
+		self.interactor = None
 		self._title = ''
 		self._size = None
 		self._zoom = None
 		# create a rendering window and RenderWindowInteractor
 		self.render_window = vtk.vtkRenderWindow()
 		self.render_window.AddRenderer(self.renderer)
-		self.iren = vtk.vtkRenderWindowInteractor()
-		self.iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
-		self.iren.SetRenderWindow(self.render_window)
+		self.interactor = vtk.vtkRenderWindowInteractor()
+		self.interactor.SetInteractorStyle(
+			vtk.vtkInteractorStyleTrackballCamera())
+		self.interactor.SetRenderWindow(self.render_window)
 
 		# set properties
 		self.render_window.SetSize(*self._size)
 		self.renderer.SetActiveCamera(camera)
 		self.render_window.Render()
 
-		self.iren.AddObserver(gp.TIMER_EVENT, self._timer_callback)
+		self.interactor.AddObserver(gp.TIMER_EVENT, self._timer_callback)
 		#noinspection PyUnusedLocal
-		timerId = self.iren.CreateRepeatingTimer(gp.TIMER_PERIOD)  #@UnusedVariable
-		self.iren.AddObserver(gp.KEY_PRESS_EVENT, self._key_press_callback)
-		self.iren.Start()
+		timerId = self.interactor.CreateRepeatingTimer(gp.TIMER_PERIOD)
+		self.interactor.AddObserver(
+			gp.KEY_PRESS_EVENT, self._key_press_callback)
+		self.interactor.Start()
 
 	def restart_window(self):
 		# TODO: code according to start_window(), reset() and the desired behavior
 
 	def finalize_window(self):
 		"""Finalize and delete :attr:`renderer`, :attr:`render_window`
-		and :attr:`iren`.
+		and :attr:`interactor`.
 
 		.. seealso::
 			http://stackoverflow.com/questions/15639762/
 
 		"""
 		self.render_window.Finalize()
-		self.iren.TerminateApp()
+		self.interactor.TerminateApp()
 
-		# Instead of `del render_window, iren` as would be done in a script,
-		# this works too. Clearing `renderer` is not necessary to close
+		# Instead of `del render_window, interactor` as would be done in a
+		# script, this works too. Clearing `renderer` is not necessary to close
 		# the window, just a good practice.
 		self.renderer = None
 		self.render_window = None
-		self.iren = None
+		self.interactor = None
 
 	@staticmethod
 	def _update_pose(obj, pos, rot):
 		# remove all actors
 		try:
 			self.renderer.RemoveAllViewProps()
-			self.iren.ExitCallback()
+			self.interactor.ExitCallback()
 		except AttributeError:
 			pass
 		#self.restartWindow()