def create(app, cwd = ''): import os t = Tab(app) if cwd == '': d = Dir.create(t, os.getcwd()) else: d = Dir.create(t, cwd) if d is None: d = Dir.create(t) t.wd = [d] t.curwd = 0 return t
def goto_path(self, path): d = Dir.create(self, path) if d: self.wd[self.curwd].winexit() self.wd.append(d) self.curwd = len(self.wd) - 1 self.wd[self.curwd].wininit() else: self.getapp().UI.err("Failed to open %s" % (path,))
def open_dir(self, new_tab = False): curdir = self.wd[self.curwd] d = curdir.dentry() if d.isdir(): newd = Dir.create(self, d.path()) if newd: curdir.winexit() self.wd = self.wd[:self.curwd + 1] + [newd] self.curwd = self.curwd + 1 newd.wininit() else: self.getapp().UI.err("Failed to open %s" % (d.path(),))
def up(self, count = 1): import os.path curd = self.wd[self.curwd].path() if curd != '/': for i in range(count): curd = new = os.path.dirname(curd) d = Dir.create(self, new) if d: self.wd[self.curwd].winexit() self.wd = self.wd[:self.curwd+1] + [d] self.curwd = self.curwd + 1 self.wd[self.curwd].wininit() else: self.getapp().UI.err("Failed to open %s" % (new,))
def __reinittab(self): d = Dir.create(self) self.wd = [d] self.curwd = 0