comparison tools/editor/scripts/gui/filemanager.py @ 680:60621d858548

* Fixed the image/animation functions in GenericRenderer and LightRenderer. The functions now consider the camera zoom level. * Added the forgotten LightEdit plugin for the editor.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 21 Nov 2010 15:58:14 +0000
parents 64738befdf3b
children
comparison
equal deleted inserted replaced
679:49fb0370f8e1 680:60621d858548
24 import os, math, traceback, sys 24 import os, math, traceback, sys
25 from fife import fife 25 from fife import fife
26 from fife.extensions import pychan 26 from fife.extensions import pychan
27 from fife.extensions import filebrowser 27 from fife.extensions import filebrowser
28 from fife.extensions import loaders, savers 28 from fife.extensions import loaders, savers
29 from fife.extensions.serializers.xmlobject import XMLObjectLoader
30 from fife.extensions.serializers.xml_loader_tools import loadImportFile, loadImportDir, loadImportDirRec
29 import action 31 import action
30 import scripts.editor 32 import scripts.editor
31 import fife.extensions.pychan.widgets as widgets 33 import fife.extensions.pychan.widgets as widgets
32 from fife.extensions.pychan.tools import callbackWithArguments as cbwa 34 from fife.extensions.pychan.tools import callbackWithArguments as cbwa
33 from scripts.gui.error import ErrorDialog 35 from scripts.gui.error import ErrorDialog
50 self._cameradlg = None 52 self._cameradlg = None
51 53
52 self._filebrowser = None 54 self._filebrowser = None
53 self._importbrowser = None 55 self._importbrowser = None
54 self._savebrowser = None 56 self._savebrowser = None
57
58 self.obj_loader = XMLObjectLoader(
59 self.engine.getImagePool(),
60 self.engine.getAnimationPool(),
61 self.engine.getModel(),
62 self.engine.getVFS()
63 )
55 64
56 newAction = Action(u"New map", "gui/icons/new_map.png") 65 newAction = Action(u"New map", "gui/icons/new_map.png")
57 loadAction = Action(u"Open", "gui/icons/load_map.png") 66 loadAction = Action(u"Open", "gui/icons/load_map.png")
58 closeAction = Action(u"Close", "gui/icons/close_map.png") 67 closeAction = Action(u"Close", "gui/icons/close_map.png")
59 saveAction = Action(u"Save", "gui/icons/save_map.png") 68 saveAction = Action(u"Save", "gui/icons/save_map.png")
212 # path separators. 221 # path separators.
213 file = file.replace('\\', '/') 222 file = file.replace('\\', '/')
214 223
215 try: 224 try:
216 if os.path.isfile(file): 225 if os.path.isfile(file):
217 loaders.loadImportFile(file, self.engine) 226 loadImportFile(self.obj_loader, file, self.engine)
218 else: 227 else:
219 raise file+ " is not a file!" 228 raise file+ " is not a file!"
220 except: 229 except:
221 traceback.print_exc(sys.exc_info()[1]) 230 traceback.print_exc(sys.exc_info()[1])
222 errormsg = u"Importing file failed:\n" 231 errormsg = u"Importing file failed:\n"
237 # path separators. 246 # path separators.
238 path = path.replace('\\', '/') 247 path = path.replace('\\', '/')
239 248
240 try: 249 try:
241 if os.path.isdir(path): 250 if os.path.isdir(path):
242 loaders.loadImportDirRec(path, self.engine) 251 loadImportDirRec(self.obj_loader, path, self.engine)
243 else: 252 else:
244 raise file+ " is not a directory!" 253 raise file+ " is not a directory!"
245 except: 254 except:
246 traceback.print_exc(sys.exc_info()[1]) 255 traceback.print_exc(sys.exc_info()[1])
247 errormsg = u"Importing directory failed:\n" 256 errormsg = u"Importing directory failed:\n"