Let yes/no dialog accept 'y' or 'n' as input
Change-Id: I6680e13c55568f42e07f62eeb496bc7d23a322f7
This commit is contained in:
parent
80cacc5759
commit
d3db343b39
@ -89,3 +89,12 @@ class YesNoDialog(ButtonDialog):
|
|||||||
lambda button:self._emit('no'))
|
lambda button:self._emit('no'))
|
||||||
super(YesNoDialog, self).__init__(title, message, buttons=[yes_button,
|
super(YesNoDialog, self).__init__(title, message, buttons=[yes_button,
|
||||||
no_button])
|
no_button])
|
||||||
|
def keypress(self, size, key):
|
||||||
|
r = super(YesNoDialog, self).keypress(size, key)
|
||||||
|
if r in ('Y', 'y'):
|
||||||
|
self._emit('yes')
|
||||||
|
return None
|
||||||
|
if r in ('N', 'n'):
|
||||||
|
self._emit('no')
|
||||||
|
return None
|
||||||
|
return r
|
||||||
|
Loading…
x
Reference in New Issue
Block a user