fix naming issue with close callback in popups

This commit is contained in:
Nick Lanham 2011-03-19 12:38:55 +01:00
parent 280781ded9
commit e81a279dc2
2 changed files with 7 additions and 7 deletions

View File

@ -613,12 +613,12 @@ class InputPopup(Popup):
elif c == curses.KEY_DOWN:
self.current_input = min(len(self.inputs)-1,self.current_input+1)
elif c == curses.KEY_ENTER or c == 10:
if self._close_cb:
if self.close_cb:
vals = {}
for ipt in self.inputs:
vals[ipt.name] = ipt.get_value()
curses.curs_set(0)
self._close_cb(vals)
self.close_cb(vals)
return True # close the popup
elif c == 27: # close on esc, no action
return True

View File

@ -78,7 +78,7 @@ class Popup:
self.screen = curses.newwin(height_req,width_req,by,bx)
self.title = title
self.__close_cb = close_cb
self.close_cb = close_cb
self.height,self.width = self.screen.getmaxyx()
self.divider = None
self.lineoff = 0
@ -130,13 +130,13 @@ class Popup:
self.lineoff += 1
elif c == curses.KEY_ENTER or c == 10 or c == 27: # close on enter/esc
if self.__close_cb:
self.__close_cb()
if self.close_cb:
self.close_cb()
return True # close the popup
if c > 31 and c < 256 and chr(c) == 'q':
if self.__close_cb:
self.__close_cb()
if self.close_cb:
self.close_cb()
return True # close the popup
self.refresh()