diff --git a/lumen/dashboard.py b/lumen/dashboard.py index 6306bea0f..dfad8767c 100644 --- a/lumen/dashboard.py +++ b/lumen/dashboard.py @@ -10,6 +10,7 @@ import param import yaml +from panel.io.resources import CSS_URLS from panel.template.base import BasicTemplate from .auth import AuthPlugin @@ -29,9 +30,6 @@ from .variables import Variable, Variables from .views import View # noqa -pn.config.css_files.append( - 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css' -) def load_yaml(yaml_spec, **kwargs): expanded = expand_spec(yaml_spec, config.template_vars, **kwargs) @@ -325,6 +323,7 @@ def __init__(self, specification=None, **params): self._edited = False self._debug = params.pop('debug', False) super().__init__(**params) + self._init_config() # Initialize from spec config.load_local_modules() @@ -353,6 +352,11 @@ def __init__(self, specification=None, **params): state._apps[pn.state.curdoc] = self pn.state.onload(self._render_dashboard) + def _init_config(self): + pn.config.notifications = True + if CSS_URLS['font-awesome'] not in pn.config.css_files: + pn.config.css_files.append(CSS_URLS['font-awesome']) + ################################################################## # Load specification ################################################################## diff --git a/lumen/ui/builder.py b/lumen/ui/builder.py index 508350b8b..f6aca34ec 100644 --- a/lumen/ui/builder.py +++ b/lumen/ui/builder.py @@ -24,30 +24,6 @@ from .variables import VariablesEditor from .views import ViewEditor, ViewGallery, ViewGalleryItem -CSS_RAW = """ -i.fa.fa-plus:hover { - color: var(--neutral-fill-color) !important; -} - -.gallery-item:hover { - box-shadow: 0 1px 5px; -} - -.gallery-item { - cursor: pointer; -} - -.card-margin { - height: calc(100% - 40px); -} - -.bk-root { - height: 100% !important; -} -""" - -pn.extension('ace', 'perspective', 'tabulator', raw_css=[CSS_RAW]) - class Builder(param.Parameterized): diff --git a/lumen/ui/main.py b/lumen/ui/main.py index b1a0de936..95f3b9476 100644 --- a/lumen/ui/main.py +++ b/lumen/ui/main.py @@ -2,11 +2,38 @@ import panel as pn +from panel.io.resources import CSS_URLS from panel.template import FastListTemplate from lumen.ui.builder import Builder from lumen.ui.state import state +CSS_RAW = """ +i.fa.fa-plus:hover { + color: var(--neutral-fill-color) !important; +} + +.gallery-item:hover { + box-shadow: 0 1px 5px; +} + +.gallery-item { + cursor: pointer; +} + +.card-margin { + height: calc(100% - 40px); +} + +.bk-root { + height: 100% !important; +} +""" + +pn.extension( + 'ace', 'perspective', 'tabulator', raw_css=[CSS_RAW], + css_files=[CSS_URLS['font-awesome']] +) def main(): path = Path(state.components) diff --git a/lumen/util.py b/lumen/util.py index a23963c1d..8e267a0c0 100644 --- a/lumen/util.py +++ b/lumen/util.py @@ -261,8 +261,6 @@ def catch_and_notify(message=None): exception message. """ - pn.config.notifications = True - # This is to be able to call the decorator # like this @catch_and_notify function = None