Skip to content

Commit 8c1903d

Browse files
Camera app: add experimental zoom button
1 parent 3e9fbc3 commit 8c1903d

File tree

1 file changed

+16
-0
lines changed
  • internal_filesystem/apps/com.micropythonos.camera/assets

1 file changed

+16
-0
lines changed

internal_filesystem/apps/com.micropythonos.camera/assets/camera_app.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ def onCreate(self):
9595
snap_label = lv.label(self.snap_button)
9696
snap_label.set_text(lv.SYMBOL.OK)
9797
snap_label.center()
98+
self.zoom_button = lv.button(self.main_screen)
99+
self.zoom_button.set_size(self.button_width, self.button_height)
100+
self.zoom_button.align(lv.ALIGN.RIGHT_MID, 0, self.button_height + 10)
101+
#self.zoom_button.add_flag(lv.obj.FLAG.HIDDEN)
102+
self.zoom_button.add_event_cb(self.zoom_button_click,lv.EVENT.CLICKED,None)
103+
zoom_label = lv.label(self.zoom_button)
104+
zoom_label.set_text("Z")
105+
zoom_label.center()
106+
107+
98108
self.qr_button = lv.button(self.main_screen)
99109
self.qr_button.set_size(self.button_width, self.button_height)
100110
self.qr_button.add_flag(lv.obj.FLAG.HIDDEN)
@@ -279,6 +289,12 @@ def qr_button_click(self, e):
279289
else:
280290
self.stop_qr_decoding()
281291

292+
def zoom_button_click(self, e):
293+
print("zooming...")
294+
if self.cam:
295+
# This might work as it's what works in the C code:
296+
self.cam.set_res_raw(startX=0,startY=0,endX=2623,endY=1951,offsetX=992,offsetY=736,totalX=2844,totalY=2844,outputX=640,outputY=480,scale=False,binning=False)
297+
282298
def open_settings(self):
283299
self.image_dsc.data = None
284300
self.current_cam_buffer = None

0 commit comments

Comments
 (0)