diff tools/editor/scripts/editor.py @ 402:bc6730a27820

* Fixed a bug where the editor would not activate the new mapview after closing a map * Fixed a crash caused by not all cameras belonging to a map being removed
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 29 Jan 2010 10:55:21 +0000
parents ac7806c46b94
children 9d94f4676d17
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py	Thu Jan 28 22:47:20 2010 +0000
+++ b/tools/editor/scripts/editor.py	Fri Jan 29 10:55:21 2010 +0000
@@ -86,6 +86,8 @@
 		self._tools_menu = None
 		self._help_menu = None
 		
+		self._change_map = -1
+		
 		self._settings = None
 		
 		self._help_dialog = None
@@ -317,7 +319,7 @@
 		""" Switches to mapview. """
 		if mapview is None or mapview == self._mapview:
 			return
-			
+		
 		events.preMapShown.send(sender=self, mapview=mapview)
 		self._mapview = mapview
 		self._mapview.show()
@@ -364,7 +366,7 @@
 		if len(self._mapviewlist) > 0:
 			if index < 0: 
 				index = 0
-			self.showMapView(self._mapviewlist[index])
+			self._change_map = index
 		else:
 			self._mapview = None
 			self.getEngine().getView().clearCameras()
@@ -405,6 +407,16 @@
 			self._initTools()
 			if self._params: self.openFile(self._params)
 			self._inited = True
+			
+		# FIXME: This isn't very nice, but it is needed to change the map
+		#		 outside the callback.
+		if self._change_map >= 0 and len(self._mapviewlist) > 0:
+			if self._change_map >= len(self._mapviewlist):
+				self._change_map = len(self._mapviewlist)-1
+			mapview = self._mapviewlist[self._change_map]
+			
+			self.showMapView(mapview)
+			self._change_map = -1
 		
 		events.onPump.send(sender=self)