German Larrain avatar 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
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.