(self, skip_fb=False)
This method opens a database.
This method opens a database.
This method opens a database .
def open_db(self, skip_fb=False):
        ''' This method opens a database.'''

        if skip_fb is False:
            filepath = FileBrowser(self, True, False, self.last_file)()
            if filepath is False:
                return False
            elif filepath == -1:
                self.close()
            else:
                self.cur_dir = filepath

        ret = self.get_authentication()
        if ret is False:
            return False
        password, keyfile = ret

        try:
            if isfile(self.cur_dir + '.lock'):
                self.draw_text(False,
                               (1, 0, 'Database seems to be opened.'
                                ' Open file in read-only mode?'
                                ' [(y)/n]'))
                while True:
                    try:
                        e = self.stdscr.getch()
                    except KeyboardInterrupt:
                        e = 4

                    if e == ord('n'):
                        read_only = False
                        break
                    elif e == 4:
                        self.close()
                    elif e == cur.KEY_RESIZE:
                        self.resize_all()
                    elif e == cur.KEY_F5:
                        return False
                    else:
                        read_only = True
                        break
            else:
                read_only = False
            self.db = KPDBv1(self.cur_dir, password, keyfile, read_only)
            self.db.load()
            return True
        except KPError as err:
            self.draw_text(False,
                           (1, 0, err.__str__()),
                           (4, 0, 'Press any key.'))
            if self.any_key() == -1:
                self.close()
            last = self.cur_dir.split('/')[-1]
            self.cur_dir = self.cur_dir[:-len(last) - 1]
            return False
def open_db ( self , skip_fb = False ) : if skip_fb is False : filepath = FileBrowser ( self , True , False , self . last_file ) ( ) if filepath is False : return False elif filepath == - 1 : self . close ( ) else : self . cur_dir = filepath ret = self . get_authentication ( ) if ret is False : return False password , keyfile = ret try : if isfile ( self . cur_dir + '.lock' ) : self . draw_text ( False , ( 1 , 0 , 'Database seems to be opened.' ' Open file in read-only mode?' ' [(y)/n]' ) ) while True : try : e = self . stdscr . getch ( ) except KeyboardInterrupt : e = 4 if e == ord ( 'n' ) : read_only = False break elif e == 4 : self . close ( ) elif e == cur . KEY_RESIZE : self . resize_all ( ) elif e == cur . KEY_F5 : return False else : read_only = True break else : read_only = False self . db = KPDBv1 ( self . cur_dir , password , keyfile , read_only ) self . db . load ( ) return True except KPError as err : self . draw_text ( False , ( 1 , 0 , err . __str__ ( ) ) , ( 4 , 0 , 'Press any key.' ) ) if self . any_key ( ) == - 1 : self . close ( ) last = self . cur_dir . split ( '/' ) [ - 1 ] self . cur_dir = self . cur_dir [ : - len ( last ) - 1 ] return False