Exemple #1
0
def start(urwid, add, get, list, export_data, import_data):

    if import_data is not None:
        if controller.import_data(import_data):
            print('Import successful')
        else:
            print('Somethings wrong!')

    if export_data is not None:
        if controller.export_data(export_data):
            print('Export successful!')
        else:
            print('Somethings wrong!')

    if initdb() is not True:
        create_user()
        print('User created!')

    if urwid:
        print('Login!')
        username = str(input('User: '******'Pass: '******'User:'******'Pass: '******'Service: {}'.format(result.service))
                print('User: {}'.format(result.name))
                print('Password: {}'.format(result.password))
                print('Note: {}'.format(result.note))
            else:
                print('could not find service')
        else:
            print('wrong cridentials')

    if add:
        service = str(input('Service: '))
        username = str(input('Username: '******'Password: '******'Note: '))
        if controller.add_service(service, username, password, note):
            print('{} saved.'.format(service))
        else:
            print('Something when wrong, sorry')

    if list:
        print('|'+'-'*55+'|')        
        print('| {:>25} | {:25} |'.format('Service', 'Username'))
        print('|'+'-'*55+'|')
        for service in controller.list_all_services():
            print('| {:>25} | {:25} |'.format(service[0], service[1]))
        print('|'+'-'*55+'|')        
Exemple #2
0
    def service_list(self, btn):

        self.open_box(
            self.menu('Services', [
                self.button(user[0], self.service_detail, user[2])
                for user in controller.list_all_services()
            ]+[
                urwid.Text('\n\n'),
                self.button('Back', self.back)
            ]
        ))