Example #1
0
 def __init__(self, path):
     JobThread.__init__(self)
     if isinstance(path, list):
         self.title = "Delete: mark files"
         self.path = [util.abspath(f) for f in path]
     else:
         path = util.abspath(path)
         self.title = "Delete: {0}".format(path)
         self.path = [path]
Example #2
0
 def __init__(self, src, dstdir):
     JobThread.__init__(self)
     if isinstance(src, list):
         self.title = "Unzip: mark files -> {0}".format(dstdir)
         self.src = [util.abspath(f) for f in src]
     else:
         self.title = "Unzip: {0} -> {1}".format(src, dstdir)
         self.src = [util.abspath(src)]
     self.dstdir = util.abspath(dstdir)
     self.dirlist = []
Example #3
0
 def __init__(self, src, dst):
     JobThread.__init__(self)
     self.dst = util.abspath(dst)
     if dst.endswith(os.sep):
         self.dst += os.sep
     if isinstance(src, list):
         self.title = "Move: mark files -> {0}".format(self.dst)
         self.src = [util.abspath(f) for f in src]
     else:
         src = util.abspath(src)
         self.title = "Move: {0} -> {1}".format(src, self.dst)
         self.src = [src]
Example #4
0
 def __init__(self, src, dst, wrap=""):
     JobThread.__init__(self)
     if not dst.endswith(".zip"):
         dst += ".zip"
     self.dst = util.abspath(dst)
     if isinstance(src, list):
         self.title = "Zip: mark files -> {0}".format(dst)
         self.src = [util.abspath(f) for f in src]
         self.src_dirname = util.U(os.getcwd()) + os.sep
     else:
         self.title = "Zip: {0} -> {1}".format(src, dst)
         self.src = [util.abspath(src)]
         self.src_dirname = util.unix_dirname(self.src[0]) + os.sep
     self.wrap = wrap
Example #5
0
    def chdir(self, path):
        parpath = util.unix_dirname(self.path)
        parfile = util.unix_basename(self.path)
        newpath = util.abspath(util.expanduser(path), self.path)
        if newpath == self.path:
            return

        self.list = None
        self.list_title = None
        if self.finder.active:
            self.finder.finish()
        self.mark_clear()

        try:
            os.chdir(newpath)
        except Exception as e:
            return message.exception(e)
        self.history.update(newpath)
        self.path = newpath
        self.diskread()
        self.sort()
        if self.path == parpath:
            self.setcursor(self.get_index(parfile))
        else:
            self.setcursor(0)
Example #6
0
 def __init__(self, src, dst, tarmode="gzip", wrap=""):
     JobThread.__init__(self)
     self.update("Reading...")
     ext = self.tarexts[tarmode]
     if not dst.endswith(ext):
         dst += ext
     self.dst = util.abspath(dst)
     if isinstance(src, list):
         self.title = "Tar: mark files -> {0}".format(dst)
         self.src = [util.abspath(f) for f in src]
         self.src_dirname = util.U(os.getcwd()) + os.sep
     else:
         self.title = "Tar: {0} -> {1}".format(src, dst)
         self.src = [util.abspath(src)]
         self.src_dirname = util.unix_dirname(self.src[0]) + os.sep
     self.tarmode = tarmode
     self.wrap = wrap
Example #7
0
 def __init__(self, path, height, width, begy, begx):
     self.screen = Screen(height, width, begy, begx)
     self.screen.attr = look.colors["Window"]
     self.screen.create_window()
     self.path = util.abspath(path)
     self.files = [FileStat(os.pardir)]
     self.mark_files = set()
     self.mark_size = "0"
     self.cursor = 0
     self.scrolltop = 0
     self.maskreg = None
     self.list = None
     self.list_title = None
     self.finder = Finder(self)
     self.pager = Pager(self)
     self.history = PathHistory(self)
Example #8
0
 def _update_completion_path(self):
     def _dirname(path_):
         if path_.endswith(os.sep):
             return path_
         else:
             dname = os.path.dirname(path_)
             if dname.endswith(os.sep) or not dname:
                 return dname
             else:
                 return dname + os.sep
     path = self.parser.part[1]
     if issubclass(self.__class__, ShellCompletionFunction) and \
             not self.parser.now_in_quote():
         self.parser.part[0] += _dirname(util.string_to_safe(path))
     else:
         self.parser.part[0] += _dirname(path)
     bname = os.path.basename(path)
     dpath = os.path.expanduser(util.abspath(os.path.dirname(path)))
     self.parser.part[1] = bname
     return (bname, dpath)