(self)
Ask to save the database (e.g. before quitting)
Ask to save the database (e.g. before quitting)
Ask to save the database ( e . g . before quitting )
def ask_for_saving(self):
        '''Ask to save the database (e.g. before quitting)'''

        while True:
            self.control.draw_text(self.changed,
                                   (1, 0, 'File has changed. Save? [(y)/n]'))
            try:
                e = self.control.stdscr.getch()
            except KeyboardInterrupt:
                e = 4
            if e == 4:
                self.close()
            elif e == cur.KEY_RESIZE:
                self.control.resize_all()
            elif e == cur.KEY_F5:
                return False
            elif e == ord('n'):
                break
            else:
                if self.db.filepath is None:
                    filepath = FileBrowser(self.control, False, False, None, 
                                           True)()
                    if filepath == -1:
                        self.close()
                    elif filepath is not False:
                        self.control.cur_dir = filepath
                        self.save(self.control.cur_dir)
                    else:
                        continue
                else:
                    self.save(self.control.cur_dir)
            break
def ask_for_saving ( self ) : while True : self . control . draw_text ( self . changed , ( 1 , 0 , 'File has changed. Save? [(y)/n]' ) ) try : e = self . control . stdscr . getch ( ) except KeyboardInterrupt : e = 4 if e == 4 : self . close ( ) elif e == cur . KEY_RESIZE : self . control . resize_all ( ) elif e == cur . KEY_F5 : return False elif e == ord ( 'n' ) : break else : if self . db . filepath is None : filepath = FileBrowser ( self . control , False , False , None , True ) ( ) if filepath == - 1 : self . close ( ) elif filepath is not False : self . control . cur_dir = filepath self . save ( self . control . cur_dir ) else : continue else : self . save ( self . control . cur_dir ) break