diff clients/editor/run.py @ 255:51cc05d862f2

Merged editor_rewrite branch to trunk. This contains changes that may break compatibility against existing clients. For a list of changes that may affect your client, see: http://wiki.fifengine.de/Changes_to_pychan_and_FIFE_in_editor_rewrite_branch
author cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222
date Mon, 08 Jun 2009 16:00:02 +0000
parents bcc93e17f978
children 8b125ec749d7
line wrap: on
line diff
--- a/clients/editor/run.py	Wed Jun 03 19:29:52 2009 +0000
+++ b/clients/editor/run.py	Mon Jun 08 16:00:02 2009 +0000
@@ -13,105 +13,9 @@
 		sys.path.append(_jp(p))
 
 import fife
-import fifelog
 import basicapplication
-import pychan
-import pychan.widgets as widgets
-import sys
-
-from listener import EditorListener
-
-from plugins.plugin import Plugin
-from plugins.maploader import MapLoader
-from plugins.maploader import MapSaver
-from plugins.importer import Importer
-from plugins.mapeditor import MapEditor
-from plugins.mapwizard import MapWizard
-from fifedit import Fifedit
-
-# zero-projekt plugins
-from plugins.objectedit import ObjectEdit
-from plugins.layertool import LayerTool
-
-
-# Help display
-class Help(Plugin):
-	def __init__(self):
-		self._helpWidget = None	
-		self.menu_items = { 'Help' : self.showHelp }
-
-	def showHelp(self):
-		if self._helpWidget:
-			self._helpWidget.show()
-			return
-		self._helpWidget = pychan.loadXML('gui/help.xml')
-		self._helpWidget.mapEvents({ 'closeButton' : self._helpWidget.hide })
-		self._helpWidget.distributeData({ 'helpText' : open("misc/infotext.txt").read() })
-		self._helpWidget.show()
-
-class Editor(basicapplication.ApplicationBase):
-	def __init__(self, params):
-		super(Editor,self).__init__()
-
-		# embed Fifedit tools
-		self.fifedit = Fifedit(self.engine)
-
-		# Create this client's modules
-		self.mapedit = MapEditor(self.engine)
-		self.maploader = MapLoader(self.engine)
-		self.mapsaver = MapSaver(self.engine)
-		self.mapwizard = MapWizard(self.engine)
-		self.importer = Importer(self.engine)
-
-		# zero-projekt plugins
-		self.objectedit = ObjectEdit(self.engine, self.mapedit)
-		self.layertool = LayerTool(self.engine, self.mapedit)
-
-		# Register plugins with Fifedit.
-		self.fifedit.registerPlugin(Help())
-		self.fifedit.registerPlugin(self.maploader)
-		self.fifedit.registerPlugin(self.mapsaver)
-		self.fifedit.registerPlugin(self.mapedit)
-		self.fifedit.registerPlugin(self.mapwizard)
-		self.fifedit.registerPlugin(self.importer)
-
-		# zero-projekt plugins
-		self.fifedit.registerPlugin(self.objectedit)
-		self.fifedit.registerPlugin(self.layertool)
-			
-		self.params = params
-
-	def createListener(self):
-		# override default event listener
-		return EditorListener(self)
-
-	def _pump(self):
-		self.mapedit.pump()
-		if self.maploader.newMap:
-			self.mapedit.editMap(self.maploader.newMap.getId())	
-			self.importer.addDirs(self.maploader.newMap.importDirs)
-			self.maploader.newMap = None
-		if self.mapwizard.newMap:
-			self.mapedit.editMap(self.mapwizard.map.getId())
-			self.mapwizard.newMap = False
-		if self.mapsaver.saveRequested:
-			if self.mapedit._map:
-				self.mapsaver.saveMap(self.mapedit._map,self.importer.importList)
-			else:
-				print "Cannot save, map doesn't exist"
-			self.mapsaver.saveRequested = False
-		if not self.fifedit.active: 
-			self.quitRequested = True
-		if self.params:
-			s = os.path.sep
-			parts = self.params.split(s)
-			self.maploader.loadFile(s.join(parts[0:-1]), parts[-1])
-			self.params = None
-
-		# zero-projekt plugins
-		if self.mapedit._instances is not None:
-			self.objectedit.input()
-
+import scripts
+from scripts.editor import Editor
 
 if __name__ == '__main__':
 	print sys.argv