Skip to content

Commit 2f69b08

Browse files
Wifi app: only show Scan QR button if there's a camera
1 parent a343fac commit 2f69b08

File tree

1 file changed

+5
-1
lines changed
  • internal_filesystem/builtin/apps/com.micropythonos.wifi/assets

1 file changed

+5
-1
lines changed

internal_filesystem/builtin/apps/com.micropythonos.wifi/assets/wifi.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from mpos import Activity, Intent, MposKeyboard, WifiService, CameraActivity, pct_of_display_width
66
import mpos.apps
7+
import mpos.camera_manager as CameraManager
78

89
class WiFi(Activity):
910
"""
@@ -286,7 +287,10 @@ def onCreate(self):
286287
if self.selected_ssid:
287288
label.set_text(self.action_button_label_forget)
288289
else:
289-
label.set_text(self.action_button_label_scanqr)
290+
if CameraManager.has_camera():
291+
label.set_text(self.action_button_label_scanqr)
292+
else:
293+
self.forget_button.add_flag(lv.obj.FLAG.HIDDEN)
290294
# Close button
291295
self.cancel_button = lv.button(buttons)
292296
self.cancel_button.center()

0 commit comments

Comments
 (0)