| Home | Trees | Indices | Help |
|---|
|
|
1 # -*- coding: utf-8 -*-
2 # ####################################################################
3 # Copyright (C) 2005-2010 by the FIFE team
4 # http://www.fifengine.de
5 # This file is part of FIFE.
6 #
7 # FIFE is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the
19 # Free Software Foundation, Inc.,
20 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 # ####################################################################
22
23 """ Savers plugin manager """
24
25 import os.path
26
27 from fife import fife
28 from fife.extensions.serializers.xmlmapsaver import XMLMapSaver
29
30 mapFileMapping = { 'xml' : XMLMapSaver}
31 fileExtensions = ('xml',)
32
34 """ save map file
35 @type path: string
36 @param path: The fully qualified path to the file to save
37 @type engine: object
38 @param engine: FIFE engine instance
39 @type map: object
40 @param map: FIFE map object
41 @type importList: list
42 @param importList: A list of all imports
43 @type debug: boolean
44 @param debug: Enables debugging information
45 """
46 (filename, extension) = os.path.splitext(path)
47 map.setFilename(path)
48 map_saver = mapFileMapping[extension[1:]](path, engine, map, importList)
49
50 map_saver.saveResource()
51 if debug: print "--- Saved Map."
52 return map
53
55 """Add a new saver for fileextension
56 @type fileExtension: string
57 @param fileExtension: The file extension the saver is registered for
58 @type saverClass: object
59 @param saverClass: A fife.ResourceLoader implementation that saves maps
60 from files with the given fileExtension
61 """
62 mapFileMapping[fileExtension] = saverClass
63 _updateMapFileExtensions()
64
68
| Home | Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Tue May 22 00:00:35 2012 | http://epydoc.sourceforge.net |