

class Interactor(object):
	"""
	Interactor
	"""

	def __init__(self):
		super(Interactor, self).__init__()

	def AddObserver(self, obj, eventName, callbackFunction):
		"""
		Creates a callback and stores the callback so that later
		on the callbacks can be properly cleaned up.
		"""
		if not hasattr(self, "_callbacks"):
			self._callbacks = []

		callback = obj.AddObserver(eventName, callbackFunction)
		self._callbacks.append((obj, callback))

	def cleanUpCallbacks(self):
		"""
		Cleans up the vtkCallBacks
		"""
		if not hasattr(self, "_callbacks"):
			return

		for obj, callback in self._callbacks:
			obj.RemoveObserver(callback)
		self._callbacks = []



class Interactor(object):
	"""
	Interactor
	"""

	def __init__(self):
		super(Interactor, self).__init__()

	def AddObserver(self, obj, eventName, callbackFunction, priority=None):
		"""
		Creates a callback and stores the callback so that later
		on the callbacks can be properly cleaned up.
		"""
		if not hasattr(self, "_callbacks"):
			self._callbacks = []

		if priority is not None:
			callback = obj.AddObserver(eventName, callbackFunction, priority)
		else:
			callback = obj.AddObserver(eventName, callbackFunction)
		self._callbacks.append((obj, callback))

	def cleanUpCallbacks(self):
		"""
		Cleans up the vtkCallBacks
		"""
		if not hasattr(self, "_callbacks"):
			return

		for obj, callback in self._callbacks:
			obj.RemoveObserver(callback)
		self._callbacks = []

Add possibility of passing priority for adding an observer
Add possibility of passing priority for adding an observer

  
  
  class Interactor(object):
  	"""
  	Interactor
  	"""
  
  	def __init__(self):
  		super(Interactor, self).__init__()
  
- 	def AddObserver(self, obj, eventName, callbackFunction):
+ 	def AddObserver(self, obj, eventName, callbackFunction, priority=None):
  		"""
  		Creates a callback and stores the callback so that later
  		on the callbacks can be properly cleaned up.
  		"""
  		if not hasattr(self, "_callbacks"):
  			self._callbacks = []
  
+ 		if priority is not None:
+ 			callback = obj.AddObserver(eventName, callbackFunction, priority)
+ 		else:
- 		callback = obj.AddObserver(eventName, callbackFunction)
+ 			callback = obj.AddObserver(eventName, callbackFunction)
  		self._callbacks.append((obj, callback))
  
  	def cleanUpCallbacks(self):
  		"""
  		Cleans up the vtkCallBacks
  		"""
  		if not hasattr(self, "_callbacks"):
  			return
  
  		for obj, callback in self._callbacks:
  			obj.RemoveObserver(callback)
  		self._callbacks = []
  
Add possibility of passing priority for adding an observer
## Code Before:


class Interactor(object):
	"""
	Interactor
	"""

	def __init__(self):
		super(Interactor, self).__init__()

	def AddObserver(self, obj, eventName, callbackFunction):
		"""
		Creates a callback and stores the callback so that later
		on the callbacks can be properly cleaned up.
		"""
		if not hasattr(self, "_callbacks"):
			self._callbacks = []

		callback = obj.AddObserver(eventName, callbackFunction)
		self._callbacks.append((obj, callback))

	def cleanUpCallbacks(self):
		"""
		Cleans up the vtkCallBacks
		"""
		if not hasattr(self, "_callbacks"):
			return

		for obj, callback in self._callbacks:
			obj.RemoveObserver(callback)
		self._callbacks = []

## Instruction:
Add possibility of passing priority for adding an observer
## Code After:


class Interactor(object):
	"""
	Interactor
	"""

	def __init__(self):
		super(Interactor, self).__init__()

	def AddObserver(self, obj, eventName, callbackFunction, priority=None):
		"""
		Creates a callback and stores the callback so that later
		on the callbacks can be properly cleaned up.
		"""
		if not hasattr(self, "_callbacks"):
			self._callbacks = []

		if priority is not None:
			callback = obj.AddObserver(eventName, callbackFunction, priority)
		else:
			callback = obj.AddObserver(eventName, callbackFunction)
		self._callbacks.append((obj, callback))

	def cleanUpCallbacks(self):
		"""
		Cleans up the vtkCallBacks
		"""
		if not hasattr(self, "_callbacks"):
			return

		for obj, callback in self._callbacks:
			obj.RemoveObserver(callback)
		self._callbacks = []
