Ejemplo n.º 1
0
import dash_sortable_select
import dash
import dash_html_components as html
import dash_core_components as dcc

from flask import send_from_directory
import os

app = dash.Dash('')

app.scripts.config.serve_locally = True

app.layout = html.Div([

    html.Link(
        rel='stylesheet',
        href='/static/example.css'
    ),
    dash_sortable_select.MultiSelectSortableField(id="input",
        options=[{'label': 'Chocolate', 'value': 'chocolate' },
      { 'label': 'Vanilla', 'value': 'vanilla' },
      { 'label': 'Strawberry', 'value': 'strawberry' },
      { 'label': 'Caramel', 'value': 'caramel' },
      { 'label': 'Cookies and Cream', 'value': 'cookiescream' },
      { 'label': 'Peppermint', 'value': 'peppermint' }],
        value=['chocolate'])
    ,
    html.Div(id='output'),
    dcc.Dropdown(
        id='player-dropdown',
        options=[{'label': 'Chocolate', 'value': 'chocolate' },
      { 'label': 'Vanilla', 'value': 'vanilla' },
Ejemplo n.º 2
0
            dbc.Card(
                [
                    dbc.CardBody([
                        dbc.CardTitle("This card has a title"),
                        dbc.CardText("and some text, but no header"),
                    ])
                ],
                outline=True,
                color="primary",
                className="card",
            ),
        ],
                 className='card'),
    ],
             className='ten columns offset-by-one'),
    html.Link(href='/assets/stylesheet.css', rel='stylesheet'),
    gdc.Import(src="https://code.jquery.com/jquery-3.3.1.min.js"),
    gdc.Import(src="assets\z.js"),
    html.Div([
        dash_dangerously_set_inner_html.DangerouslySetInnerHTML('''
        



<!-- some content to allow scrolling :)-->
<div class="hero">
  <div class="overlay"></div>
</div>
<div class="main-content">
  <section>
    <div class="container">
Ejemplo n.º 3
0
                                           max_queue_duo, shifts)),
                             dcc.Graph(
                                 id='parking-graph',
                                 figure=charts.build_static_parquink(
                                     max_par_carregues,
                                     max_par_descarregues, max_par_duo,
                                     shifts))
                         ]),
                     ]),
             ],
             value="real_time_tab",
         )
     ],
     className="row tabs_div"),
 html.Link(
     href="https://use.fontawesome.com/releases/v5.2.0/css/all.css",
     rel="stylesheet"),
 html.Link(
     href=
     "https://cdn.rawgit.com/plotly/dash-app-stylesheets/2d266c578d2a6e8850ebce48fdb52759b2aef506/stylesheet-oil-and-gas.css",
     rel="stylesheet"),
 html.Link(href="https://fonts.googleapis.com/css?family=Dosis",
           rel="stylesheet"),
 html.Link(href="https://fonts.googleapis.com/css?family=Open+Sans",
           rel="stylesheet"),
 html.Link(href="https://fonts.googleapis.com/css?family=Ubuntu",
           rel="stylesheet"),
 html.Link(
     href=
     "https://cdn.rawgit.com/amadoukane96/8a8cfdac5d2cecad866952c52a70a50e/raw/cd5a9bf0b30856f4fc7e3812162c74bfc0ebe011/dash_crm.css",
     rel="stylesheet")
Ejemplo n.º 4
0
app.layout = html.Div([
    html.Div([
        html.Span("Strong Workforce Program Uses of Regional Share", className='app-title')
        ],
        className='row header', style={'padding-top':'10px', 'background':'#00c6ff',
'background': '-webkit-linear-gradient(to right, #00c6ff, #0072ff)',
'background': 'linear-gradient(to right, #00c6ff, #0072ff)' }
        ),

    #### html.Div class row
    #### INDICATORS HERE
    #### INDICATORS HERE
    #### INDICATORS HERE
    #### INDICATORS HERE

    dcc.RadioItems(
        id='radio-items',
        options = [
            {'label': 'Statewide', 'value': 'statewide'},
            {'label': 'Bay Area', 'value': 'bay_area_chart'},
            {'label': 'Central/Mother Lode', 'value': 'central_mother_lode_chart'},
            {'label': 'Inland Empire/Desert', 'value': 'inland_empire_desert_chart'},
            {'label': 'Los Angeles/Orange County', 'value': 'los_angeles_orange_county_chart'},
            {'label': 'North/Far North', 'value': 'north_far_north_chart'},
            {'label': 'San Diego/Imperial', 'value': 'san_diego_imperial_chart'},
            {'label': 'South Central Coast', 'value': 'south_central_coast'},
            ],
        value = 'statewide',
        labelStyle={'display': 'inline-block'}
        ),

    ### test radio items
    dcc.RadioItems(
        id='radio-items2',
        options = [
            {'label': 'USA', 'value': 'usa'},
            {'label': 'CHINA', 'value': 'china'},
            ],
        value = 'INSIDE RADIO ITEMS',
        labelStyle={'display': 'inline-block'}
        ),

    html.Div([
        html.Div(id='tab-content', className='row', style={"margin": "2% 3%"}), 
        #html.Div(id='bar-chart-content', className='row', style={"margin": "2% 3%"}), 
        html.Div([
            html.P("Test bar chart content title html.P"), 

            #place each graph here in the children section
            html.Div(id = 'bar-chart-div'), 
            ], className='six columns chart_div'), 

        html.P("LSJDFLKSDJFLKJS LJLKFJSDLKFJ", className='row'), 

        ], className='row', style={'marginTop': '5px'}), 

    html.Div([
        html.Div(id='main-content', className='row', style={"margin": "2% 3%"}), 
        #html.Div(id='bar-chart-content', className='row', style={"margin": "2% 3%"}), 
        html.Div([
            html.P("Test bar chart content title html.P"), 

            #place each graph here in the children section
            ], className='six columns chart_div'), 


        ], className='row', style={'marginTop': '5px'}), 


    html.Link(href="https://use.fontawesome.com/releases/v5.2.0/css/all.css",rel="stylesheet"),
html.Link(href="https://cdn.rawgit.com/plotly/dash-app-stylesheets/2d266c578d2a6e8850ebce48fdb52759b2aef506/stylesheet-oil-and-gas.css",rel="stylesheet"),
    html.Link(href="https://fonts.googleapis.com/css?family=Dosis", rel="stylesheet"),
    html.Link(href="https://fonts.googleapis.com/css?family=Open+Sans", rel="stylesheet"),
    html.Link(href="https://fonts.googleapis.com/css?family=Ubuntu", rel="stylesheet"),
html.Link(href="https://cdn.rawgit.com/amadoukane96/8a8cfdac5d2cecad866952c52a70a50e/raw/cd5a9bf0b30856f4fc7e3812162c74bfc0ebe011/dash_crm.css", rel="stylesheet")
    ], className='row', style={'marginTop': '5px'})
Ejemplo n.º 5
0
import dash
import dash_html_components as html
import dash_core_components as dcc
import os

from flask import send_from_directory

app = dash.Dash()

app.css.config.serve_locally = True
app.scripts.config.serve_locally = True

app.layout = html.Div([
    html.Link(
        rel='stylesheet',
        href='static/stylesheet.css'  # E:/python_git/python/dash/useDash/
    ),
    html.Div('Hello world'),
    html.Button('prev', id='prev-button', style={'float': 'left'}),
    html.Button('next', id='next-button', style={'float': 'left'})
])


@app.server.route('/static/<path:path>')
def static_file(path):
    static_folder = os.path.join(os.getcwd(), 'static')
    return send_from_directory(static_folder, path)


if __name__ == '__main__':
    app.run_server(debug=True)
Ejemplo n.º 6
0
import dash
import dash_core_components as dcc
import dash_html_components as html
import pandas as pd
import plotly.graph_objs as go

app = dash.Dash()

df = pd.read_csv('indicators.csv')

# df.to_csv('indicators.csv')

available_indicators = df['Indicator Name'].unique()

app.layout = html.Div([
    html.Link(rel='stylesheet', href='/static/bWLwgP.css'),
    html.Div([
        html.Div([
            dcc.Dropdown(id='xaxis-column',
                         options=[{
                             'label': i,
                             'value': i
                         } for i in available_indicators],
                         value='Fertility rate, total (births per woman)'),
            dcc.RadioItems(id='xaxis-type',
                           options=[{
                               'label': i,
                               'value': i
                           } for i in ['Linear', 'Log']],
                           value='Linear',
                           labelStyle={'display': 'inline-block'})
Ejemplo n.º 7
0
    def run(self):

        app = dash.Dash()
        app.css.config.serve_locally = True
        app.scripts.config.serve_locally = True
        app.layout = html.Div([
            html.Link(rel='stylesheet', href='/static/stylesheet.css'),
            html.Div(
                [
                    html.Div(
                        [
                            html.P('Realtime Control: '),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            # the button controls
                            dcc.Dropdown(id='name-dropdown',
                                         options=[{
                                             'label': name,
                                             'value': name
                                         } for name in self.portnames],
                                         placeholder='Select Port',
                                         value=self.portnames[0]),
                        ],
                        style={
                            'width': '30%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Connect',
                                        id='connectbutton',
                                        type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Save Current Spectrum',
                                        id='savebutton',
                                        type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Baseline',
                                        id='baseline',
                                        type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Autoscale',
                                        id='autoscale',
                                        type='submit'),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Update Histogram',
                                        id='histogram',
                                        type='submit'),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                ],
                style={
                    'width': '100%',
                    'display': 'inline-block'
                }),
            html.Div(
                [
                    # the button controls
                    html.Div(
                        [
                            html.P('Offline File Control: '),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),

                    # the button controls
                    html.Div(
                        [
                            html.Button(children='Read from File',
                                        id='readfromfile',
                                        type='submit'),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(
                                children='Step', id='stepfile', type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Step Back',
                                        id='stepbackfile',
                                        type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(
                                children='Run', id='runfile', type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Reset File Marker',
                                        id='resetfilem',
                                        type='submit'),
                        ],
                        style={
                            'width': '10%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                ],
                style={
                    'width': '100%',
                    'display': 'inline-block'
                }),
            html.Div([
                html.Div(
                    [
                        html.P('Range Min: '),
                    ],
                    style={
                        'width': '10%',
                        'display': 'inline-block',
                        'text-align': 'center'
                    }),
                html.Div(
                    [
                        dcc.Input(id='minimum_range',
                                  placeholder='Enter',
                                  type='text',
                                  value=''),
                    ],
                    style={
                        'width': '10%',
                        'display': 'inline-block',
                        'text-align': 'center'
                    }),
                html.Div(
                    [
                        dcc.RangeSlider(id='range-slider',
                                        count=1,
                                        min=-5,
                                        max=10,
                                        step=0.5,
                                        value=[-3, 7]),
                    ],
                    style={
                        'width': '60%',
                        'display': 'inline-block',
                        'text-align': 'center'
                    }),
                html.Div(
                    [
                        html.P('Range Max: '),
                    ],
                    style={
                        'width': '10%',
                        'display': 'inline-block',
                        'text-align': 'center'
                    }),
                html.Div(
                    [
                        dcc.Input(id='maximum_range',
                                  placeholder='Enter',
                                  type='text',
                                  value=''),
                    ],
                    style={
                        'width': '10%',
                        'display': 'inline-block',
                        'text-align': 'center'
                    }),
            ],
                     style={
                         'width': '100%',
                         'display': 'inline-block'
                     }),
            html.Div([html.Div(id='output-container-range-slider')],
                     style={
                         'width': '100%',
                         'display': 'inline-block'
                     }),

            # The graph.
            dcc.Graph(id='live-update-image',
                      animate=False,
                      config={'displayModeBar': False}),
            dcc.Graph(id='live-update-histogram',
                      animate=False,
                      config={'displayModeBar': False}),
            dcc.Interval(id='interval-component',
                         interval=PLOT_REFRESH_INTERVAL),
        ])

        @app.server.route('/static/<path:path>')
        def static_file(path):
            static_folder = os.path.join(os.getcwd(), 'static')
            return send_from_directory(static_folder, path)

        @app.callback(dash.dependencies.Output('savebutton', 'children'),
                      [dash.dependencies.Input('savebutton', 'n_clicks')])
        def callback_dropdown(n_clicks):
            if n_clicks is not None:
                try:
                    if self.recording == False:
                        print('start recording')
                        self.controller.start_recording()
                    else:
                        print('stop recording')
                        self.controller.stop_recording()
                except:
                    print('could not record')
                    self.recording = False
            if self.recording is True:
                return 'Stop Recording'
            else:
                return 'Record'

        @app.callback(
            dash.dependencies.Output(component_id='connectbutton',
                                     component_property='children'),
            [
                dash.dependencies.Input(component_id='connectbutton',
                                        component_property='n_clicks'),
                dash.dependencies.Input(component_id='name-dropdown',
                                        component_property='value')
            ])
        def connect(n_clicks, dropdown_value):
            if n_clicks is not None:
                try:
                    if self.connected == False:
                        print('connect')
                        self.controller.connect(str(dropdown_value))
                    else:
                        print('disconnect')
                        self.controller.disconnect()
                except:
                    print('could not connect, is the device plugged in?')
                    self.connected = False
            if self.connected is True:
                return 'Disconnect'
            else:
                return 'Connect'

        @app.callback(
            dash.dependencies.Output('output-container-range-slider',
                                     'children'),
            [dash.dependencies.Input('range-slider', 'value')])
        def update_output(value):
            return 'You have selected "{}"'.format(value)

        @app.callback(Output('live-update-image', 'figure'),
                      events=[Event('interval-component', 'interval')])
        def update_graph_scatter():
            # update the data queue.
            #self.process_data()

            data3 = plotly_trisurf(x,
                                   y,
                                   z,
                                   faces,
                                   colormap=cm.RdBu,
                                   plot_edges=None)

            title="Trisurf from a PLY file<br>"+\
                            "Data Source:<a href='http://people.sc.fsu.edu/~jburkardt/data/ply/airplane.ply'> [1]</a>"

            noaxis = dict(showbackground=False,
                          showline=False,
                          zeroline=False,
                          showgrid=False,
                          showticklabels=False,
                          title='')

            fig3 = go.Figure(data=data3, layout=layout)
            fig3['layout'].update(
                dict(title=title,
                     width=1000,
                     height=1000,
                     scene=dict(
                         xaxis=noaxis,
                         yaxis=noaxis,
                         zaxis=noaxis,
                         aspectratio=dict(x=1, y=1, z=0.4),
                         camera=dict(eye=dict(x=1.25, y=1.25, z=1.25)))))

            py.iplot(fig3, filename='Chopper-Ply-cls')

            # if len(self.data_dict.keys()) > 0:
            #     trace1 = go.Scatter(
            #         x=list(self.data_dict.keys()),
            #         y=list(self.data_dict.values()),
            #         mode='lines',
            #         name='PSD',
            #         line={'shape': 'spline'},
            #         fill='tozeroy'
            #     )

            #     data = [trace1]

            #     layout = go.Layout(
            #         title='Bioimpedance Spectroscopy',
            #         xaxis=dict(
            #             title='Frequency (Hz)',
            #             type='linear',
            #             autorange=True
            #         ),
            #         yaxis=dict(
            #             title='Amplitude',
            #             autorange=True
            #         )
            #     )

            return {'data': data, 'layout': layout}

        # @app.callback(
        #     Output('live-update-spectrogram', 'figure'),
        #     events=[Event('interval-component', 'interval')])
        # def update_graph_scatter():
        #     # update the data queue.
        #     self.process_data()

        #     if len(self.data_dict.keys()) > 0:
        #         trace1 = go.Scatter(
        #             x=list(self.data_dict.keys()),
        #             y=list(self.data_dict.values()),
        #             mode='lines',
        #             name='PSD',
        #             line={'shape': 'spline'},
        #             fill='tozeroy'
        #         )

        #         data = [trace1]

        #         layout = go.Layout(
        #             title='Bioimpedance Spectroscopy',
        #             xaxis=dict(
        #                 title='Frequency (Hz)',
        #                 type='linear',
        #                 autorange=True
        #             ),
        #             yaxis=dict(
        #                 title='Amplitude',
        #                 autorange=True
        #             )
        #         )

        #         return {'data': data, 'layout': layout}
        #
        # _LOGGER.debug('App running at: http://localhost:%s' % PORT)
        app.run_server(port=PORT)
Ejemplo n.º 8
0
# pylint disable: E265
#-- 1 app instance

#<link href="https://use.fontawesome.com/releases/v5.0.2/css/all.css" rel="stylesheet">
#<script defer src="https://use.fontawesome.com/releases/v5.0.2/js/all.js"></script>

app = dash.Dash()
app.config['suppress_callback_exceptions'] = True
# app.css.append_css({
#     'external_url': 'https://use.fontawesome.com/releases/v5.0.2/css/all.css'
# })
app.css.config.serve_locally = True

stylesheets = html.Div([
    html.Link(rel='stylesheet', href='/static/css/chriddyp.css'),
    html.Link(rel='stylesheet', href='/static/css/fontawesome-all.css'),
])
#-- 2 app layout

content_top = [
    html.Div(
        # ROW with themeisle and logo
        [
            html.I(className='fab fa-themeisle fa-2x',
                   style={
                       'color': 'black',
                       'display': 'inline-block',
                   }),
            html.Pre(' ', style={'display': 'inline-block'}),
            html.Img(
Ejemplo n.º 9
0
def display_output(field, operator, value):
    if field is None:
        return '{}'
    else:
        return format_query_string(field, operator, value)


### CSS settings ###
BACKGROUND = 'rgb(230, 230, 230)'
COLORSCALE = [[0, "rgb(244,236,21)"], [0.3, "rgb(249,210,41)"],
              [0.4, "rgb(134,191,118)"], [0.5, "rgb(37,180,167)"],
              [0.65, "rgb(17,123,215)"], [1, "rgb(54,50,153)"]]

# loading css files
css_files = [
    "dash_extra.css", "skeleton.min.css", "googleapis.raleway.css",
    "googleapis.dosis.css", "webstract.css", "annotation_styles.css"
]

stylesheets_links = []
for css in css_files:
    stylesheets_links.append(
        html.Link(rel='stylesheet', href='/static/css/' + css))

app.css.append_css(
    {'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'})

if __name__ == '__main__':
    print("starting...")
    app.run_server(debug=True)
Ejemplo n.º 10
0
    layout = []
    s = 'live-update-text-'
    for row in LAYOUT:
        row_elements = []
        for col in row:
            row_elements.append(html.Div([html.Div(id='{}{}'.format(s, col[0]))],
                                         className='{} columns'.format(col[1]), style={'margin':1})) 

        layout.append(html.Div(row_elements, className='row'))

    return layout

layout = [
        # uncomment next line (and a few lines at beginning of script if using local css file
        html.Link(href='/assets/bWLwgP.css', rel='stylesheet'), 
        dcc.Interval(
        id='interval-component',
        interval=5000, # in milliseconds
        n_intervals=0)
         ]

layout.extend(create_layout())
app.layout = html.Div(layout)

#app.css.append_css({'external_url': 'https://codepen.io/chriddyp/pen/bWLwgP.css'})

# code below enables generating callbacks programatically v. having to write each one out
def create_callback(n, bcolor, tcolor, row_height):
    def callback(input_value): # input_value is n_intervals
        return generate_html(n, bcolor, tcolor, row_height)
import pandas as pd
from stock import *
import multiprocessing as mp
import warnings
warnings.simplefilter(action='ignore', category=Warning)

server = Flask(__name__)
app = dash.Dash(__name__, static_folder='assets', server=server)
api = Api(server)
app.scripts.config.serve_locally = True
app.css.config.serve_locally = True

app.title = 'UT Dallas'
app.layout = html.Div(
    [
        html.Link(href='/assets/normalize.css', rel='stylesheet'),
        html.H1(
            'Programming for Data Science - J\'s Finance Explorer',
            style={'fontSize': 22}),
        dcc.Dropdown(
            id='dropdown',
            options=[{
                'label': 'Apple',
                'value': 'AAPL'
            }, {
                'label': 'Google',
                'value': 'GOOGL'
            }, {
                'label': 'Microsoft',
                'value': 'MSFT'
            }],
Ejemplo n.º 12
0
import plotly.graph_objs as go

app = dash.Dash(__name__, static_folder='../assets')

colors = {'background': '#000000', 'text': '#ffffff'}

app.css.config.serve_locally = True
app.config.supress_callback_exceptions = True
app.scripts.append_script({
    'external_url': '../assets/jquery-3.3.1.min.js',
})
app.scripts.append_script({'external_url': '../assets/demo.js'})
app.scripts.append_script({'external_url': '../assets/plotly-1.38.0.min.js'})

app.layout = html.Div(children=[
    html.Link(href='../assets/demo.css', rel='stylesheet'),
    html.Link(href='../assets/style1.css', rel='stylesheet'),
    html.Link(href='../assets/style2.css', rel='stylesheet'),
    html.Link(href='../assets/style3.css', rel='stylesheet'),
    dcc.Location(id='url', refresh=False),
    html.Ul(id='para', key='para'),
    html.Div(style={'backgroundColor': colors['background']},
             children=[
                 html.H1(html.A('DASH WEB DEMO', href='/'),
                         style={
                             'textAlign': 'left',
                             'padding': '25px',
                             'color': colors['text']
                         })
             ]),
    html.Div(
Ejemplo n.º 13
0
#### ----- Step 2 (Plot data)----

# Plot column 'Confirmed'
fig1 = px.bar(date_wise_total_csv,
              x='Day',
              y='TotalConfirmed',
              title="Covid Confirmed Cases")
fig2 = px.bar(date_wise_total_csv,
              x='Day',
              y='Deaths',
              title="Covid Death Cases")

app = dash.Dash()

app.layout = html.Div([
    html.Link(rel='stylesheet',
              href='E:/Study/sem7/BDAD/Project/assets/test.css'),
    #  html.H1(style:{background: blue}
    #         "DASHBOARD"),
    html.Div([
        html.Div(className="header",
                 children=html.Div([
                     html.P('DASHBOARD',
                            style={
                                'font-size': '20',
                                'color': 'white'
                            })
                 ])),
        html.Div(
            className="header",
            children=html.Div([
                html.
Ejemplo n.º 14
0
    def return_layout(self):

        self.layout = html.Div( [
                html.Link(
                    rel='stylesheet',
                    href='/static/bootstrap.min.css'
                ),

                dcc.Graph(
                    id='live-update-time-series',
                    animate=False,
                    config={
                        'displayModeBar': False
                    }
                ),
                dcc.Graph(
                    id='live-update-psd',
                    animate=False,
                    config={
                        'displayModeBar': False
                    }
                ),
                dcc.Interval(
                    id='interval-component',
                    interval=PLOT_REFRESH_INTERVAL,
                    n_intervals=0
                ),

            ] )      
         
        @self.app.callback(Output('live-update-time-series', 'figure'),
                      [Input('interval-component', 'n_intervals')])
        def update_graph_scatter(n):
            self.mode = self.controller.serial_getmode()
            if 'a' in self.mode:
                # update from the data queue. 
                self.process_data()

            if len(self.x) > 0:
                trace1 = go.Scatter(
                    x=self.x,
                    y=self.y,
                    mode='lines',
                    name='Data',
                    # line={'shape': 'spline'}
                )

                data = [trace1]

                if len(self.y_filtered) > 0:
                    trace2 = go.Scatter(
                        x=self.x,
                        y=self.y_filtered,
                        mode='lines',
                        name='Filtered Data',
                        # line={'shape': 'spline'}
                    )
                    data.append(trace2)

                x_min = min(self.x)
                x_max = max(self.x)
                y_min = min(self.y)
                y_max = max(self.y)

                layout = go.Layout(
                    title='Time Series Data',
                    xaxis=dict(
                        title='Time',
                        range=[x_min, x_max]
                    ),
                    yaxis=dict(
                        title='Impedance (ohms)',
                        range=[y_min, y_max]
                    ),

                )

                return {'data': data, 'layout': layout}

        @self.app.callback(Output('live-update-psd', 'figure'),
                      [Input('interval-component', 'n_intervals')])
        def update_graph_scatter(n):
            if len(self.x) > 0:
                trace1 = go.Scatter(
                    x=self.freqs,
                    y=self.psd,
                    mode='lines',
                    name='PSD',
                    line={'shape': 'spline'},
                    fill='tozeroy'
                )

                data = [trace1]

                layout = go.Layout(
                    title='Power Spectrum Density',
                    xaxis=dict(
                        title='Frequency (Hz)',
                        type='log',
                        autorange=True
                    ),

                    yaxis=dict(
                        title='Power (dB)',
                        autorange=True
                    )
                )

                return {'data': data, 'layout': layout}
        #         
        return self.layout
Ejemplo n.º 15
0
    def run(self):

        app = dash.Dash()
        app.css.config.serve_locally = True
        app.scripts.config.serve_locally = True
        app.layout = html.Div([
            html.Link(rel='stylesheet', href='/static/stylesheet.css'),
            html.Div(
                [
                    html.Div(
                        [
                            # the button controls
                            dcc.Dropdown(id='name-dropdown',
                                         options=[{
                                             'label': name,
                                             'value': name
                                         } for name in self.portnames],
                                         placeholder='Select Port',
                                         value=self.portnames[0]),
                        ],
                        style={
                            'width': '60%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Connect',
                                        id='connectbutton',
                                        type='submit'),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Save Current Spectrum',
                                        id='savebutton',
                                        type='submit'),
                        ],
                        style={
                            'width': '15%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                ],
                style={
                    'width': '100%',
                    'display': 'inline-block'
                }),

            # The graph.
            dcc.Graph(id='live-update-spectrogram',
                      animate=False,
                      config={'displayModeBar': False}),
            dcc.Interval(id='interval-component',
                         interval=PLOT_REFRESH_INTERVAL),

            # html.Div([
            # html.P(id='connectbuttoncall',children='connectbuttoncall'),
            #     html.P(id='savebuttoncall',children='savebuttoncall'),
            # ], style={'width': '100%', 'display': 'inline-block'})
        ])

        @app.server.route('/static/<path:path>')
        def static_file(path):
            static_folder = os.path.join(os.getcwd(), 'static')
            return send_from_directory(static_folder, path)

        @app.callback(dash.dependencies.Output('savebutton', 'children'),
                      [dash.dependencies.Input('savebutton', 'n_clicks')])
        def callback_dropdown(n_clicks):
            if n_clicks is not None:
                try:
                    if self.recording == False:
                        print('start recording')
                        self.controller.start_recording()
                    else:
                        print('stop recording')
                        self.controller.stop_recording()
                except:
                    print('could not record')
                    self.recording = False
            if self.recording is True:
                return 'Stop Recording'
            else:
                return 'Record'

        @app.callback(
            dash.dependencies.Output(component_id='connectbutton',
                                     component_property='children'),
            [
                dash.dependencies.Input(component_id='connectbutton',
                                        component_property='n_clicks'),
                dash.dependencies.Input(component_id='name-dropdown',
                                        component_property='value')
            ])
        def connect(n_clicks, dropdown_value):
            if n_clicks is not None:
                try:
                    if self.connected == False:
                        print('connect')
                        self.controller.connect(str(dropdown_value))
                    else:
                        print('disconnect')
                        self.controller.disconnect()
                except:
                    print('could not connect, is the device plugged in?')
                    self.connected = False
            if self.connected is True:
                return 'Disconnect'
            else:
                return 'Connect'

        @app.callback(Output('live-update-spectrogram', 'figure'),
                      events=[Event('interval-component', 'interval')])
        def update_graph_scatter():
            # update the data queue.
            self.process_data()

            if len(self.data_dict.keys()) > 0:
                trace1 = go.Scatter(x=list(self.data_dict.keys()),
                                    y=list(self.data_dict.values()),
                                    mode='lines',
                                    name='PSD',
                                    line={'shape': 'spline'},
                                    fill='tozeroy')

                data = [trace1]

                layout = go.Layout(title='Bioimpedance Spectroscopy',
                                   xaxis=dict(title='Frequency (Hz)',
                                              type='linear',
                                              autorange=True),
                                   yaxis=dict(title='Amplitude',
                                              autorange=True))

                return {'data': data, 'layout': layout}

        #
        # _LOGGER.debug('App running at: http://localhost:%s' % PORT)
        app.run_server(port=PORT)
Ejemplo n.º 16
0
canvas_width = 800
shape = (200, 800)

chars = string.ascii_lowercase + "0123456789"
# -------------------------------------------------------------------- #

external_stylesheets = [
    'https://stackpath.bootstrapcdn.com/bootswatch/4.5.0/litera/bootstrap.min.css'
] + ['https://codepen.io/chriddyp/pen/bWLwgP.css']

# -------------------------------------------------------------------- #
# -------------------------------------------------------------------- #

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

app.head = [html.Link(rel='stylesheet', href='style.css')]

app.layout = html.Div(
    id='grad1',
    children=[

        # H1 title
        html.Div([
            html.H1(children='Breaking CAPTCHA',
                    style={
                        'text-align': 'center',
                        'font-size': '90px',
                        '-webkit-text-stroke': '5px #4D8394',
                        'color': 'white',
                        'font-weight': 'bold',
                    }),
Ejemplo n.º 17
0
import ipaddress
import dash_table_experiments as dte
from datetime import timedelta
import flask
from IPy import IP
import ipaddress
STATIC_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'static')
app = dash.Dash('hrpi-app')
app.config.supress_callback_exceptions = True
server = app.server
points_per_second = 10
readRange = 100 
aero = AerospikeClient()
aero.connect()

app.layout = html.Div([html.Link(href='/home/user/Desktop/hrpi/static/style.css', rel='stylesheet'),          
    html.Div([ 
     html.H2("HRPI Analyzer"), 
      html.Img(src="/static/ktu.png"),
      html.Img(src="/static/elitnet.png"),
     html.Br(),
     dcc.Tabs(tabs=[{'label': 'Live graph', 'value': 0},{'label': 'History', 'value': 1}],id='tabs')
	],className='banner'),	
        html.Br(),
        html.Div([
            html.Br(),
            html.Div([html.H3("HRPI Graph")], className='Title'),
            html.Div([dcc.Graph(id='hrpi-table'),],className='twelve columns hrpi-table',style={'display':'inline'}),
            dcc.Interval(id='hrpi-table-update', interval=10, n_intervals=0),
            dte.DataTable(
                id='iptable',
# amount of records per table page
PAGE_SIZE = 15

# application object
app = dash.Dash(__name__, server=server, static_folder='static')
auth = dash_auth.BasicAuth(app, VALID_USERNAME_PASSWORD_PAIRS)

# init configuration, second param allow to make dynamic callbacks
app.css.config.serve_locally = True
app.scripts.config.serve_locally = True
app.config['suppress_callback_exceptions'] = True

# static layout
app.layout = html.Div(
    [
        html.Link(href='/static/undo-redo.css', rel='stylesheet'),
        html.Title("PricesCC trading web-interface"),
        html.H5("Pairs from prices RPC call:"),
        dcc.Dropdown(id='my-dropdown', options=options_arg, value='BTC_USD'),
        html.H5("User custom prices:"),
        dcc.Dropdown(id='user-dropdown',
                     options=user_args,
                     value=user_args[0]["value"]),
        dcc.Input(placeholder='Input synthetic for custom graph...',
                  type='text',
                  value='',
                  id='graph_synthetic',
                  style={
                      'marginBottom': 15,
                      'marginTop': 10
                  }),
Ejemplo n.º 19
0
            for cmd in data_names:
                val = connection.query(obd.commands[cmd]).value
                val = float(val.split()[0])
                plot_data[cmd].append(val)
    else:
        for cmd in data_names:
            val = np.random.randint(1, 101)
            plot_data[cmd].append(val)


app.layout = html.Div(
    [
        # html.Link(
        #     rel='stylesheet',
        #     href='/static/style.css'),
        html.Link(rel='stylesheet', href='/static/materialize.css'),
        html.Div([
            html.H2('Vehicle Data', style={
                'float': 'left',
            }),
        ]),
        dcc.Dropdown(id='vehicle-data-name',
                     options=[{
                         'label': s,
                         'value': s
                     } for s in cmds],
                     value=[cmds[0]],
                     multi=True),
        html.Div(children=html.Div(id='graphs'), className='row'),
        # html.Div(id='graphs', className='row'),
        dcc.Interval(id='graph-update', interval=100)
Ejemplo n.º 20
0
                                      family='Courier New, monospace',
                                      size=20,
                                      color='#7f7f7f')),
                             'yaxis':
                             dict(title='y Axis',
                                  titlefont=dict(family='Helvetica, monospace',
                                                 size=20,
                                                 color='#7f7f7f'))
                         },
                         'layout':
                         bg_layout
                     })


app.layout = html.Div([
    html.Link(rel='stylesheet', href='/static/stylesheet.css'),
    html.Link(rel='stylesheet', href='/static/bootstrap.css'),
    html.Link(rel='stylesheet', href='/static/custom.css?version=3.3'),
    html.H1(children='dashboard', className='twelve columns'),
    html.Div(
        [  # row
            html.Div([html.Div(id='example-graph'),
                      graph1(dcc)],
                     className='six columns'),
            html.Div([
                dcc.Graph(id='indicator-graphic'),
                dcc.RangeSlider(
                    id='datetime--slider',
                    min=min,
                    max=max,
                    value=[min, max],
Ejemplo n.º 21
0
                         html.A('user guide',
                                className='link active',
                                href='/'),
                         html.A('plotly',
                                className='link',
                                href='https://plot.ly/'),
                         html.A(children=[html.I(className="fa fa-search")],
                                className='link',
                                href='/search')
                     ])
        ]))

app.title = 'Dash User Guide and Documentation - Dash by Plotly'

app.layout = html.Div(
    [html.Link(rel='stylesheet', href=css_link) for css_link in css] + [
        html.Meta(name='viewport',
                  content='width=device-width, initial-scale=1.0'),
        html.Meta(name='description',
                  content=('Dash User Guide and Documentation. '
                           'Dash is a Python framework for building '
                           'reactive web apps developed by Plotly.')), header,
        html.Div([
            html.Div(id='wait-for-layout'),
            html.Div([
                html.Div(html.Div(id='chapter', className='content'),
                         className='content-container'),
            ],
                     className='container-width')
        ],
                 className='background'),
Ejemplo n.º 22
0

asap_env_list = [
    'DEV1', 'DEd1', 'DEj1', 'DEu1', 'DEp3', 'DEj4', 'DEu4', 'DEp4', 'NLj4',
    'NLu4', 'NLo4', 'NLp4', 'PLj3', 'PLu3', 'PLo3', 'PLp3', 'HUj2', 'HUu2',
    'HUo2', 'HUp2', 'CZj4', 'CZu4', 'CZo4', 'CZp4', 'SKj2', 'SKu2', 'SKo2',
    'SKp2', 'ROj2', 'ROu2', 'ROp2', 'CHj3', 'CHu3', 'CHo3', 'CHp3', 'ATj1',
    'ATu1', 'ATo1', 'ATp1', 'CZj3', 'CZu2', 'CZp2', 'CHj4', 'CHu4', 'CHo4',
    'CHp4', 'ATj4', 'ATu4', 'ATo4', 'ATp4', 'ROj1', 'ROu1', 'ROp1', 'IEj3',
    'IEu3', 'IEo3', 'IEp3'
]

#Desiging layout of page
layout = html.Div([
    #Including local stylesheet
    html.Link(href='/static/cdc_layout_style.css', rel='stylesheet'),
    html.Link(href='/static/table_style.css', rel='stylesheet'),
    html.Div([
        dcc.Tabs(
            id="asap_tabs",
            style={
                "height": "5",
                'textAlign': 'center',
                'color': '#008080',
                'cursor': 'pointer',
                'align-items': 'center',
                'justify-content': 'center',
                'fontSize': 20
            },
            #style=tabs_styles,
            children=[
Ejemplo n.º 23
0
from alpha_vantage.techindicators import TechIndicators
from alpha_vantage.timeseries import TimeSeries
import dash
import dash_html_components as html
import dash_core_components as dcc
from dash.dependencies import Input, Output, State
import plotly.graph_objs as go


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash()

app.layout = html.Div([
    html.Link(
            rel='stylesheet',
            href='https://codepen.io/chriddyp/pen/bWLwgP.css'
        ),
    dcc.Input(id='input-box', value='', type='text', placeholder='Enter a Stock symbol', ),
    html.Button('Submit', id='button'),
    html.Div(),
    html.P('5 Calls Per Min'),
    dcc.Graph(
        id='candle-graph', animate=True, style={"backgroundColor": "#1a2d46", 'color':'#ffffff'},),
    html.Div([
            html.P('Developed by: ', style={'display': 'inline', 'color' : 'white'}),
            html.A('Austin Kiese', href='http://www.austinkiese.com'),
            html.P(' - ', style={'display': 'inline', 'color' : 'white'}),
            html.A('*****@*****.**', href='mailto:[email protected]')
        ], className="twelve columns",
            style={'fontSize': 18, 'padding-top': 20}
Ejemplo n.º 24
0
     html.Img(draggable=True,
              style={
                  'height': '20%',
                  'width': '20%'
              },
              src='data:image/png;base64,{}'.format(encoded_image))
 ],
          style={'textAlign': 'center'}),
 html.H2(children='A Tool for the Analysis of Cyclic Voltammetry Data',
         style={
             'textAlign': 'center',
             'color': colors['text']
         }),
 html.Br(),
 html.Div([
     html.Link(rel='stylesheet',
               href='https://codepen.io/rmarren1/pen/eMQKBW.css'),
     dash_resumable_upload.Upload(
         id='upload',
         maxFiles=1,
         maxFileSize=1024 * 1024 * 1000,  # 100 MB
         service="/upload_resumable",
         textLabel="Upload Files",
         startButton=False)
 ]),
 html.Div(id='output_uploaded_file'),
 html.Br(),
 html.H2(children='Select File to Analyze',
         style={
             'textAlign': 'center',
             'color': colors['text']
         }),
Ejemplo n.º 25
0
    'b': 2
}, {
    'a': 'BB',
    'b': 3
}, {
    'a': 'BC',
    'b': 4
}, {
    'a': 'CC',
    'b': 5
}, {
    'a': 'CD',
    'b': 6
}]

app.layout = html.Div([
    html.Link(rel='stylesheet', href='/static/dash-datatable-light-dark.css'),
    html.Div(dt.DataTable(rows=ROWS), className='dark-table'),
    html.Div(dt.DataTable(rows=ROWS), className='light-table')
])


@app.server.route('/static/<path:path>')
def static_file(path):
    static_folder = os.path.join(os.getcwd(), 'static')
    return send_from_directory(static_folder, path)


if __name__ == '__main__':
    app.run_server(debug=True)
Ejemplo n.º 26
0
             className="four columns",
             style=name_style),
    html.Div(html.Span('Costanza Calzolari'),
             className="four columns",
             style=name_style),
    html.Div(html.Span('Margherita Rosnati'),
             className="four columns",
             style=name_style)
]

app.layout = html.Div([

    # Links to fonts and icons
    html.Link(
        rel="stylesheet",
        href="https://use.fontawesome.com/releases/v5.6.0/css/all.css",
        integrity=
        "sha384-aOkxzJ5uQz7WBObEZcHvV5JvRW3TUc2rNPA7pe3AwnsUohiw1Vj2Rgx2KSOkF5+h",
        crossOrigin="anonymous"),
    html.Link(rel="stylesheet",
              href="https://fonts.googleapis.com/css?family=Lato"),
    html.Link(rel="stylesheet",
              href="https://fonts.googleapis.com/css?family=Roboto"),
    html.H1('Natural Email Understanding',
            style={
                "textAlign": "center",
                'paddingTop': "30px",
                "fontFamily": "Roboto, Arial",
                "fontStyle": "bold"
            }),
    html.H2('Automated FAQ Selection in IT Tickets Handling',
            style={"textAlign": "center"}),
Ejemplo n.º 27
0
        ),
        #似乎是存数据的地方 大概率用不到
        # dcc.Store(  # opportunities df
        #     id="opportunities_df",
        #     data="data1",
        # ),
        # dcc.Store(  # leads df
        #     id="leads_df", data="data1"
        # ),
        # dcc.Store(
        #     id="cases_df", data="data1"
        # ),  # cases df
        dcc.Location(id="url", refresh=False),
        html.Div(id="tab_content"),
        html.Link(
            href="https://use.fontawesome.com/releases/v5.2.0/css/all.css",
            rel="stylesheet",
        ),
        html.Link(
            href="https://fonts.googleapis.com/css?family=Dosis", rel="stylesheet"
        ),
        html.Link(
            href="https://fonts.googleapis.com/css?family=Open+Sans", rel="stylesheet"
        ),
        html.Link(
            href="https://fonts.googleapis.com/css?family=Ubuntu", rel="stylesheet"
        ),
    ],
    className="row",
    style={"margin": "0%"},
)
Ejemplo n.º 28
0
def generate_table(dataframe, max_rows=10):
    return html.Table(
        # Header
        [html.Tr([html.Th(col) for col in dataframe.columns])] +

        # Body
        [html.Tr([
            html.Td(dataframe.iloc[i][col]) for col in dataframe.columns
        ]) for i in range(min(len(dataframe), max_rows))]
    )



layout = html.Div(children=[
    html.Div([html.Link(href='/static/whitey.css', rel='stylesheet')]),
    dcc.Markdown('''
# Marsh Water Table Station

Located in the marshland at Finse, this sensor provides the height of the water table in the valley

- Location: 
- Sensor: [Decagon ctd-10](https://www.metergroup.com/environment/products/hydros-21-water-level-monitoring/)
- Database ID: 3390197892757083161
- Available variables :
    - water depth
    - water temperature
    - water electrical conductivity
    - Station battery
    - Station signal reception power (RSSI)
Ejemplo n.º 29
0
                    'http-equiv': 'X-UA-Compatible',
                    'content': 'IE=edge'
                }, {
                    'name': 'viewport',
                    'content': 'width=device-width, initial-scale=1.0'
                }],
                external_stylesheets=external_stylesheets)
app.config.suppress_callback_exceptions = True

versions_order = [
    '18v2_1', '19v1', '19v2', '20v1', '20v2', '20v3', '20v4', '20v5', '20v6',
    '20v7', '20v8', '20v9', '20v10', '20v11', '20v12'
]
app.title = 'EDM QAQC APP'
app.head = [
    html.Link(href='https://use.fontawesome.com/releases/v5.8.2/css/all.css',
              rel='stylesheet'), (style)
]

app.layout = layout


@app.callback(Output('version', 'options'), [Input('none', 'children')])
def refresh_options(none):
    versions = requests.get(f'{base_url}/pluto-qaqc/versions').json()['result']
    versions_options = [{
        'label': i['table_name'],
        'value': i['table_name']
    } for i in versions]
    return versions_options

Ejemplo n.º 30
0
    def return_layout(self):
        full_ports = list(serial.tools.list_ports.comports())
        self.portnames = [item[0] for item in full_ports]
        self.currentport = self.controller.getportname()
        #print (self.currentport)

        self.layout = html.Div([
            html.Link(rel='stylesheet', href='/static/bootstrap.min.css'),
            html.Div(
                [
                    html.Div(
                        [
                            # the button controls
                            dcc.Dropdown(
                                id='name-dropdownfw',
                                options=[{
                                    'label': name,
                                    'value': name
                                } for name in self.portnames],
                                #placeholder = 'hello',
                                value=self.currentport,
                                clearable=False),
                        ],
                        className='btn-group',
                        style={
                            'width': '40%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Connect',
                                        id='connectbuttonfw',
                                        type='submit',
                                        className='btn btn-outline-dark'),
                        ],
                        className='btn-group',
                        style={
                            'width': '20%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                ],
                style={
                    'width': '100%',
                    'display': 'inline-block'
                }),
            html.P(''),
            html.Div(
                [
                    # the button controls
                    html.Div(
                        [
                            dcc.Input(id='send_data',
                                      placeholder='Enter',
                                      type='text',
                                      value='d'),
                        ],
                        style={
                            'width': '20%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Button(children='Send',
                                        id='send',
                                        type='submit',
                                        className='btn btn-outline-dark'),
                        ],
                        style={
                            'width': '20%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                    html.Div(
                        [
                            html.Ul(id="datasent"),
                        ],
                        style={
                            'width': '20%',
                            'display': 'inline-block',
                            'text-align': 'center'
                        }),
                ],
                style={
                    'width': '100%',
                    'display': 'inline-block'
                }),
            html.Div([
                html.Ul(id="current_mode"),
            ],
                     style={
                         'width': '100%',
                         'display': 'inline-block',
                         'text-align': 'center'
                     }),
            html.P(''),
            dcc.Textarea(
                id='textarea',
                #placeholder='',
                value='string',
                contentEditable=False,
                #disabled = True,
                maxLength=500,
                readOnly=True,
                rows=10,
                style={'width': '60%'}),
            html.
            P('A:Time Series, B: Bioimpedance Spectroscopy, C: 8 electrode EIT, D: 16 electrode EIT, E: 32 electrode EIT'
              ),
            dcc.Interval(id='interval-component',
                         interval=PLOT_REFRESH_INTERVAL,
                         n_intervals=0),
        ])

        @self.app.callback(Output('textarea', 'value'),
                           [Input('interval-component', 'n_intervals')])
        def update_textbox(n):
            return self.controller.return_line()

        @self.app.callback(
            Output('datasent', 'children'),
            [Input('send', 'n_clicks'),
             Input('send_data', 'value')])
        def senddata(n_clicks, value):
            if n_clicks is not None:
                if self.connected:
                    data_to_send = str(value) + '\n'
                    self.controller.serial_write(data_to_send)
                    #print (data_to_send)

                    return data_to_send

            return 'connect to send data'

        @self.app.callback(Output('current_mode', 'children'),
                           [Input('interval-component', 'n_intervals')])
        def mode(n):
            m = self.controller.serial_getmode()
            if 'a' in m:
                return 'time series mode'
            elif 'b' in m:
                return 'bioimpedance spectroscopy mode'
            elif 'c' in m:
                return '8 electrode imaging mode'
            elif 'd' in m:
                return '16 electrode imaging mode'
            elif 'e' in m:
                return '32 electrode imaging mode'
            else:
                return 'another mode'

        @self.app.callback(
            Output(component_id='connectbuttonfw',
                   component_property='children'), [
                       Input(component_id='connectbuttonfw',
                             component_property='n_clicks'),
                       Input(component_id='name-dropdownfw',
                             component_property='value')
                   ])
        def connect(n_clicks, dropdown_value):
            if n_clicks is not None:
                try:
                    if self.connected == False:
                        print(str(dropdown_value))
                        self.controller.connect(str(dropdown_value))
                        return 'Disconnect'
                    else:
                        print('disconnect')
                        self.controller.disconnect()
                        return 'Connect'
                except:
                    print('problem')
            if self.connected is True:
                return 'Disconnect'
            else:
                return 'Connect'

        return self.layout