Update command/basic/documentation.py
Browse files
command/basic/documentation.py
CHANGED
@@ -1,6 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
from typing import Optional
|
2 |
from ..command_handler import CommandHandler
|
3 |
|
|
|
4 |
class DocumentationHandler(CommandHandler):
|
5 |
def __init__(self, commands, successor: Optional["CommandHandler"] = None):
|
6 |
super().__init__(successor)
|
@@ -8,10 +15,18 @@ class DocumentationHandler(CommandHandler):
|
|
8 |
|
9 |
def handle_command(self, command):
|
10 |
if command.lower() in self.commands:
|
11 |
-
|
12 |
else:
|
13 |
super().handle_command(command)
|
14 |
|
15 |
def execute_command(self):
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
|
|
1 |
+
import os
|
2 |
+
import logging
|
3 |
+
|
4 |
+
import streamlit as st
|
5 |
+
import core.form_documentation as fd
|
6 |
+
|
7 |
from typing import Optional
|
8 |
from ..command_handler import CommandHandler
|
9 |
|
10 |
+
|
11 |
class DocumentationHandler(CommandHandler):
|
12 |
def __init__(self, commands, successor: Optional["CommandHandler"] = None):
|
13 |
super().__init__(successor)
|
|
|
15 |
|
16 |
def handle_command(self, command):
|
17 |
if command.lower() in self.commands:
|
18 |
+
self.execute_command()
|
19 |
else:
|
20 |
super().handle_command(command)
|
21 |
|
22 |
def execute_command(self):
|
23 |
+
current_dir = os.path.dirname(os.path.realpath(__file__))
|
24 |
+
path_to_file = fd.generate_doc(path=current_dir)
|
25 |
+
|
26 |
+
if path_to_file is not None:
|
27 |
+
with st.sidebar:
|
28 |
+
st.download_button('Download doc', path_to_file)
|
29 |
+
st.success("Done", icon="✅")
|
30 |
+
else:
|
31 |
+
logging.error("path_to_file is None")
|
32 |
|