def createKupuEditor(parent, filepath, id=None): """Adds either a DirectoryView or a derivative object. """ info = _dirreg.getDirectoryInfo(filepath) if info is None: raise ValueError('Not a registered directory: %s' % filepath) if not id: id = path.split(filepath)[-1] else: id = str(id) ob = KupuEditor(id, filepath) parent._setObject(id, ob)
def __of__(self, parent): info = _dirreg.getDirectoryInfo(self._dirpath) if info is not None: info = info.getContents(_dirreg) if info is None: data = {} objects = () else: data, objects = info s = KupuEditorSurrogate(self, data, objects) res = s.__of__(parent) return res