def prompt_ignore(self, ig, path, cb):
     ignore.create_flooignore(ig.path)
     dirs = ig.get_children()
     dirs.append(ig)
     dirs = sorted(dirs, key=attrgetter('size'))
     size = starting_size = reduce(lambda x, c: x + c.size, dirs, 0)
     too_big = []
     while size > MAX_WORKSPACE_SIZE and dirs:
         cd = dirs.pop()
         size -= cd.size
         too_big.append(cd)
     if size > MAX_WORKSPACE_SIZE:
         editor.error_message(
             'Maximum workspace size is %.2fMB.\n\n%s is too big (%.2fMB) to upload. Consider adding stuff to the .flooignore file.' %
             (MAX_WORKSPACE_SIZE / 1000000.0, path, ig.size / 1000000.0))
         cb([set(), 0])
         return
     if too_big:
         txt = TOO_BIG_TEXT % (MAX_WORKSPACE_SIZE / 1000000.0, path, starting_size / 1000000.0, "\n".join(set([x.path for x in too_big])))
         upload = yield self.ok_cancel_dialog, txt
         if not upload:
             cb([set(), 0])
             return
     files = set()
     for ig in dirs:
         files = files.union(set([utils.to_rel_path(x) for x in ig.files]))
     cb([files, size])
Exemple #2
0
 def prompt_ignore(self, ig, path, cb):
     ignore.create_flooignore(ig.path)
     dirs = ig.get_children()
     dirs.append(ig)
     dirs = sorted(dirs, key=attrgetter('size'))
     size = starting_size = reduce(lambda x, c: x + c.size, dirs, 0)
     too_big = []
     while size > MAX_WORKSPACE_SIZE and dirs:
         cd = dirs.pop()
         size -= cd.size
         too_big.append(cd)
     if size > MAX_WORKSPACE_SIZE:
         editor.error_message(
             'Maximum workspace size is %.2fMB.\n\n%s is too big (%.2fMB) to upload. Consider adding stuff to the .flooignore file.'
             % (MAX_WORKSPACE_SIZE / 1000000.0, path, ig.size / 1000000.0))
         cb([set(), 0])
         return
     if too_big:
         txt = TOO_BIG_TEXT % (MAX_WORKSPACE_SIZE / 1000000.0, path,
                               starting_size / 1000000.0, "\n".join(
                                   set([x.path for x in too_big])))
         upload = yield self.ok_cancel_dialog, txt
         if not upload:
             cb([set(), 0])
             return
     files = set()
     for ig in dirs:
         files = files.union(set([utils.to_rel_path(x) for x in ig.files]))
     cb([files, size])