Mercurial > fife-parpg
diff clients/editor/plugins/importer.py @ 0:4a0efb7baf70
* Datasets becomes the new trunk and retires after that :-)
author | mvbarracuda@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Sun, 29 Jun 2008 18:44:17 +0000 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/clients/editor/plugins/importer.py Sun Jun 29 18:44:17 2008 +0000 @@ -0,0 +1,32 @@ +#!/usr/bin/env python +# coding: utf-8 +# Plugin for the editor. See fifedit.py. Importer presents a directory browser for finding and importing data files. + +import plugin +import filebrowser +from loaders import loadImportFile +from loaders import loadImportDirRec + +class Importer(plugin.Plugin): + def __init__(self, engine): + super(Importer,self).__init__() + self.engine = engine + + self.filebrowser = filebrowser.FileBrowser(engine,self._select,selectdir=True) + + self.menu_items = { + 'Import Objects' : self.filebrowser.showBrowser, + } + + self.newImport = None + self.importList = [] + + def addDirs(self, dirs): + self.importList.extend(dirs) + + def _select(self,path,filename=None): + if filename: + self.newImport = loadImportFile('/'.join([path, filename]), self.engine) + else: + self.importList.append(path) + loadImportDirRec(path, self.engine)