Mercurial > fife-parpg
view clients/editor/plugins/importer.py @ 170:f55979111ba1
- minor change to filebrowser - you now can specify the directory and the filename (!) of the xml file for the filebrowser
(previous one was hardcoded)
FEATURES:
- use guixmlpath="my_path_to/my_filebrowser.xml" as argument when creating a new filebrowser instance
NOTE:
- if you create your own filebrowser.xml, make sure to meet the names / widgets the browser needs to work
author | chewie@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 21 Jan 2009 15:35:44 +0000 |
parents | 4a0efb7baf70 |
children |
line wrap: on
line source
#!/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)