Properly close out of OpenFileDialogs
Signed-off-by: R. Tyler Ballance <tyler@monkeypox.org>
This commit is contained in:
parent
e7e407d6d9
commit
4803ac8228
|
@ -238,11 +238,11 @@ class Window(Widget):
|
|||
if key == curses.KEY_RESIZE:
|
||||
self.redraw()
|
||||
continue
|
||||
if key == Keys.ESCAPE:
|
||||
self.close()
|
||||
return self.unfocus()
|
||||
if self.keyhandler:
|
||||
if key == Keys.ESCAPE or key == ord('q') or key == ord('Q'):
|
||||
key = None
|
||||
if self.keyhandler and key:
|
||||
key = self.keyhandler(key)
|
||||
self.close()
|
||||
self.unfocus()
|
||||
|
||||
class RootWindow(Window):
|
||||
|
|
|
@ -58,8 +58,8 @@ class OpenFileDialog(consoleui.Window):
|
|||
self.redraw(nofullrefresh=True)
|
||||
return True
|
||||
else:
|
||||
self.close()
|
||||
self.callback(path)
|
||||
return None
|
||||
return True
|
||||
|
||||
def dir_listing(self):
|
||||
|
@ -114,9 +114,3 @@ class OpenFileDialog(consoleui.Window):
|
|||
if not kwargs.get('nofullrefresh'):
|
||||
self.parent.redraw()
|
||||
|
||||
|
||||
def OpenFilePlease(start, callback):
|
||||
dialog = OpenFileDialog(start=start, callback=callback)
|
||||
dialog.render()
|
||||
dialog.focus()
|
||||
|
||||
|
|
Loading…
Reference in New Issue