diff --git a/README.md b/README.md index 4e2ce7f..c67a8c6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Curses, on Linux pre-installed, on windows you need windows-curses, so you can i Or just add to your code: ```python import ezztui -ezztui.check_curses() +ezztui.check_curses() # not needed if you are using ezztui 2.0.0 or later, it will check for curses automatically ``` # Use @@ -18,7 +18,6 @@ Backspace: Go back ## Print text on center of console ```python import ezztui -ezztui.check_curses() # check and install windows-curses, if on windows ezztui.center_message("Hello World!") # prints "Hello World!" on the center of the console ezztui.center_multiline(["Hello", "multiline", "world!"]) # prints "Hello" on the center of the console, then "multiline" on the next line, then "world!" on the next line ``` @@ -26,7 +25,6 @@ ezztui.center_multiline(["Hello", "multiline", "world!"]) # prints "Hello" on th ## Clear console ```python import ezztui -ezztui.check_curses() # check and install windows-curses, if on windows ezztui.cls() # clears the console with a os.system command ezztui.softcls() # clears the console with a multiple newline ``` @@ -34,15 +32,14 @@ ezztui.softcls() # clears the console with a multiple newline ### Usage ```python import ezztui -ezztui.check_curses() # check and install windows-curses, if on windows menu = { 'First menu': - {'Function 1': 'ezztui_return_value', + {'Function 1': 'ezztui_return_value', # use 'return' also from 2.0.0 'Function 2': 'ezztui_return_value', 'Function 3': 'ezztui_return_value', 'Function 4': 'ezztui_return_value', 'Function 5': 'ezztui_return_value', - 'Back': 'ezztui_back_value'}, + 'Back': 'ezztui_back_value'}, # use 'back' also from 2.0.0 'Second menu': {'Submenu 1': { @@ -80,7 +77,7 @@ menu = { 'Exit': {"Exit": 'ezztui_exit_value', - "Back": 'ezztui_back_value'} + "Back": 'ezztui_back_value'} # use 'exit' also from 2.0.0 } print(ezztui.menu(menu)) # prints the menu and returns name of function and path to it in menu, diff --git a/__init__.py b/__init__.py index 36e0c8e..ddcbc66 100644 --- a/__init__.py +++ b/__init__.py @@ -1 +1 @@ -from ezztui import * \ No newline at end of file +from ezztui import * diff --git a/ezztui.py b/ezztui.py index 5e51068..84682ba 100644 --- a/ezztui.py +++ b/ezztui.py @@ -85,12 +85,12 @@ def menu(menulist: dict): currentmenu = currentmenu[list(currentmenu.keys())[current_row]] break - elif key == curses.KEY_ENTER or key in [10, 13] and currentmenu[list(currentmenu.keys())[current_row]] == 'ezztui_return_value': + elif key == curses.KEY_ENTER or key in [10, 13] and currentmenu[list(currentmenu.keys())[current_row]] in ['ezztui_return_value', 'return']: menupath.append(list(currentmenu)[current_row]) returning = menupath break - elif key == curses.KEY_BACKSPACE or str(key) in ['KEY_BACKSPACE', '8', '127'] or currentmenu[list(currentmenu.keys())[current_row]] == 'ezztui_back_value': + elif key == curses.KEY_BACKSPACE or str(key) in ['KEY_BACKSPACE', '8', '127'] or currentmenu[list(currentmenu.keys())[current_row]] in ['ezztui_back_value', 'back']: menupath = menupath[:-1:] try: currentmenu = menulist[list(menupath)[0]] @@ -101,7 +101,7 @@ def menu(menulist: dict): mainmenu(stdscr) break - elif key == curses.KEY_ENTER or key in [10, 13] and currentmenu[list(currentmenu.keys())[current_row]] == 'ezztui_exit_value': + elif key == curses.KEY_ENTER or key in [10, 13] and currentmenu[list(currentmenu.keys())[current_row]] in ['ezztui_exit_value', 'exit']: exit() print_menu(stdscr, current_row, currentmenu) diff --git a/setup.py b/setup.py index 138da56..e6c822d 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open("README.md", "r") as fh: setup( name="ezztui", - version="1.0.0", + version="2.0.0", scripts=["ezztui.py"], author="BarsTiger", description="Easy TextUI creating package",