fix deprecated and myp not found

This commit is contained in:
Florian Bezannier
2021-10-23 11:05:02 +02:00
parent 0954b14169
commit 72753b5a09
11 changed files with 28 additions and 15 deletions
+1
View File
@@ -94,6 +94,7 @@ class Config(metaclass=Singleton):
logger.info(str(self.myp.get_vehicles()))
self.is_good = True
else:
self.is_good = False
logger.error("Please reconnect by going to config web page")
if self.args.refresh:
self.myp.info_refresh_rate = self.args.refresh * 60
+4 -4
View File
@@ -3,11 +3,11 @@ from statistics import mean
import dash_bootstrap_components as dbc
import dash_table
from dash_core_components import Graph
from dash_table.Format import Format, Scheme, Symbol
import plotly.express as px
import plotly.graph_objects as go
import dash_html_components as html
from web.tools.import_dash_html import html
from web.tools.import_dash_core import dcc
from libs.car import Car
from libs.elec_price import ElecPrice
@@ -199,7 +199,7 @@ def get_battery_curve_fig(row: dict, car: Car):
battery_curves.append({"level": row["end_level"], "speed": speed})
fig = px.line(battery_curves, x="level", y="speed")
fig.update_layout(xaxis_title="Battery %", yaxis_title="Charging speed in kW")
return html.Div(Graph(figure=fig))
return html.Div(dcc.Graph(figure=fig))
def get_altitude_fig(trip: Trip):
@@ -212,4 +212,4 @@ def get_altitude_fig(trip: Trip):
fig = px.line(res, x=0, y=1)
fig.update_layout(xaxis_title="Distance km", yaxis_title="Altitude m")
conn.close()
return html.Div(Graph(figure=fig))
return html.Div(dcc.Graph(figure=fig))
+1 -1
View File
@@ -1,7 +1,7 @@
import dash_bootstrap_components as dbc
from dash._utils import create_callback_id
from dash.dependencies import Output, Input
import dash_html_components as html
from web.tools.import_dash_html import html
from web.app import dash_app
+1 -1
View File
@@ -1,6 +1,6 @@
import dash_bootstrap_components as dbc
import dash_daq as daq
import dash_html_components as html
from web.tools.import_dash_html import html
from dash.dependencies import Input
from web.app import dash_app
+4 -3
View File
@@ -3,7 +3,8 @@ from logging import DEBUG
from dash._utils import create_callback_id
from dash.dependencies import Output, Input
from dash_core_components import Store
from web.tools.import_dash_core import dcc
from mylogger import logger
@@ -135,5 +136,5 @@ class FigureFilter:
return False
def get_store(self):
return [Store(id='clientside-figure-store', data=self.__get_figures()),
Store(id='clientside-data-store', data=self.src)]
return [dcc.Store(id='clientside-figure-store', data=self.__get_figures()),
dcc.Store(id='clientside-data-store', data=self.src)]
+5
View File
@@ -0,0 +1,5 @@
# pylint: disable=unused-import
try:
from dash import dcc
except ImportError:
import dash_core_components as dcc
+5
View File
@@ -0,0 +1,5 @@
# pylint: disable=unused-import
try:
from dash import html
except ImportError:
import dash_html_components as html
+1 -1
View File
@@ -1,7 +1,7 @@
from datetime import datetime, timedelta
import dash_bootstrap_components as dbc
import dash_html_components as html
from web.tools.import_dash_html import html
from dash.development.base_component import Component
from pandas import DataFrame
from pytz import UTC
+3 -2
View File
@@ -9,8 +9,8 @@ from otp.otp import new_otp_session
from web.app import dash_app
import dash_bootstrap_components as dbc
from dash.dependencies import Output, Input, State
import dash_core_components as dcc
import dash_html_components as html
from web.tools.import_dash_core import dcc
from web.tools.import_dash_html import html
config = Config()
login_config_layout = dbc.Row(dbc.Col(md=12, lg=2, children=[
@@ -147,6 +147,7 @@ def connectPSA(n_clicks, app_name, email, password, countrycode): # pylint: dis
try:
res = firstLaunchConfig(app_name, email, password, countrycode)
config.load_app()
config.start_remote_control()
return dbc.Alert([res, html.A(" Go to otp config", href=request.url_root + "config_otp")], color="success")
except Exception as e:
res = str(e)
+1 -1
View File
@@ -1,5 +1,5 @@
import dash_bootstrap_components as dbc
import dash_html_components as html
from web.tools.import_dash_html import html
from mylogger import logger
from web.tools.Button import Button
+2 -2
View File
@@ -5,8 +5,6 @@ from urllib.parse import parse_qs, urlparse
import dash_bootstrap_components as dbc
from dash.dependencies import Output, Input, State
from dash.exceptions import PreventUpdate
import dash_core_components as dcc
import dash_html_components as html
from flask import jsonify, request, Response as FlaskResponse
import web.utils
@@ -25,6 +23,8 @@ from web.utils import diff_dashtable, dash_date_to_datetime
# pylint: disable=invalid-name
from web.tools.figurefilter import FigureFilter
from web.tools.import_dash_html import html
from web.tools.import_dash_core import dcc
from web.utils import create_card
from libs.config import Config
from web.view.control import get_control_tabs