changeset 401:ac7806c46b94

* Fixed a crash when opening two maps and closing them * Fixed a bug where closing the first map would destroy all cameras
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 28 Jan 2010 22:47:20 +0000
parents ef0c7a0cacab
children bc6730a27820
files tools/editor/scripts/editor.py tools/editor/scripts/mapview.py
diffstat 2 files changed, 6 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py	Thu Jan 28 21:50:12 2010 +0000
+++ b/tools/editor/scripts/editor.py	Thu Jan 28 22:47:20 2010 +0000
@@ -176,6 +176,8 @@
 		self._initActions()
 		
 		self._toolbox.show()
+		
+		events.preMapClosed.connect(self._mapRemoved)
 
 	def _initActions(self):
 		""" Initializes toolbar and menubar buttons """
@@ -344,14 +346,11 @@
 		
 		self.showMapView(mapview)
 		
-		events.preMapClosed.connect(self._mapRemoved)
 		events.mapAdded.send(sender=self, map=map)
 		
 		return mapview
 		
 	def _mapRemoved(self, mapview):
-		events.preMapClosed.disconnect(self._mapRemoved)
-		
 		index = self._mapviewlist.index(mapview)-1
 		self._mapviewlist.remove(mapview)
 		
@@ -362,7 +361,9 @@
 				break
 				
 		# Change mapview
-		if index >= 0:
+		if len(self._mapviewlist) > 0:
+			if index < 0: 
+				index = 0
 			self.showMapView(self._mapviewlist[index])
 		else:
 			self._mapview = None
--- a/tools/editor/scripts/mapview.py	Thu Jan 28 21:50:12 2010 +0000
+++ b/tools/editor/scripts/mapview.py	Thu Jan 28 22:47:20 2010 +0000
@@ -149,7 +149,7 @@
 		for cam in view.getCameras():
 			if cam.getLocationRef().getMap().getId() == self._map.getId():
 				cam.setEnabled(False)
-				#view.removeCamera(cam)
+				view.removeCamera(cam)
 		view.resetRenderers()
 		
 		# Unload the map from FIFE