def set_root(self, root_fn): if self._root.get_n_children(): self.emit("rf-directory-tree-remove-node", tree_dir_path_to_string( self._root.get_nth_child(0).get_path_tuple() )) root = DirectoryTreeNode(root_fn, self._root) self._root.child_list = [root] self.set_cur_node(root) self.emit("rf-directory-tree-add-node", tree_dir_path_to_string(root.get_path_tuple())) self.get_cur_node().set_expanded() for line in get_ftp().list_current_dir().split("\n"): if not line: continue fn = filenode_new_from_line(line) self.append_child_fn(fn)
def _func(self, *args, **kwargs): node = kwargs.get("node", None) if not node: path = kwargs.get("path", None) if path: node = self.get_node(path) else: node = self.cur_node if "node" in kwargs: del kwargs["node"] if "path" in kwargs: del kwargs["path"] ret_node = func(self, node, *args, **kwargs) self.emit(emit_signal, tree_dir_path_to_string(ret_node.get_path_tuple()))
def set_cur_node(self, node): self.cur_node = node get_ftp().change_dir(dir_tuple_to_path(node.get_dir_tuple())) self.emit("rf-directory-tree-current-node-changed", tree_dir_path_to_string(node.get_path_tuple()))