def getAllObjectsMetadataIndexedByPath(self, path, ignored_exts=None, prefix=None): """ { u'/volume/toto' : {u'name': '/volume/toto', 'hash' : 'md5hash', 'last_modified': '', 'bytes': '193'} } """ logger.info("Building local file list & checksums") files_dict = {} files = generateTree(path) for file in files: file = normpath(file) if ignored_exts is not None: ignore_file = False for ign_ext in ignored_exts: if file.endswith(ign_ext): logger.debug("Ignoring file %s (based on extension)"%(file)) ignore_file = True continue if ignore_file: continue is_dir = os.path.isdir(file) if is_dir: md5_hash = None else: md5_hash = md5(file) file_metadata = { 'name': file, 'hash': md5_hash, 'last_modified': datetime.fromtimestamp(os.path.getmtime(file)), 'bytes': os.path.getsize(file), 'is_dir': is_dir } if prefix is not None: file_k = file.replace(prefix, "") files_dict[file_k] = file_metadata logger.info("Done %s files found"%len(files_dict)) return files_dict
if index_tup: return (self.HierList.get(index_tup[-1]).strip(), index) else: return ("", -99) def SetupGUi(self): self.BindAllHandlers() self.HierList.config(font=(props.FNAME, props.FSZ, props.FWT), foreground=props.FCOLOR, background=props.BCOLOR) self.Shell.config(font=(props.FNAME, props.FSZ, props.FWT), foreground=props.FCOLOR, background=props.BCOLOR) Root.geometry("%sx%s+%s+%s" % (props.WIDTH, props.HEIGHT, props.STARTX, props.STARTY)) insertTree(Ui.TreeViewModel) # # main Root = tk.Tk() Ui = JarlViewHierList(Root) Root.tkraise() # Ui.KeyBindings = {\ "COLLAPSE":props.COLLAPSE, "EXPAND":props.EXPAND, "EDIT":props.EDIT } Ui.TreeViewModel = utils.generateTree(5, 4) Ui.IndexMap = [] # Ui.SetupGUi() # # Run the program interface Root.mainloop()