Ninjasharp commited on
Commit
2e950bd
·
verified ·
1 Parent(s): 81770b4

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -11
app.py CHANGED
@@ -13,7 +13,7 @@ st.set_page_config(
13
  layout="wide",
14
  initial_sidebar_state="expanded"
15
  )
16
-
17
  # Initialize session state to store tasks
18
  if 'tasks' not in st.session_state:
19
  st.session_state.tasks = []
@@ -32,7 +32,9 @@ def add_task(game_name, company, start_date, end_date, status, notes):
32
  # Function to remove a task
33
  def remove_task(task_index):
34
  if 0 <= task_index < len(st.session_state.tasks):
35
- st.session_state.tasks.pop(task_index)
 
 
36
 
37
  # Function to update a task
38
  def update_task(index, game_name, company, start_date, end_date, status, notes):
@@ -61,7 +63,9 @@ def load_tasks_from_csv(uploaded_file):
61
 
62
  # Function to clear tasks from session state
63
  def clear_tasks():
64
- st.session_state.tasks = []
 
 
65
 
66
  # Sidebar for adding new tasks
67
  with st.sidebar:
@@ -159,11 +163,9 @@ with st.sidebar:
159
 
160
  elif task_action == "Delete Task":
161
  st.write("Deleting Task:", task_names[selected_task_index])
162
- if st.button("Delete Task", key="delete_task_button"):
163
- remove_task(selected_task_index)
164
- st.success("Task deleted successfully!")
165
- # Clear the selection
166
- selected_task_index = None
167
  elif not st.session_state.tasks:
168
  st.write("No tasks available to edit or delete.")
169
 
@@ -171,7 +173,6 @@ with st.sidebar:
171
  with st.sidebar:
172
  if st.button("Clear All Tasks"):
173
  clear_tasks()
174
- st.success("All tasks cleared successfully!")
175
 
176
  # Create DataFrame for the Gantt chart
177
  if st.session_state.tasks:
@@ -238,7 +239,7 @@ if st.session_state.tasks:
238
  plt.tight_layout()
239
 
240
  # Display the Gantt chart
241
- st.header("Status Tracker")
242
  st.pyplot(fig)
243
 
244
  # Convert DataFrame to CSV
@@ -252,7 +253,9 @@ if st.session_state.tasks:
252
  )
253
  else:
254
  st.write("No tasks to display in the timeline chart.")
255
- st.image("st.PNG", width=280)# Bar chart of task statuses using Seaborn
 
 
256
  if st.session_state.tasks:
257
  status_counts = df['Status'].value_counts().reset_index()
258
  status_counts.columns = ['Status', 'Count']
 
13
  layout="wide",
14
  initial_sidebar_state="expanded"
15
  )
16
+ st.image("st.PNG", width=280)
17
  # Initialize session state to store tasks
18
  if 'tasks' not in st.session_state:
19
  st.session_state.tasks = []
 
32
  # Function to remove a task
33
  def remove_task(task_index):
34
  if 0 <= task_index < len(st.session_state.tasks):
35
+ if st.sidebar.button(f"Confirm Delete Task {task_index}"):
36
+ st.session_state.tasks.pop(task_index)
37
+ st.success(f"Task {task_index} deleted permanently!")
38
 
39
  # Function to update a task
40
  def update_task(index, game_name, company, start_date, end_date, status, notes):
 
63
 
64
  # Function to clear tasks from session state
65
  def clear_tasks():
66
+ if st.sidebar.button("Confirm Clear All Tasks"):
67
+ st.session_state.tasks = []
68
+ st.success("All tasks cleared permanently!")
69
 
70
  # Sidebar for adding new tasks
71
  with st.sidebar:
 
163
 
164
  elif task_action == "Delete Task":
165
  st.write("Deleting Task:", task_names[selected_task_index])
166
+ remove_task(selected_task_index)
167
+ # Clear the selection
168
+ selected_task_index = None
 
 
169
  elif not st.session_state.tasks:
170
  st.write("No tasks available to edit or delete.")
171
 
 
173
  with st.sidebar:
174
  if st.button("Clear All Tasks"):
175
  clear_tasks()
 
176
 
177
  # Create DataFrame for the Gantt chart
178
  if st.session_state.tasks:
 
239
  plt.tight_layout()
240
 
241
  # Display the Gantt chart
242
+ st.write("Progress Updates")
243
  st.pyplot(fig)
244
 
245
  # Convert DataFrame to CSV
 
253
  )
254
  else:
255
  st.write("No tasks to display in the timeline chart.")
256
+
257
+
258
+ # Bar chart of task statuses using Seaborn
259
  if st.session_state.tasks:
260
  status_counts = df['Status'].value_counts().reset_index()
261
  status_counts.columns = ['Status', 'Count']