def _setup_root_model(self): pixbuf = icon.guess_from_path(self.dir, 24) iter = self.model.append(None, (pixbuf, os.path.basename(self.dir), self.dir, False)) return iter
def __setup_root_model(self): iter = self.model.append(None) pixbuf = icon.guess_from_path(self.dir, 24) self.model.set(iter, DIR_ICON, pixbuf, DIR_TITLE, os.path.basename(self.dir), DIR_PATH, self.dir, DIR_EDITABLE, False) return iter
def do_update_model(self, dir, iter): for item in os.listdir(dir): fullname = os.path.join(dir, item) pixbuf = icon.guess_from_path(fullname, 24) child_iter = self.model.append(iter, (pixbuf, os.path.basename(fullname), fullname, False)) if os.path.isdir(fullname): self.do_update_model(fullname, child_iter)
def do_update_model(self, dir, iter): for item in os.listdir(dir): fullname = os.path.join(dir, item) pixbuf = icon.guess_from_path(fullname, 24) child_iter = self.model.append(iter) self.model.set(child_iter, DIR_ICON, pixbuf, DIR_TITLE, os.path.basename(fullname), DIR_PATH, fullname, DIR_EDITABLE, False) if os.path.isdir(fullname): self.do_update_model(fullname, child_iter)
def do_update_model(self, dir, iter): for item in os.listdir(dir): fullname = os.path.join(dir, item) pixbuf = icon.guess_from_path(fullname) child_iter = self.model.append( iter, (pixbuf, os.path.basename(fullname), fullname, False)) if os.path.isdir(fullname): self.do_update_model(fullname, child_iter) else: if not os.access(fullname, os.X_OK): try: os.chmod(fullname, stat.S_IRWXU) except: pass
def do_update_model(self, dir, iter): for item in os.listdir(dir): fullname = os.path.join(dir, item) pixbuf = icon.guess_from_path(fullname) child_iter = self.model.append(iter, (pixbuf, os.path.basename(fullname), fullname, False)) if os.path.isdir(fullname): self.do_update_model(fullname, child_iter) else: if not os.access(fullname, os.X_OK): try: os.chmod(fullname, stat.S_IRWXU) except: pass
def update_model(self): self.model.clear() dir = self.dir self.exist_lsit = [] if self.exclude_dir: for root, dirs, files in os.walk(self.exclude_dir): if files: self.exist_lsit.extend(files) for item in os.listdir(dir): fullname = os.path.join(dir, item) title = os.path.basename(fullname) if title in self.exist_lsit: continue pixbuf = icon.guess_from_path(fullname, 24) self.model.append((pixbuf, title, fullname))
def get_icon(self): return icon.guess_from_path(self.get_path())