pymenu package¶
Package main definition.
-
class
pymenu.DictMenuEntry(name, data, parent=None)[source]¶ Bases:
pymenu.MenuEntryA menu tree node made of a dictionary structure.
Parameters: - name (str) – The name of this node.
- data (dict) – The value of this node. If this is a dictionary, child nodes will be created from it.
- parent (pymenu.MenuEntry) – Parent entry node.
-
class
pymenu.FileSystemMenuEntry(path, parent=None)[source]¶ Bases:
pymenu.MenuEntryA menu tree node made from a filesystem path.
Parameters: - path (str) – Filesystem path from which to build the menu tree.
- parent (pymenu.MenuEntry) – Paren entry node.
Note
The creation of child nodes if not lazy. This means that creating an instance of this class from a top level folder of a large file sets will consumes a lot of RAM.
-
class
pymenu.Menu(root_entry, prompt)[source]¶ Bases:
objectParameters: - root_entry (pymenu.MenuEntry) –
- prompt (pymenu.Prompt) –
-
choose_menu()[source]¶ Prompt for a choice of menu items.
Returns: The chosen menu object Return type: pymenu.Menu
-
choose_value()[source]¶ Prompt until a leaf menu item is choosen.
Returns: The associated value for the chosen item. Return type: Any
-
entry¶ Returns – pymenu.MenuEntry
-
class
pymenu.MenuEntry(name, value=None, parent=None)[source]¶ Bases:
anytree.node.NodeA menu tree node.
This is essentially a tree node, as inherited by
anytree.node.Node. Sub classes may require to implement the creation of child entries.Parameters: - name (str) – A name for this node.
- value (Any) – Associated value.
- parent (pymenu.MenuEntry) – Parent entry node.
-
value¶
-
class
pymenu.SimpleCommandPrompt(question=None, prompt=None)[source]¶ Bases:
pymenu.PromptSimply prompt a user for choices in command line.
Parameters: