{ "info": { "author": "Luke Warlow", "author_email": "projects@warlow.dev", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Python Console Menu\n![license](https://img.shields.io/hexpm/l/plug.svg)\n\nThis library provides a way to quickly create the menu for your Python console app.\n\n## Overview\n\n### Classes\n\n#### AbstractMenu\nThis is the abstract class you need to extend in your menus.\nIts constructor takes in a title which is displayed at the top of the menu. This should be called from your implementation's constructor. Like so:\n```pythonstub\nclass MenuImplementation(AbstractMenu):\n def __init__(self):\n super().__init__(\"Menu Title\")\n```\n##### Methods\n- `initialise()` this needs overriding in your implementations and is where you add the items to the menu.\n- `display()` this starts this menu. This only needs to be called on the root menu in your system, as all sub-menus are handled by this library.\n- `add_menu_item(MenuItem(id, description, subMenu or action))` this adds an item to the menu. \n- `add_hidden_menu_item(new MenuItem(id, description, subMenu or action))` this is a helper method that adds a menu item, which is then hidden.\n- `update_menu_items()` this can be overridden per menu to update items based on changes to your application, such as showing hidden menu items if they're now needed.\n- `show_menu_item(id)` this can be used to show hidden menu items, most commonly in the method above. This uses the unique id given to the menu item.\n- `hide_menu_item(id)` this can be used to hide menu items.\n\n#### MenuItem\nThis is the class used to define items for the menus in your system. \nIt has two constructors one for if the item is a sub menu and another for if its an action. \nThese should be called like this: `MenuItem(id, description, subMenu or action)`\n##### Methods\n- `hide()` which is used on menu items, to hide them from the list.\n- `show()` which is used on hidden menu items, to show them in the list.\n- `set_as_exit_option()` which is used to set menu items as the exit option for a menu, either going to the parent menu, or exiting the application.\n\n## Example\n#### Menu initialisation\n```pythonstub\nmainMenu = MainMenu()\nmainMenu.display()\n```\n#### Main Menu Class\n```pythonstub\nclass MainMenu(AbstractMenu):\n def __init__(self):\n super().__init__(\"Welcome to the main menu\")\n\n def initialise(self):\n self.add_menu_item(MenuItem(100, \"Exit menu\").set_as_exit_option())\n self.add_menu_item(MenuItem(101, \"Print Hello World\", lambda: print(\"Hello World!\")))\n```\n\n#### Output\n```text\nWelcome to the main menu\n0. Exit menu\n1. Print Hello World\nSelect option: 1\nHello World!\n\nWelcome to the main menu\n0. Exit menu\n1. Print Hello World\nSelect option: 0\n\nProcess finished with exit code 0\n```\n\nLook in demo/menu_demo.py for a better example implementation of the library.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/lukewarlow/python_console_menu", "keywords": "console menu,menu,console", "license": "", "maintainer": "", "maintainer_email": "", "name": "python-console-menu", "package_url": "https://pypi.org/project/python-console-menu/", "platform": "", "project_url": "https://pypi.org/project/python-console-menu/", "project_urls": { "Homepage": "https://github.com/lukewarlow/python_console_menu" }, "release_url": "https://pypi.org/project/python-console-menu/1.1.0/", "requires_dist": null, "requires_python": "", "summary": "A simple library to handle the menus for your python console applications.", "version": "1.1.0" }, "last_serial": 5404410, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "3eb9bd9fe75314e84ac28f54e58ff3bf", "sha256": "f998eaaeaf87339a917c56c671de5bb8f00a3c347846ad43b9fea578c91bbd27" }, "downloads": -1, "filename": "python_console_menu-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "3eb9bd9fe75314e84ac28f54e58ff3bf", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5533, "upload_time": "2018-08-11T23:16:21", "url": "https://files.pythonhosted.org/packages/dc/63/6289e8400aba488ad401159b0aa00a82303d8b44b6893593055b17ba0cb9/python_console_menu-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e00ce9e28f9e8bd47485776f9df4c717", "sha256": "3b168cc0e742f33da1d00ce91413ae52e7a14838347a10ff4cac6a489b6662c6" }, "downloads": -1, "filename": "python_console_menu-1.0.tar.gz", "has_sig": false, "md5_digest": "e00ce9e28f9e8bd47485776f9df4c717", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3096, "upload_time": "2018-08-11T23:16:22", "url": "https://files.pythonhosted.org/packages/a1/4f/e3f5a18ecab6c287a58bf147ae8487d03fc5981a626fb8cb201437cf848a/python_console_menu-1.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "90c7f52f58e9835a6480305b88b65c66", "sha256": "ef6b00b053cb4ee27f963cfffc274370eab3d4b80fda761aa03b0b3e45ee089f" }, "downloads": -1, "filename": "python_console_menu-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "90c7f52f58e9835a6480305b88b65c66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7917, "upload_time": "2019-06-15T17:22:44", "url": "https://files.pythonhosted.org/packages/7e/68/45e0fd13178d0b1aa33d06b6c2ac2e3f60649fbadcb6a3a91753bf5ad1e7/python_console_menu-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8065f1f5c23e162dca85541433392a57", "sha256": "439ea6611c10fb166e75aad8ede6407110d2e96862b149d398e62a28742a8be3" }, "downloads": -1, "filename": "python_console_menu-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8065f1f5c23e162dca85541433392a57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3279, "upload_time": "2019-06-15T17:22:45", "url": "https://files.pythonhosted.org/packages/c4/29/0273bd13fc2e9c2fbc682d753a450394725e1e6d5eb22aa449a98dbbfe13/python_console_menu-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "90c7f52f58e9835a6480305b88b65c66", "sha256": "ef6b00b053cb4ee27f963cfffc274370eab3d4b80fda761aa03b0b3e45ee089f" }, "downloads": -1, "filename": "python_console_menu-1.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "90c7f52f58e9835a6480305b88b65c66", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 7917, "upload_time": "2019-06-15T17:22:44", "url": "https://files.pythonhosted.org/packages/7e/68/45e0fd13178d0b1aa33d06b6c2ac2e3f60649fbadcb6a3a91753bf5ad1e7/python_console_menu-1.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8065f1f5c23e162dca85541433392a57", "sha256": "439ea6611c10fb166e75aad8ede6407110d2e96862b149d398e62a28742a8be3" }, "downloads": -1, "filename": "python_console_menu-1.1.0.tar.gz", "has_sig": false, "md5_digest": "8065f1f5c23e162dca85541433392a57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3279, "upload_time": "2019-06-15T17:22:45", "url": "https://files.pythonhosted.org/packages/c4/29/0273bd13fc2e9c2fbc682d753a450394725e1e6d5eb22aa449a98dbbfe13/python_console_menu-1.1.0.tar.gz" } ] }