Esempio n. 1
0
 def factory(fs, db, parent):
     fileobj = fs if fs is not None else db
     name = fileobj.relpath or fileobj.fullpath if fileobj else '<path not found in filesystem or database>'
     if parent is None:
         progress = ProgressTree(name=name)
         maxlen = lambda s: util.trim_to_maxlen(50, s)
         progress.reporter = ProgressReporter(lvl=1, namefmt=maxlen)
     else:
         progress = parent.progress.spawnchild(name)
     return Item(fs, db, parent, progress)
Esempio n. 2
0
 def factory(fs, db, parent):
     fileobj = fs if fs is not None else db
     name = fileobj.relpath or fileobj.fullpath if fileobj else '<path not found in filesystem or database>'
     if parent is None:
         progress = ProgressTree(name=name)
         maxlen = lambda s: util.trim_to_maxlen(50, s)
         progress.reporter = ProgressReporter(lvl=1, namefmt=maxlen)
     else:
         progress = parent.progress.spawnchild(name)
     return Item(fs, db, parent, progress)