def _load_sub_directory(self, app, dir_name, filenames): """ Create the tree menu for a given directory full name """ for filename in filenames: path = os.path.join(dir_name, filename) path = os.path.abspath(path) if self.hidden_file_pattern.match(path): continue if os.path.isdir(path) or self.item_filter(path): item = MenuItem(short_name=os.path.basename(path)) if os.path.isdir(path): icon_path = self.folder_icon_path else: icon_path = self.item_icon_path or path item.set_action_callback(self.item_action) item.set_focus_callback(self.item_focus) item.set_target_path(path) item.set_icon_path(icon_path) if self.item_filter(path) and self.action_menu: self.action_menu(item) master = self.get_master_plugin() parent = master.get_item_with_target(os.path.dirname(path)) if not parent: parent = master parent.add_item(item)