(self)
This method is used to get a filepath, e.g. for 'Save as'
This method is used to get a filepath, e.g. for 'Save as'
This method is used to get a filepath e . g . for Save as
def get_filepath(self):
        '''This method is used to get a filepath, e.g. for 'Save as' '''

        if (self.ask_for_lf is False or self.last_file is None or 
            self.control.config['rem_db'] is False):
            nav = self.control.gen_menu(1, (
                    (1, 0, 'Use the file browser (1)'),
                    (2, 0, 'Type direct path (2)')))
        else:
            nav = self.control.gen_menu(1, (
                    (1, 0, 'Use ' + self.last_file + ' (1)'),
                    (2, 0, 'Use the file browser (2)'),
                    (3, 0, 'Type direct path (3)')))
        if ((self.ask_for_lf is True and self.last_file is not None and 
             nav == 2) or
            ((self.last_file is None or self.ask_for_lf is False) and 
             nav == 1)):
            if self.keyfile is True:
                filepath = self.browser()
            else:
                filepath = self.browser()
                if type(filepath) is str:
                    if filepath[-4:] != '.kdb' and filepath is not False:
                        filename = Editor(self.control.stdscr, max_text_size=1,
                                          win_location=(0, 1), win_size=(1, 80),
                                          title="Filename: ")()
                        if filename == "":
                            return False
                        filepath += '/' + filename + '.kdb'
            return filepath
        if ((self.ask_for_lf is True and self.last_file is not None and 
             nav == 3) or
            ((self.last_file is None or self.ask_for_lf is False) and 
             nav == 2)):
            filepath = ''
            while True:
                if self.last_file:
                    init = self.last_file
                else:
                    init = ''
                filepath = self.get_direct_filepath(filepath)
                if filepath is False:
                    return False
                elif filepath == -1:
                    return -1
                elif ((filepath[-4:] != '.kdb' or isdir(filepath)) and
                      self.keyfile is False):
                    self.control.draw_text(False,
                                           (1, 0, 'Need path to a kdb-file!'),
                                           (3, 0, 'Press any key'))
                    if self.control.any_key() == -1:
                        return -1
                    continue
                else:
                    return filepath
        elif nav == 1:  # it was asked for last file
            return self.last_file
        elif nav == -1:
            return -1
        else:
            return False
def get_filepath ( self ) : if ( self . ask_for_lf is False or self . last_file is None or self . control . config [ 'rem_db' ] is False ) : nav = self . control . gen_menu ( 1 , ( ( 1 , 0 , 'Use the file browser (1)' ) , ( 2 , 0 , 'Type direct path (2)' ) ) ) else : nav = self . control . gen_menu ( 1 , ( ( 1 , 0 , 'Use ' + self . last_file + ' (1)' ) , ( 2 , 0 , 'Use the file browser (2)' ) , ( 3 , 0 , 'Type direct path (3)' ) ) ) if ( ( self . ask_for_lf is True and self . last_file is not None and nav == 2 ) or ( ( self . last_file is None or self . ask_for_lf is False ) and nav == 1 ) ) : if self . keyfile is True : filepath = self . browser ( ) else : filepath = self . browser ( ) if type ( filepath ) is str : if filepath [ - 4 : ] != '.kdb' and filepath is not False : filename = Editor ( self . control . stdscr , max_text_size = 1 , win_location = ( 0 , 1 ) , win_size = ( 1 , 80 ) , title = "Filename: " ) ( ) if filename == "" : return False filepath += '/' + filename + '.kdb' return filepath if ( ( self . ask_for_lf is True and self . last_file is not None and nav == 3 ) or ( ( self . last_file is None or self . ask_for_lf is False ) and nav == 2 ) ) : filepath = '' while True : if self . last_file : init = self . last_file else : init = '' filepath = self . get_direct_filepath ( filepath ) if filepath is False : return False elif filepath == - 1 : return - 1 elif ( ( filepath [ - 4 : ] != '.kdb' or isdir ( filepath ) ) and self . keyfile is False ) : self . control . draw_text ( False , ( 1 , 0 , 'Need path to a kdb-file!' ) , ( 3 , 0 , 'Press any key' ) ) if self . control . any_key ( ) == - 1 : return - 1 continue else : return filepath elif nav == 1 : # it was asked for last file return self . last_file elif nav == - 1 : return - 1 else : return False