@@ -187,14 +187,14 @@ def __pt_container__(self):
187
187
return self .dialog
188
188
189
189
190
- def show_dialog (dialog ):
190
+ async def show_dialog (dialog ):
191
191
"Coroutine."
192
192
app = get_app ()
193
193
float_ = Float (content = dialog )
194
194
app .layout .container .floats .insert (0 , float_ )
195
195
focused_before = app .layout .current_window
196
196
app .layout .focus (dialog )
197
- result = yield from dialog .future
197
+ result = await dialog .future
198
198
app .layout .focus (focused_before )
199
199
200
200
if float_ in app .layout .container .floats :
@@ -223,9 +223,9 @@ def yes_no_dialog(
223
223
Execute a passed function.
224
224
"""
225
225
226
- def coroutine ():
226
+ async def coroutine ():
227
227
dialog = YesNoDialog (title = title , text = text , yes_text = yes_text , no_text = no_text )
228
- result = yield from show_dialog (dialog )
228
+ result = await show_dialog (dialog )
229
229
if result == True :
230
230
yes_func ()
231
231
else :
@@ -255,11 +255,11 @@ def input_dialog(
255
255
"""
256
256
output_text = ""
257
257
258
- def coroutine ():
258
+ async def coroutine ():
259
259
global output_text
260
260
open_dialog = TextInputDialog (title , text , completer )
261
261
262
- output_text = yield from show_dialog (open_dialog )
262
+ output_text = await show_dialog (open_dialog )
263
263
264
264
ensure_future (coroutine ())
265
265
return output_text
@@ -278,7 +278,7 @@ def message_dialog(
278
278
Display a simple message box and wait until the user presses enter.
279
279
"""
280
280
281
- def coroutine ():
281
+ async def coroutine ():
282
282
dialog = MessageDialog (
283
283
title = title ,
284
284
text = text ,
@@ -287,7 +287,7 @@ def coroutine():
287
287
wrap_lines = wrap_lines ,
288
288
scrollbar = scrollbar ,
289
289
)
290
- yield from show_dialog (dialog )
290
+ await show_dialog (dialog )
291
291
292
292
ensure_future (coroutine ())
293
293
0 commit comments