Commits

German Larrain committed daab603

graphics.base.Engine._update_pose: changed it to class method (instead of static),
making it "abstract" with the same workaround used in collision.base.Engine.

Comments (0)

Files changed (2)

ars/graphics/base.py

 	def reset(self):
 		pass
 
-	@staticmethod
-	@abstractmethod
-	def _update_pose(obj, pos, rot):
-		pass
+	@classmethod
+	def _update_pose(cls, obj, pos, rot):
+		# Raising an exception efectively makes this definition be that of
+		# an abstract method (i.e. calling it directly raises an exception),
+		# except that it not requires the subclass to implement it if it is
+		# not used. We would like to use @classmethod AND @abstractmethod,
+		# but until Python 3.3 that doesn't work correctly.
+		# http://docs.python.org/3/library/abc.html
+		raise NotImplementedError()
 
 
 class ScreenshotRecorder(object):

ars/graphics/vtk_adapter.py

 		self.render_window = None
 		self.interactor = None
 
-	@staticmethod
-	def _update_pose(obj, pos, rot):
+	@classmethod
+	def _update_pose(cls, obj, pos, rot):
 		trans = gemut.Transform(pos, rot)
-		vtk_tm = Engine._create_transform_matrix(trans)
-		Engine._set_object_transform_matrix(obj, vtk_tm)
+		vtk_tm = cls._create_transform_matrix(trans)
+		cls._set_object_transform_matrix(obj, vtk_tm)
 
 	def _timer_callback(self, obj, event):
 		self.timer_count += 1