Spaces:
Sleeping
Sleeping
Delete html.py
Browse files
html.py
DELETED
@@ -1,134 +0,0 @@
|
|
1 |
-
def generate_progress_html(progress_value, progress_text):
|
2 |
-
"""
|
3 |
-
Generates HTML code for a progress indicator, including a loader animation and progress bar.
|
4 |
-
|
5 |
-
Parameters:
|
6 |
-
- progress_value (int): The current progress value (0-100).
|
7 |
-
- progress_text (str): Text description to accompany the progress bar.
|
8 |
-
|
9 |
-
Returns:
|
10 |
-
- str: HTML code for the progress indicator.
|
11 |
-
"""
|
12 |
-
# Define the base HTML structure for the progress indicator
|
13 |
-
progress_html_template = '''
|
14 |
-
<div class="loader-container">
|
15 |
-
<div class="loader"></div>
|
16 |
-
<div class="progress-container">
|
17 |
-
<progress value="{value}" max="100"></progress>
|
18 |
-
</div>
|
19 |
-
<span>{text}</span>
|
20 |
-
</div>
|
21 |
-
'''
|
22 |
-
|
23 |
-
# Replace placeholders with dynamic values
|
24 |
-
return progress_html_template.format(value=progress_value, text=progress_text)css = '''
|
25 |
-
.loader-container {
|
26 |
-
display: flex; /* Use flex to align items horizontally */
|
27 |
-
align-items: center; /* Center items vertically within the container */
|
28 |
-
white-space: nowrap; /* Prevent line breaks within the container */
|
29 |
-
}
|
30 |
-
|
31 |
-
.loader {
|
32 |
-
border: 8px solid #f3f3f3; /* Light grey */
|
33 |
-
border-top: 8px solid #3498db; /* Blue */
|
34 |
-
border-radius: 50%;
|
35 |
-
width: 30px;
|
36 |
-
height: 30px;
|
37 |
-
animation: spin 2s linear infinite;
|
38 |
-
}
|
39 |
-
|
40 |
-
@keyframes spin {
|
41 |
-
0% { transform: rotate(0deg); }
|
42 |
-
100% { transform: rotate(360deg); }
|
43 |
-
}
|
44 |
-
|
45 |
-
/* Style the progress bar */
|
46 |
-
progress {
|
47 |
-
appearance: none; /* Remove default styling */
|
48 |
-
height: 20px; /* Set the height of the progress bar */
|
49 |
-
border-radius: 5px; /* Round the corners of the progress bar */
|
50 |
-
background-color: #f3f3f3; /* Light grey background */
|
51 |
-
width: 100%;
|
52 |
-
}
|
53 |
-
|
54 |
-
/* Style the progress bar container */
|
55 |
-
.progress-container {
|
56 |
-
margin-left: 20px;
|
57 |
-
margin-right: 20px;
|
58 |
-
flex-grow: 1; /* Allow the progress container to take up remaining space */
|
59 |
-
}
|
60 |
-
|
61 |
-
/* Set the color of the progress bar fill */
|
62 |
-
progress::-webkit-progress-value {
|
63 |
-
background-color: #3498db; /* Blue color for the fill */
|
64 |
-
}
|
65 |
-
|
66 |
-
progress::-moz-progress-bar {
|
67 |
-
background-color: #3498db; /* Blue color for the fill in Firefox */
|
68 |
-
}
|
69 |
-
|
70 |
-
/* Style the text on the progress bar */
|
71 |
-
progress::after {
|
72 |
-
content: attr(value '%'); /* Display the progress value followed by '%' */
|
73 |
-
position: absolute;
|
74 |
-
top: 50%;
|
75 |
-
left: 50%;
|
76 |
-
transform: translate(-50%, -50%);
|
77 |
-
color: white; /* Set text color */
|
78 |
-
font-size: 14px; /* Set font size */
|
79 |
-
}
|
80 |
-
|
81 |
-
/* Style other texts */
|
82 |
-
.loader-container > span {
|
83 |
-
margin-left: 5px; /* Add spacing between the progress bar and the text */
|
84 |
-
}
|
85 |
-
|
86 |
-
.progress-bar > .generating {
|
87 |
-
display: none !important;
|
88 |
-
}
|
89 |
-
|
90 |
-
.progress-bar{
|
91 |
-
height: 30px !important;
|
92 |
-
}
|
93 |
-
|
94 |
-
.type_row{
|
95 |
-
height: 96px !important;
|
96 |
-
}
|
97 |
-
|
98 |
-
.type_small_row{
|
99 |
-
height: 40px !important;
|
100 |
-
}
|
101 |
-
|
102 |
-
.scroll-hide{
|
103 |
-
resize: none !important;
|
104 |
-
}
|
105 |
-
|
106 |
-
.refresh_button{
|
107 |
-
border: none !important;
|
108 |
-
background: none !important;
|
109 |
-
font-size: none !important;
|
110 |
-
box-shadow: none !important;
|
111 |
-
}
|
112 |
-
|
113 |
-
.advanced_check_row{
|
114 |
-
width: 250px !important;
|
115 |
-
}
|
116 |
-
|
117 |
-
.min_check{
|
118 |
-
min-width: min(1px, 100%) !important;
|
119 |
-
}
|
120 |
-
|
121 |
-
'''
|
122 |
-
progress_html = '''
|
123 |
-
<div class="loader-container">
|
124 |
-
<div class="loader"></div>
|
125 |
-
<div class="progress-container">
|
126 |
-
<progress value="*number*" max="100"></progress>
|
127 |
-
</div>
|
128 |
-
<span>*text*</span>
|
129 |
-
</div>
|
130 |
-
'''
|
131 |
-
|
132 |
-
|
133 |
-
def make_progress_html(number, text):
|
134 |
-
return progress_html.replace('*number*', str(number)).replace('*text*', text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|