def updateSpeedInfo(n_clicks, oldSpeed, newSpeed): if n_clicks != None: conn = proj.openConnection(r"proj.sqlite") nclicks = None print("Speeds Updated") with conn: proj.updatespeed(conn, oldSpeed, newSpeed) proj.closeConnection(conn, r"proj.sqlite")
def addIspInfo(n_clicks, isp): if n_clicks != None: conn = proj.openConnection(r"proj.sqlite") nclicks = None print("ISP Added") with conn: proj.insertisp(conn, isp) proj.closeConnection(conn, r"proj.sqlite")
def deleteContractInfo(n_clicks, addr): if n_clicks != None: conn = proj.openConnection(r"proj.sqlite") nclicks = None print("Deleted Contract") with conn: proj.endcontract(conn, addr) proj.closeConnection(conn, r"proj.sqlite")
def insertInfo(n_clicks, loc, num, addr): if n_clicks != None: conn = proj.openConnection(r"proj.sqlite") nclicks = None print("Inserted") with conn: proj.inserthouse(conn, "Address___#" + str(addr), num, loc) proj.closeConnection(conn, r"proj.sqlite")
def updateSpeedDropDown(n_intervals): conn = proj.openConnection(r"proj.sqlite") c = conn.cursor() speeds = "SELECT DISTINCT s_speed FROM speed ORDER BY s_speed" c.execute(speeds) speeds = [{ 'label': str(i[0]) + " mbps", 'value': i[0] } for i in c.fetchall()] proj.closeConnection(conn, r"proj.sqlite") return [speeds]
addrOptions = [] for i in c.fetchall(): allAddresses.append(i[0]) for i in allAddresses: addrOptions.append({'label': i, 'value': i}) speeds = "SELECT DISTINCT s_speed FROM speed ORDER BY s_speed" c.execute(speeds) speeds = [] speedOptions = [] for i in c.fetchall(): speeds.append(i[0]) for i in speeds: speedOptions.append({'label': str(i) + " mbps", 'value': i}) proj.closeConnection(conn, r"proj.sqlite") app.layout = html.Div(children=[ html.H1("Input a new house"), html.Div(id='space'), dcc.Dropdown( id='Loc', options=[{ 'label': 'San Diego', 'value': 'San Diego' }, { 'label': 'Los Angeles', 'value': 'Los Angeles' }, { 'label': 'Merced', 'value': 'Merced'