diff clients/editor/scripts/mapview.py @ 324:e249fa887259

* Split EventListener into several internal subclasses. This fixes issue with multiple inheritance where each BaseClass.__init__() call would overwrite the previous one. This meant that you could only add EventListener to one type of event managers. * MapView now adds maps and layers to EventListener * LayerEditor should now fetch only NameClash exceptions when creating or editing layers
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 21 Aug 2009 14:39:54 +0000
parents 7ddec4ce99b3
children 8b125ec749d7
line wrap: on
line diff
--- a/clients/editor/scripts/mapview.py	Tue Aug 18 18:03:54 2009 +0000
+++ b/clients/editor/scripts/mapview.py	Fri Aug 21 14:39:54 2009 +0000
@@ -21,9 +21,19 @@
 			if not self._map.getLayers():
 				raise AttributeError('Editor error: map ' + self._map.getId() + ' has no layers. Cannot edit.')
 
+			map.addChangeListener(self._editor.getEventListener().mapchangelistener)
+			for layer in map.getLayers():
+				layer.addChangeListener(self._editor.getEventListener().layerchangelistener)
+				
+			events.onLayerCreate.connect(self._layerCreated)
+
 		self.importlist = []
 		if hasattr(map, "importDirs"):
 			self.importlist.extend(map.importDirs)
+			
+	def _layerCreated(self, map, layer):
+		if map.getId() == self._map.getId():
+			layer.addChangeListener(self._editor.getEventListener().layerchangelistener)
 		
 	# Copied from mapeditor.py
 	def show(self):