from operator import attrgetter
import random
import datetime

import dash
from dash.dependencies import Input, Output, State
from dash import html
# import dash_core_components as dcc

import dash_geoman as dgm


external_stylesheets=[
    # 'https://cdn3.devexpress.com/jslib/20.1.7/css/dx.common.css',
    # 'https://cdn3.devexpress.com/jslib/20.1.7/css/dx.light.css',
    'https://unpkg.com/leaflet@1.8.0/dist/leaflet.css',
    'https://unpkg.com/@geoman-io/leaflet-geoman-free@2.7.0/dist/leaflet-geoman.css',
]


app = dash.Dash(
    __name__,
    external_stylesheets=external_stylesheets,
    suppress_callback_exceptions=True
)
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True

app.layout = html.Div([
    dgm.Map(id='map')
], style=dict(width='99%', height='99%', position='absolute'))

# @app.callback(Output('div_ddb', 'children'), Input('ddb', 'selectedItemKey'), prevent_initial_call=True)
# def ddb(selectedItemKey):
#     print('ddb selectedItemKey', selectedItemKey)
#     return dash.no_update


if __name__ == '__main__':
    app.run_server(debug=True, dev_tools_serve_dev_bundles=True)
