def execute(self, path, action): filer = widgets.filer trashbox = os.path.expanduser(self.path) msg = path.replace(filer.dir.path, "") ret = message.confirm("Move `{0}' to trashbox? ".format(msg), ["No", "Yes"]) if ret == "Yes": filectrl.move(path, trashbox) filer.workspace.all_reload()
def execute(self, path, action): filer = widgets.filer if filer.dir.ismark(): filectrl.move(filer.dir.get_mark_files(), path) elif self.src is None: if not path: return self.src = path return (filer.workspace.nextdir.path, -1) else: filectrl.move(self.src, path)
def _trashbox(): """Invoke command line of trashbox mode.""" filer = widgets.filer cmdline = widgets.cmdline trashbox = os.path.expanduser(mode.TrashBox.path) if not os.path.exists(trashbox): if "Yes" == message.confirm("Trashbox doesn't exist. Make trashbox? ({0}):".format(trashbox), ["No", "Yes"]): try: os.makedirs(trashbox) except Exception as e: return message.exception(e) else: return if filer.dir.ismark(): files = filer.dir.get_mark_files() ret = message.confirm("Move mark files to trashbox? ", ["No", "Yes"], files) if ret == "Yes": filectrl.move(files, trashbox) else: cmdline.start(mode.TrashBox(), filer.file.name)