Esempio n. 1
0
 def step_test(tree):
     node = walk_step(tree, tree.root)
     prev_node = node
     while True:
         if node is None:
             node = prev_node
         else:
             prev_node = node
         print node.path
         c = getch()
         if c == 'q':
             break
         elif c == 'j': node = walk_step(tree, node, 'next')
         elif c == 'k': node = walk_step(tree, node, 'prev')
         elif '0' <= c <= '9': 
             nth_node = tree.root.ls[int(c)]
             node = walk_step(tree, nth_node) # start from the nth directory (simulate jumping to a chapter)
         if node is None:
             print "|---- end ----|"
             continue
     print "broke out of loop!"
Esempio n. 2
0
    def __init__(self, root):
        """ Partial directory view that can be moved around (can't be resized
            yet, though that might be useful)

            This works internally by storing a node list an using an image
            cache to get the image corresponding to a certain node

            @param root: the manga root directory
        """
        self.tree = fetch.DirTree(root)
        self.nodes = []
        self.img_cache = ImageCache()
        first_node = walk_step(self.tree, self.tree.root)
        if first_node is None:
            raise EmptyMangaException
        self._reset_window_to_node(first_node)
Esempio n. 3
0
 def prev_item(self, path):
     node = self.get_node(path)
     return walk_step(self, node, 'prev')
Esempio n. 4
0
 def next_item(self, path):
     node = self.get_node(path)
     return walk_step(self, node, 'next')
Esempio n. 5
0
 def reset_to_path(self, path):
     chapter_node = self.tree.get_node(path)
     first_node = walk_step(self.tree, chapter_node)
     return self._reset_window_to_node(first_node)