| 358 | app.layout.focus(self._dialog_prev_focus) |
| 359 | |
| 360 | def ok_handler(*args, **kwargs): |
| 361 | app = get_app() |
| 362 | buffer = app.layout.get_buffer_by_name('debug_buffer') |
| 363 | with open(os.path.expanduser(textfield.text), 'w') as f: |
| 364 | f.write(buffer.document.text) |
| 365 | textfield.text = default_filename |
| 366 | app.layout.focus(textfield) |
| 367 | self.float_container.floats.pop() |
| 368 | app.layout.focus(self._dialog_prev_focus) |
| 369 | |
| 370 | ok_button = Button(text='Save', handler=ok_handler) |
| 371 | cancel_button = Button(text='Cancel', handler=cancel_handler) |