ESP3D/libraries/lvgl-8.2.0/examples/widgets/dropdown/lv_example_dropdown_3.py
Luc 39e06975f2 Update from refactoring branch
### Maintenance page
* Add add tab color for mobile view
* Add spellcheck off / autocorect off in input
* Add disconnect button when authenticate enabled
* Add Invalid user or password message when authentication failed

### Board support
* Add ESP32 S2 support
* Add ESP32 S3 support
* Add ESP32 C3 support

### ESP commands
* Add command 701 to control GCODE streaming
* Remove command 901 as duplicate
* Update command 420 to add more details
* Use text as default output
* All json on all commands for formated output

### Core
* Add benchmak function to check transfer speed (for test only-not production)
* Merge code for ESP3DLib support
* Add better printer display support (M117 / Serial TFT)
* Use ESP32 analogWrite instead of emulated one

### Modules
* Display
	* Refactor code
	* Remove SPI ILI 9341 / 9488 support as not suitable
      * Add ST7789 support (135x240 / 240x240)
* Filesystem
	* Bug fixes due to esp core updates
	* Better SD sharing mecanism
      * Better global FS management
* FTP
	* Add SD sharing support
	* Better global FS management
* GCODE Host
	* Add basic support for macro files
      * Add ESP command support
      * Use not blocking method to stream commands / handle response
* Notifications
	* Add IFTTT notification service
	* Add WebUI notification
	* Add ESP3D display notification
* WebDav
	* Add SD sharing support
	* Add bug fix from https://github.com/d-a-v/ESPWebDAV
	* Better global FS management
* Websocket
	* Add function to handle zombies connections
* WiFi
	* Fix connection to AP sometime fail
	* Fix low signal not diplayed in ESP420 even connected
	* Add AP Setup mode

### Libraries
* Update SDFat-2.0.6 to 2.1.2
* Update ESP32SSDP 1.1.1 to 1.2.0
* Update TFT_eSPI-1.4.11 to 2.4.61
* Update arduinoWebSockets-2.3.5 to 2.3.6
* Update esp8266-oled-ssd1306-4.0.0 to 4.3.0
* Remove lvgl support

### Tools
* Add I2C scanner script
* Add python script to simulate/stress printer serial communication

### PlatformIO
 * Use latest 4.4.0 Espressif32 release (ESP32-arduino core 2.0.3)
 * Add fix for Flash more than 4MB
 * Add Esp32 S2/S3/C3 env
 * Add ESP32-ST7789 / esp32-TTGO_T_Display env
2022-06-01 14:56:57 +08:00

54 lines
1.5 KiB
Python

from imagetools import get_png_info, open_png
# Register PNG image decoder
decoder = lv.img.decoder_create()
decoder.info_cb = get_png_info
decoder.open_cb = open_png
# Create an image from the png file
try:
with open('../../assets/img_caret_down.png','rb') as f:
png_data = f.read()
except:
print("Could not find img_caret_down.png")
sys.exit()
img_caret_down_argb = lv.img_dsc_t({
'data_size': len(png_data),
'data': png_data
})
def event_cb(e):
dropdown = e.get_target()
option = " "*64 # should be large enough to store the option
dropdown.get_selected_str(option, len(option))
print(option.strip() +" is selected")
#
# Create a menu from a drop-down list and show some drop-down list features and styling
#
# Create a drop down list
dropdown = lv.dropdown(lv.scr_act())
dropdown.align(lv.ALIGN.TOP_LEFT, 10, 10)
dropdown.set_options("\n".join([
"New project",
"New file",
"Open project",
"Recent projects",
"Preferences",
"Exit"]))
# Set a fixed text to display on the button of the drop-down list
dropdown.set_text("Menu")
# Use a custom image as down icon and flip it when the list is opened
# LV_IMG_DECLARE(img_caret_down)
dropdown.set_symbol(img_caret_down_argb)
dropdown.set_style_transform_angle(1800, lv.PART.INDICATOR | lv.STATE.CHECKED)
# In a menu we don't need to show the last clicked item
dropdown.set_selected_highlight(False)
dropdown.add_event_cb(event_cb, lv.EVENT.VALUE_CHANGED, None)