Пример #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+'|')        
Пример #2
0
 def test_importData_False(self):
     self.assertFalse(controller.import_data(path=BASE_DIR+'/broken.json'))
Пример #3
0
 def test_importData_True(self):
     self.assertTrue(controller.import_data(path=BASE_DIR+'/correct.json'))
Пример #4
0
 def save(btn):
     controller.import_data(path.get_edit_text())
     status.set_text('\nImport success!')