comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:4a0efb7baf70
1 #!/usr/bin/env python
2 # coding: utf-8
3 # Plugin for the editor. See fifedit.py. Importer presents a directory browser for finding and importing data files.
4
5 import plugin
6 import filebrowser
7 from loaders import loadImportFile
8 from loaders import loadImportDirRec
9
10 class Importer(plugin.Plugin):
11 def __init__(self, engine):
12 super(Importer,self).__init__()
13 self.engine = engine
14
15 self.filebrowser = filebrowser.FileBrowser(engine,self._select,selectdir=True)
16
17 self.menu_items = {
18 'Import Objects' : self.filebrowser.showBrowser,
19 }
20
21 self.newImport = None
22 self.importList = []
23
24 def addDirs(self, dirs):
25 self.importList.extend(dirs)
26
27 def _select(self,path,filename=None):
28 if filename:
29 self.newImport = loadImportFile('/'.join([path, filename]), self.engine)
30 else:
31 self.importList.append(path)
32 loadImportDirRec(path, self.engine)