|
37 | 37 | from dash.development.base_component import Component |
38 | 38 | from dash.exceptions import PreventUpdate |
39 | 39 |
|
40 | | -from deepcave import ROOT_DIR, interactive |
| 40 | +from deepcave import ROOT_DIR, DOC_ROOT, interactive |
41 | 41 | from deepcave.layouts import Layout |
42 | 42 | from deepcave.runs import AbstractRun |
43 | 43 | from deepcave.runs.group import Group, NotMergeableError |
@@ -856,45 +856,23 @@ def __call__(self, render_button: bool = False) -> List[Component]: |
856 | 856 | components = [] |
857 | 857 |
|
858 | 858 | if self.help is not None: |
859 | | - doc_path = ROOT_DIR / self.help |
860 | | - if not doc_path.exists(): |
861 | | - raise FileNotFoundError(doc_path) |
862 | | - |
863 | | - if doc_path.name.endswith(".rst"): |
864 | | - data = rst_to_md(doc_path) |
865 | | - else: |
866 | | - with doc_path.open("r") as file: |
867 | | - data = file.read() |
868 | | - |
869 | | - modal = html.Div( |
870 | | - [ |
871 | | - dbc.Modal( |
872 | | - [ |
873 | | - dbc.ModalBody([dcc.Markdown(data)]), |
874 | | - ], |
875 | | - id=self.get_internal_id("help"), |
876 | | - size="xl", |
877 | | - scrollable=True, |
878 | | - is_open=False, |
879 | | - ), |
880 | | - ] |
881 | | - ) |
882 | | - |
| 859 | + doc_path = DOC_ROOT + self.help |
883 | 860 | components += [ |
884 | 861 | html.H1( |
885 | 862 | [ |
886 | 863 | html.Span(self.name), |
887 | 864 | dbc.Button( |
888 | 865 | [html.I(className="far fa-question-circle")], |
889 | 866 | id=self.get_internal_id("show_help"), |
| 867 | + href=doc_path, |
| 868 | + target="_blank", |
890 | 869 | style={"float": "right"}, |
891 | 870 | color="primary", |
892 | 871 | outline=True, |
893 | 872 | n_clicks=0, |
894 | 873 | ), |
895 | 874 | ] |
896 | 875 | ), |
897 | | - modal, |
898 | 876 | ] |
899 | 877 | else: |
900 | 878 | components += [html.H1(self.name)] |
|
0 commit comments