Update tests.py
This commit is contained in:
		
							
								
								
									
										67
									
								
								tests.py
									
									
									
									
									
								
							
							
						
						
									
										67
									
								
								tests.py
									
									
									
									
									
								
							| @@ -3,8 +3,9 @@ import config | ||||
| from config import LCD | ||||
| from time import sleep | ||||
|  | ||||
| """ | ||||
| # testing different icon styles | ||||
| # scroll indicator for the possibility to go up- OR downwards in the menu list | ||||
| """ | ||||
| LCD.custom_char(0, bytearray([0x00,0x04,0x04,0x04,0x15,0x0E,0x04,0x00]))  # arrow down (variant 1) | ||||
| LCD.custom_char(1, bytearray([0x00,0x04,0x04,0x04,0x15,0x0A,0x04,0x00]))  # arrow down (variant 2) | ||||
| LCD.custom_char(2, bytearray([0x00,0x00,0x00,0x00,0x11,0x0A,0x04,0x00]))  # arrow down (variant 3) | ||||
| @@ -13,14 +14,39 @@ LCD.custom_char(4, bytearray([0x00,0x04,0x0A,0x15,0x04,0x04,0x04,0x00]))  # arro | ||||
| LCD.custom_char(5, bytearray([0x00,0x04,0x0A,0x11,0x00,0x00,0x00,0x00]))  # arrow up   (variant 3) | ||||
| LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)+"   <>") | ||||
| """ | ||||
| # scroll indicator for the possibility to go up- AND downwards in the menu list | ||||
| """ | ||||
| LCD.custom_char(0, bytearray([0x04,0x0A,0x15,0x04,0x15,0x0A,0x04,0x00]))  # arrow up and down (variant 1) | ||||
| LCD.custom_char(1, bytearray([0x04,0x0E,0x15,0x04,0x15,0x0E,0x04,0x00]))  # arrow up and down (variant 2) | ||||
| LCD.custom_char(2, bytearray([0x04,0x0E,0x15,0x04,0x04,0x15,0x0E,0x04]))  # arrow up and down (variant 3) | ||||
| LCD.custom_char(3, bytearray([0x04,0x0A,0x15,0x04,0x04,0x15,0x0A,0x04]))  # arrow up and down (variant 4) | ||||
| LCD.custom_char(4, bytearray([0x04,0x0A,0x11,0x00,0x00,0x11,0x0A,0x04]))  # arrow up and down (variant 5) -> the chosen one! | ||||
| LCD.custom_char(5, bytearray([0x04,0x0A,0x11,0x00,0x11,0x0A,0x04,0x00]))  # arrow up and down (variant 6) | ||||
| LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)) | ||||
| """ | ||||
| # scroll indicator for no options (only one menu item exists) | ||||
| """ | ||||
| LCD.custom_char(0, bytearray([0x00,0x11,0x0A,0x04,0x0A,0x11,0x00,0x00]))  # two arrows pointing towards (variant 1) | ||||
| LCD.custom_char(1, bytearray([0x11,0x0A,0x04,0x00,0x04,0x0A,0x11,0x00]))  # two arrows pointing towards (variant 2) | ||||
| LCD.custom_char(2, bytearray([0x11,0x0A,0x04,0x00,0x00,0x04,0x0A,0x11]))  # two arrows pointing towards (variant 3) | ||||
| LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)) | ||||
| """ | ||||
|  | ||||
| #LCD.putstr("<<<<<<<<>>>>>>>>< some tst itm >") | ||||
| #LCD.putstr("<<<<<<<  >>>>>>>< some tst itm >") | ||||
| #LCD.putstr("<              >< some tst itm >") | ||||
| LCD.putstr("[ ------------ ]< some tst itm >") | ||||
| # the actual used ones | ||||
| """ | ||||
| LCD.custom_char(0, bytearray([0x04,0x0A,0x11,0x00,0x00,0x00,0x00,0x00]))  # arrow up | ||||
| LCD.custom_char(1, bytearray([0x00,0x00,0x00,0x00,0x00,0x11,0x0A,0x04]))  # arrow down | ||||
| LCD.custom_char(2, bytearray([0x04,0x0A,0x11,0x00,0x00,0x11,0x0A,0x04]))  # arrow up and down (variant 5 from above) | ||||
| LCD.custom_char(3, bytearray([0x11,0x0A,0x04,0x00,0x00,0x04,0x0A,0x11]))  # no options (variant 3 from above) | ||||
| LCD.custom_char(4, bytearray([0x08,0x08,0x08,0x0F,0x08,0x08,0x08,0x08]))  # line with a fork (to show the current selection - h scrolling) | ||||
| LCD.custom_char(5, bytearray([0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08]))  # line without a fork (to show unselected items - h scrolling) | ||||
| LCD.custom_char(6, bytearray([0x00,0x00,0x00,0x00,0x00,0x00,0x15,0x00]))  # three dots in a row | ||||
|  | ||||
| sleep(1) | ||||
| LCD.putstr(chr(0)+" "+chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)+" "+chr(6)) | ||||
| """ | ||||
|  | ||||
| # tests for the library | ||||
| #""" | ||||
| def some_print(): | ||||
|     print("some_print() executed!") | ||||
| def another_callback(): | ||||
| @@ -30,25 +56,32 @@ def third(): | ||||
|     return True | ||||
|  | ||||
|  | ||||
| menuItems = [("some_print", some_print), | ||||
|              ("another_entry", another_callback), | ||||
| menuItems = [("first item", some_print), | ||||
|              ("second item", another_callback), | ||||
|              ("third item", third)] | ||||
| submenu = lcdMenu(config.LCD, | ||||
|              {"next_btn": config.BTN_2, "ok_btn": config.BTN_1}, | ||||
| fullscreen = lcdMenu(config.LCD, | ||||
|              {"prev_btn":config.BTN_1, "next_btn": config.BTN_2, "ok_btn": config.SWITCH}, | ||||
|              menuItems, | ||||
|              scroll_direction=True, cycle=True, | ||||
|              hide_menu_name=False) | ||||
|              scroll_direction=False, cycle=False, | ||||
|              hide_menu_name=True, name="Fullscreen!") | ||||
| titlish = lcdMenu(config.LCD, | ||||
|              {"prev_btn":config.BTN_1, "next_btn": config.BTN_2, "ok_btn": config.SWITCH}, | ||||
|              menuItems, | ||||
|              scroll_direction=False, cycle=False, | ||||
|              hide_menu_name=False, name="Titlish!") | ||||
|  | ||||
| mm_menuItems = [("Fullscreen",fullscreen.run), | ||||
|                 ("Titlish", titlish.run)] | ||||
| mainmenu = lcdMenu(config.LCD, | ||||
|              {"next_btn": config.BTN_2, "ok_btn": config.BTN_1}, | ||||
|              [("submenu",submenu.run)], | ||||
|              {"prev_btn":config.BTN_1, "next_btn": config.BTN_2, "ok_btn": config.SWITCH}, | ||||
|              mm_menuItems, | ||||
|              scroll_direction=True, cycle=True, | ||||
|              hide_menu_name=False) | ||||
|              hide_menu_name=False, name="Main Menu!") | ||||
|  | ||||
| mainmenu.next_selection() | ||||
| mainmenu.previous_selection() | ||||
|  | ||||
| print("-------\nNow running!\n-------") | ||||
|  | ||||
| submenu.run() | ||||
| #mainmenu.run() | ||||
| mainmenu.run() | ||||
| #""" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user