Commits

German Larrain  committed 54d827a

VtkAdapter.start_window: reordered some statements; added comments.

  • Participants
  • Parent commits 550793c

Comments (0)

Files changed (1)

File ars/graphics/adapters.py

 		self.on_reset_parent_callback = on_reset_callback
 		self.on_key_press_parent_callback = on_key_press_callback
 
-		# create a rendering window and RenderWindowInteractor
+		# Create the RenderWindow and the RenderWindowInteractor and
+		# link between them and the Renderer.
 		self.render_window = vtk.vtkRenderWindow()
+		self.interactor = vtk.vtkRenderWindowInteractor()
 		self.render_window.AddRenderer(self.renderer)
-		self.interactor = vtk.vtkRenderWindowInteractor()
-		self.interactor.SetInteractorStyle(
-			vtk.vtkInteractorStyleTrackballCamera())
 		self.interactor.SetRenderWindow(self.render_window)
 
 		# set properties
 		self.renderer.SetBackground(self._background_color)
 		self.render_window.SetSize(*self._size)
 		self.render_window.SetWindowName(self._title)
+		self.interactor.SetInteractorStyle(
+			vtk.vtkInteractorStyleTrackballCamera())
 
+		# create and configure a Camera, and set it as renderer's active one
 		camera = vtk.vtkCamera()
 		camera.SetPosition(self._cam_position)
 		camera.Zoom(self._zoom)
 		self.renderer.SetActiveCamera(camera)
+
 		self.render_window.Render()
 
+		# add observers to the RenderWindowInteractor
 		self.interactor.AddObserver(gp.TIMER_EVENT, self._timer_callback)
 		#noinspection PyUnusedLocal
 		timerId = self.interactor.CreateRepeatingTimer(gp.TIMER_PERIOD)