You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
cleanups
This commit is contained in:
@@ -25,17 +25,10 @@ class ImageView(Activity):
|
||||
self.setContentView(screen)
|
||||
|
||||
def onResume(self, screen):
|
||||
#lv.libjpeg_turbo_init()
|
||||
#first = lv.image_decoder_t()
|
||||
#decoder = lv.image.decoder_get_next(first)
|
||||
#decoder = lv.image_decoder_t.get_next(first)
|
||||
#decoder.delete()
|
||||
self.images.clear()
|
||||
for item in os.listdir(self.imagedir):
|
||||
print(item)
|
||||
#if item.endswith(".jpg") or item.endswith(".jpeg"):
|
||||
if item.endswith(".jpg") or item.endswith(".jpeg") or item.endswith(".png"):
|
||||
#if item.endswith(".png"):
|
||||
fullname = f"{self.imagedir}/{item}"
|
||||
size = os.stat(fullname)[6]
|
||||
print(f"size: {size}")
|
||||
@@ -66,14 +59,12 @@ class ImageView(Activity):
|
||||
try:
|
||||
self.label.set_text(name)
|
||||
self.image.set_src(f"P:{name}")
|
||||
w = self.image.get_width()
|
||||
h = self.image.get_height()
|
||||
print(f"the LVGL image has size: {w}x{h}")
|
||||
print(f"the LVGL image has size: {self.image.get_width()}x{self.image.get_height()}")
|
||||
header = lv.image_header_t()
|
||||
self.image.decoder_get_info(self.image.get_src(), header)
|
||||
print(f"the real image has size: {header.w}x{header.h}")
|
||||
#image.set_size(128, 128)
|
||||
self.image.set_scale(512)
|
||||
print(f"done with show_image({name}) got {w}x{h}")
|
||||
print(f"after set_scale, the LVGL image has size: {self.image.get_width()}x{self.image.get_height()}")
|
||||
except Exception as e:
|
||||
print(f"show_image got exception: {e}")
|
||||
|
||||
Reference in New Issue
Block a user