fix naming issue with close callback in popups
This commit is contained in:
parent
280781ded9
commit
e81a279dc2
|
@ -613,12 +613,12 @@ class InputPopup(Popup):
|
||||||
elif c == curses.KEY_DOWN:
|
elif c == curses.KEY_DOWN:
|
||||||
self.current_input = min(len(self.inputs)-1,self.current_input+1)
|
self.current_input = min(len(self.inputs)-1,self.current_input+1)
|
||||||
elif c == curses.KEY_ENTER or c == 10:
|
elif c == curses.KEY_ENTER or c == 10:
|
||||||
if self._close_cb:
|
if self.close_cb:
|
||||||
vals = {}
|
vals = {}
|
||||||
for ipt in self.inputs:
|
for ipt in self.inputs:
|
||||||
vals[ipt.name] = ipt.get_value()
|
vals[ipt.name] = ipt.get_value()
|
||||||
curses.curs_set(0)
|
curses.curs_set(0)
|
||||||
self._close_cb(vals)
|
self.close_cb(vals)
|
||||||
return True # close the popup
|
return True # close the popup
|
||||||
elif c == 27: # close on esc, no action
|
elif c == 27: # close on esc, no action
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Popup:
|
||||||
self.screen = curses.newwin(height_req,width_req,by,bx)
|
self.screen = curses.newwin(height_req,width_req,by,bx)
|
||||||
|
|
||||||
self.title = title
|
self.title = title
|
||||||
self.__close_cb = close_cb
|
self.close_cb = close_cb
|
||||||
self.height,self.width = self.screen.getmaxyx()
|
self.height,self.width = self.screen.getmaxyx()
|
||||||
self.divider = None
|
self.divider = None
|
||||||
self.lineoff = 0
|
self.lineoff = 0
|
||||||
|
@ -130,13 +130,13 @@ class Popup:
|
||||||
self.lineoff += 1
|
self.lineoff += 1
|
||||||
|
|
||||||
elif c == curses.KEY_ENTER or c == 10 or c == 27: # close on enter/esc
|
elif c == curses.KEY_ENTER or c == 10 or c == 27: # close on enter/esc
|
||||||
if self.__close_cb:
|
if self.close_cb:
|
||||||
self.__close_cb()
|
self.close_cb()
|
||||||
return True # close the popup
|
return True # close the popup
|
||||||
|
|
||||||
if c > 31 and c < 256 and chr(c) == 'q':
|
if c > 31 and c < 256 and chr(c) == 'q':
|
||||||
if self.__close_cb:
|
if self.close_cb:
|
||||||
self.__close_cb()
|
self.close_cb()
|
||||||
return True # close the popup
|
return True # close the popup
|
||||||
|
|
||||||
self.refresh()
|
self.refresh()
|
||||||
|
|
Loading…
Reference in New Issue