Exemplo n.º 1
0
 def on_source_change(change):
     view_options.children = []
     if sources.value == 'api':
         view_options.children = [info_api, settings_ds.api()]
     elif sources.value == 'direct':
         view_options.children = [info_direct, settings_ds.direct()]
     config.set_value(['set', 'data_source'], sources.value)
Exemplo n.º 2
0
def set_api_account(url, username, password):
    from cbm.utils import config
    config.set_value(['api', 'url'], url)
    config.set_value(['api', 'user'], username)
    config.set_value(['api', 'pass'], password)
    print("The 'api' key in config/main.json file is updated:")
    print(config.get_value(['api']))
Exemplo n.º 3
0
 def wb_save_on_click(b):
     progress.clear_output()
     config.set_value(['api', 'url'], str(wt_url.value).replace(' ', ''))
     config.set_value(['api', 'user'], str(wt_user.value).replace(' ', ''))
     if wt_pass.value != '':
         config.set_value(['api', 'pass'], str(
             wt_pass.value).replace(' ', ''))
     outlog("The RESTful API credentials are saved.")
Exemplo n.º 4
0
 def wb_save_on_click(b):
     progress.clear_output()
     dscode = ds_code.value
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'tables', 'dias_catalog'], str(tb_dc.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'tables', 'parcels'], str(tb_pr.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'pcolumns', 'parcels_id'], str(tc_id.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'pcolumns', 'crop_names'], str(tc_cn.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'pcolumns', 'crop_codes'], str(tc_cc.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'tables', 's2'], str(tb_s2.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'tables', 'bs'], str(tb_bs.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'tables', 'c6'], str(tb_6c.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'db'], str(ds_db.value))
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'description'], str(ds_desc.value))
     config.set_value(
         ['dataset', f'{dscode}_{str(ds_year.value)}', 'center'],
         f"{map_cent_lat.value},{map_cent_lon.value}")
     config.set_value(['dataset', f'{dscode}_{str(ds_year.value)}',
                       'zoom'], str(map_zoom.value))
     config.set_value(['set', 'dataset'],
                      f'{dscode}_{str(ds_year.value)}')
     config.set_value(['set', 'ds_year'], str(ds_year.value))
     values = config.read()
     ds_c = values['set']['dataset']
     dsc.options = [d for d in values['dataset']]
     dsc.value = ds_c
     outlog("The configurations are saved.")
Exemplo n.º 5
0
 def on_dsc_change(change):
     config.set_value(['set', 'dataset'], dsc.value)
Exemplo n.º 6
0
    def wb_save_on_click(b):
        progress.clear_output()
        # Save database connection information
        config.set_value(['db', db, 'host'], str(db_host.value))
        config.set_value(['db', db, 'port'], str(db_port.value))
        config.set_value(['db', db, 'name'], str(db_name.value))
        config.set_value(['db', db, 'user'], str(db_user.value))
        config.set_value(['db', db, 'pass'], str(db_pass.value))
        # Save Object storage connection information
        config.set_value(['s3', 'dias'], str(os_dias.value))
        config.set_value(['s3', 'host'], str(os_host.value))
        config.set_value(['s3', 'bucket'], str(os_bucket.value))
        config.set_value(['s3', 'access_key'], str(os_access_key.value))
        config.set_value(['s3', 'secret_key'], str(os_secret_key.value))

        outlog("All changes are saved.")
Exemplo n.º 7
0
 def btn_save_on_click(b):
     progress.clear_output()
     config.set_value(['set', 'user'], str(user_name.value))
     config.set_value(['set', 'email'], str(user_email.value))
     config.set_value(['set', 'institution'], str(user_institution.value))
     config.set_value(['set', 'member_state'], str(user_email.value))
     config.set_value(['set', 'plimit'], str(plimit.value))
     config.set_value(['paths', 'data'], str(path_data.value))
     config.set_value(['paths', 'temp'], str(path_temp.value))
     outlog("The new settings are saved.")
Exemplo n.º 8
0
 def on_jupyterlab_change(change):
     config.set_value(['set', 'jupyterlab'], str(jupyterlab.value))