You've already forked MicroPythonOS
mirror of
https://github.com/m5stack/MicroPythonOS.git
synced 2026-05-20 11:51:27 -07:00
Piggy wallet: simplify
This commit is contained in:
@@ -117,36 +117,16 @@ class SettingsScreen():
|
||||
setting["cont"].remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
|
||||
def radio_event_handler(self, event):
|
||||
code = event.get_code()
|
||||
if code != lv.EVENT.CLICKED:
|
||||
return
|
||||
targetblob = event.get_target()
|
||||
#target = self.radio_container
|
||||
#obj = e.get_target()
|
||||
target = lv.obj(targetblob)
|
||||
#pos = lvobj.get_pos() #
|
||||
if target == self.radio_container:
|
||||
print("it's the container")
|
||||
return # Ignore clicks on the container itself
|
||||
else:
|
||||
print("it's not the container")
|
||||
old_cb = self.radio_container.get_child(self.active_radio_index)
|
||||
old_cb.remove_state(lv.STATE.CHECKED)
|
||||
#target.add_state(lv.STATE.CHECKED)
|
||||
# 19 = lv.STATE.HOVERED, lv.STATE.CHECKED and lv.STATE.FOCUSED
|
||||
radio_index = -1
|
||||
for childnr in range(2):
|
||||
self.active_radio_index = -1
|
||||
for childnr in range(self.radio_container.get_child_count()):
|
||||
child = self.radio_container.get_child(childnr)
|
||||
state = child.get_state()
|
||||
print(f"state: {state}")
|
||||
if state != lv.STATE.DEFAULT:
|
||||
print("found checked child!")
|
||||
radio_index = childnr
|
||||
print(f"radio_container child's state: {state}")
|
||||
if state != lv.STATE.DEFAULT: # State can be something like 19 = lv.STATE.HOVERED & lv.STATE.CHECKED & lv.STATE.FOCUSED
|
||||
self.active_radio_index = childnr
|
||||
break
|
||||
else:
|
||||
print("skipping child...")
|
||||
#self.active_radio_index = self.radio_container.get_child_by_id(target)
|
||||
self.active_radio_index = radio_index
|
||||
print(f"active_radio_index is now {self.active_radio_index}")
|
||||
|
||||
def create_radio_button(self, parent, text, index):
|
||||
|
||||
@@ -230,6 +230,7 @@ class LNBitsWallet(Wallet):
|
||||
"X-Api-Key": self.lnbits_readkey,
|
||||
}
|
||||
try:
|
||||
print(f"Fetching balance with GET to {walleturl}")
|
||||
response = requests.get(walleturl, timeout=10, headers=headers)
|
||||
except Exception as e:
|
||||
print("fetch_balance: get request failed:", e)
|
||||
@@ -253,6 +254,7 @@ class LNBitsWallet(Wallet):
|
||||
"X-Api-Key": self.lnbits_readkey,
|
||||
}
|
||||
try:
|
||||
print(f"Fetching payments with GET to {paymentsurl}")
|
||||
response = requests.get(paymentsurl, timeout=10, headers=headers)
|
||||
except Exception as e:
|
||||
print("fetch_payments: get request failed:", e)
|
||||
@@ -418,7 +420,7 @@ class NWCWallet(Wallet):
|
||||
#cleartext_content='{"params":{"limit": 4 },"method":"list_transactions"}'
|
||||
)
|
||||
self.private_key.sign_event(dm) # sign also does encryption if it's a encrypted dm
|
||||
print("\n\nPublishing DM to fetch payments...\n\n")
|
||||
print("Publishing DM to fetch payments...")
|
||||
self.relay_manager.publish_event(dm)
|
||||
|
||||
def parse_nwc_url(self, nwc_url):
|
||||
|
||||
Reference in New Issue
Block a user