Skip to content

Commit c81144e

Browse files
committed
Also not that good at spelling
1 parent 6de266d commit c81144e

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

esp32/modules/dialogs.py

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import ugfx, badge, utime as time
77

8-
wait_for_interupt = True
8+
wait_for_interrupt = True
99

1010
def notice(text, title="SHA2017", close_text="Close", width = 296, height = 128, font="Roboto_Regular12"):
1111
prompt_boolean(text, title = title, true_text = close_text, false_text = None, width = width, height = height, font=font)
@@ -16,7 +16,7 @@ def prompt_boolean(text, title="SHA2017", true_text="Yes", false_text="No", widt
1616
if 'false_text' is set to None only one button is displayed.
1717
If both 'true_text' and 'false_text' are given a boolean is returned
1818
"""
19-
global wait_for_interupt
19+
global wait_for_interrupt
2020

2121
window = ugfx.Container((ugfx.width() - width) // 2, (ugfx.height() - height) // 2, width, height)
2222
window.show()
@@ -41,8 +41,8 @@ def prompt_boolean(text, title="SHA2017", true_text="Yes", false_text="No", widt
4141
window.show()
4242
ugfx.flush()
4343

44-
wait_for_interupt = True
45-
while wait_for_interupt:
44+
wait_for_interrupt = True
45+
while wait_for_interrupt:
4646
if buttons.is_triggered("BTN_A"): return True
4747
if buttons.is_triggered("BTN_B"): return False
4848
time.sleep(0.2)
@@ -59,7 +59,7 @@ def prompt_text(description, init_text = "", true_text="OK", false_text="Back",
5959
6060
Returns None if user aborts with button B
6161
"""
62-
global wait_for_interupt
62+
global wait_for_interrupt
6363

6464
window = ugfx.Container(int((ugfx.width()-width)/2), int((ugfx.height()-height)/2), width, height)
6565

@@ -89,8 +89,8 @@ def prompt_text(description, init_text = "", true_text="OK", false_text="Back",
8989
edit.set_focus()
9090
ugfx.flush()
9191

92-
wait_for_interupt = True
93-
while wait_for_interupt:
92+
wait_for_interrupt = True
93+
while wait_for_interrupt:
9494
#if buttons.is_triggered("BTN_A"): return edit.text()
9595
if buttons.is_triggered("BTN_B"): return None
9696
if buttons.is_triggered("BTN_MENU"): return edit.text()
@@ -111,7 +111,7 @@ def prompt_option(options, index=0, text = "Please select one of the following:"
111111
If none_text is specified the user can use the B or Menu button to skip the selection
112112
if title is specified a blue title will be displayed about the text
113113
"""
114-
global wait_for_interupt
114+
global wait_for_interrupt
115115

116116
ugfx.set_default_font("Roboto_Regular12")
117117
window = ugfx.Container(5, 5, ugfx.width() - 10, ugfx.height() - 10)
@@ -145,8 +145,8 @@ def prompt_option(options, index=0, text = "Please select one of the following:"
145145
try:
146146
ugfx.input_init()
147147

148-
wait_for_interupt = True
149-
while wait_for_interupt:
148+
wait_for_interrupt = True
149+
while wait_for_interrupt:
150150
if buttons.is_triggered("BTN_A"): return options[options_list.selected_index()]
151151
if button_none and buttons.is_triggered("BTN_B"): return None
152152
if button_none and buttons.is_triggered("BTN_MENU"): return None
@@ -159,6 +159,14 @@ def prompt_option(options, index=0, text = "Please select one of the following:"
159159
if button_none: button_none.destroy()
160160
ugfx.poll()
161161

162+
163+
def do_interrupt(pushed):
164+
global wait_for_interrupt
165+
wait_for_interrupt = False
166+
167+
ugfx.input_attach(ugfx.BTN_A, do_interrupt)
168+
ugfx.input_attach(ugfx.BTN_B, do_interrupt)
169+
162170
class WaitingMessage:
163171
"""Shows a dialog with a certain message that can not be dismissed by the user"""
164172
def __init__(self, text = "Please Wait...", title="SHA2017Badge"):
@@ -191,6 +199,3 @@ def __enter__(self):
191199

192200
def __exit__(self, exc_type, exc_value, traceback):
193201
self.destroy()
194-
195-
ugfx.input_attach(ugfx.BTN_A, wait_for_interupt = False)
196-
ugfx.input_attach(ugfx.BTN_B, wait_for_interupt = False)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy