Skip to content

Commit faed111

Browse files
displaywallet: add CAM button for QR scanning (not functional yet)
1 parent a894784 commit faed111

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

internal_filesystem/apps/com.lightningpiggy.displaywallet/assets/displaywallet.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,18 @@ def create_radio_button(self, parent, text, index):
144144
cb.add_style(style_radio_chk, lv.PART.INDICATOR | lv.STATE.CHECKED)
145145
return cb
146146

147+
def cambutton_cb(self, event):
148+
print("cambutton clicked!")
149+
import captureqr
150+
print("after import captureqr")
151+
#while True: this hangs the entire thing - not good...
152+
clip = mpos.clipboard.get()
153+
print(f"clip is: {clip}")
154+
if clip and clip.startsWith("Result:"):
155+
print("Got result from QR code scanner!")
156+
#break
157+
time.sleep(0.25)
158+
147159
def open_edit_popup(self, setting):
148160
# Close existing msgbox and keyboard if open
149161
if self.msgbox:
@@ -158,7 +170,7 @@ def open_edit_popup(self, setting):
158170
# Create msgbox
159171
self.msgbox = lv.msgbox()
160172
self.msgbox.add_title(setting["title"])
161-
self.msgbox.set_width(lv.pct(80))
173+
self.msgbox.set_width(lv.pct(85))
162174
self.msgbox.center()
163175

164176
# Create content container
@@ -192,7 +204,14 @@ def open_edit_popup(self, setting):
192204
self.textarea.add_event_cb(self.show_keyboard, lv.EVENT.CLICKED, None)
193205
self.textarea.add_event_cb(self.show_keyboard, lv.EVENT.FOCUSED, None)
194206
self.textarea.add_event_cb(self.hide_keyboard, lv.EVENT.DEFOCUSED, None)
195-
207+
# Camera for text
208+
self.cambutton = lv.button(self.msgbox)
209+
#self.cambutton.align(lv.ALIGN.TOP_RIGHT,0,0)
210+
self.cambuttonlabel = lv.label(self.cambutton)
211+
self.cambuttonlabel.set_text("CAM")
212+
self.cambuttonlabel.center()
213+
self.cambutton.add_event_cb(self.cambutton_cb, lv.EVENT.CLICKED, None)
214+
196215
# Button container
197216
btn_cont = lv.obj(content)
198217
btn_cont.set_width(lv.pct(100))
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# simple clipboard
2+
3+
copied = None
4+
5+
def add(tocopy):
6+
copied = tocopy
7+
8+
def get():
9+
return copied

0 commit comments

Comments
 (0)