staticdash 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -97,4 +97,18 @@ tr:hover {
97
97
  .plot-container .plotly-graph-div {
98
98
  width: 100% !important;
99
99
  height: auto !important;
100
+ }
101
+
102
+ .download-button {
103
+ display: inline-block;
104
+ padding: 0.5em 1em;
105
+ margin: 1em 0;
106
+ background-color: #2c3e50;
107
+ color: white;
108
+ text-decoration: none;
109
+ border-radius: 5px;
110
+ font-weight: bold;
111
+ }
112
+ .download-button:hover {
113
+ background-color: #547a9f;
100
114
  }
staticdash/dashboard.py CHANGED
@@ -121,15 +121,33 @@ class Dashboard:
121
121
  elif kind == "table":
122
122
  table_html, _ = content
123
123
  div(raw_util(table_html))
124
+ # elif kind == "download":
125
+ # src_path, label = content
126
+ # file_uuid = f"{uuid.uuid4().hex}_{os.path.basename(src_path)}"
127
+ # dst_path = os.path.join(downloads_dir, file_uuid)
128
+ # shutil.copy2(src_path, dst_path)
129
+ # a(label or os.path.basename(src_path),
130
+ # href=f"{downloads_dir}/{file_uuid}",
131
+ # cls="download-button",
132
+ # download=True)
124
133
  elif kind == "download":
125
134
  src_path, label = content
126
135
  file_uuid = f"{uuid.uuid4().hex}_{os.path.basename(src_path)}"
127
136
  dst_path = os.path.join(downloads_dir, file_uuid)
128
137
  shutil.copy2(src_path, dst_path)
129
- a(label or os.path.basename(src_path),
130
- href=f"{downloads_dir}/{file_uuid}",
131
- cls="download-button",
132
- download=True)
138
+
139
+ # Use relative link from HTML to downloads/ folder
140
+ download_link = f"downloads/{file_uuid}"
141
+
142
+ # Create button and append it to the current div
143
+ btn = a(label or os.path.basename(src_path),
144
+ href=download_link,
145
+ cls="download-button",
146
+ download=True)
147
+
148
+ div(btn)
149
+ div(raw_util("<br>"))
150
+
133
151
 
134
152
 
135
153
  with open(os.path.join(output_dir, "index.html"), "w") as f:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: staticdash
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: A lightweight static HTML dashboard generator with Plotly and pandas support.
5
5
  Author-email: Brian Day <brian.day1@gmail.com>
6
6
  License: CC0-1.0
@@ -70,10 +70,17 @@ page3 = Page("summary", "Summary")
70
70
  page3.add("Summary and notes can be added here.")
71
71
  page3.add("StaticDash is a lightweight static dashboard generator.")
72
72
 
73
+ # Page 4: Download
74
+ page4 = Page("download", "Download")
75
+ page4.add("Here is a button to download a file.")
76
+ page4.add_download('./test_file.txt', "Download File")
77
+ page4.add_download('./test_file2.txt', "Download Another File")
78
+
73
79
  # Register pages
74
80
  dashboard.add_page(page1)
75
81
  dashboard.add_page(page2)
76
82
  dashboard.add_page(page3)
83
+ dashboard.add_page(page4)
77
84
 
78
85
  # Export
79
86
  dashboard.publish(output_dir="output")
@@ -0,0 +1,8 @@
1
+ staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
+ staticdash/dashboard.py,sha256=Pj5or33xXyOJCxyvOVQTs8rDuYcqOYBVy11Z7ViRUuo,6557
3
+ staticdash/assets/css/style.css,sha256=pXKDi54gcDaxF5ABji5zfAS3ckHK4DhQU0onSBKkmWo,1587
4
+ staticdash/assets/js/script.js,sha256=rAGEB9sgv8LGdpA1JLQwYAZVRimpEfFSELKb0fFeATI,1222
5
+ staticdash-0.1.4.dist-info/METADATA,sha256=Dv6QYAxvJ31nrdpqohJ8BTEkXTvN-9jCLfnp6LHPmcI,2409
6
+ staticdash-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
+ staticdash-0.1.4.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
+ staticdash-0.1.4.dist-info/RECORD,,
@@ -1,8 +0,0 @@
1
- staticdash/__init__.py,sha256=KqViaDkiQnhBI8-j3hr14umLDmPgddvdB_G1nJeC5Xs,38
2
- staticdash/dashboard.py,sha256=0A-1soi7ECzTeCQTjZqzFuT2Ef8a9YAPSLI2T7f66EY,5595
3
- staticdash/assets/css/style.css,sha256=zcwUaOtGenWwGlWvWc5i9jnz_M1Jq2iGKGKizSGvBRo,1314
4
- staticdash/assets/js/script.js,sha256=rAGEB9sgv8LGdpA1JLQwYAZVRimpEfFSELKb0fFeATI,1222
5
- staticdash-0.1.3.dist-info/METADATA,sha256=0qjiyqbS0kGN78m6C8f5CNBIlRudnZ5xoBuV6JcK_48,2157
6
- staticdash-0.1.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
7
- staticdash-0.1.3.dist-info/top_level.txt,sha256=3MzZU6SptkUkjcHV1cvPji0H4aRzPphLHnpStgGEcxM,11
8
- staticdash-0.1.3.dist-info/RECORD,,