Skip to content

Commit 7f165e8

Browse files
finish the program
1 parent 44f0616 commit 7f165e8

File tree

2 files changed

+97
-14
lines changed

2 files changed

+97
-14
lines changed

Workout-gui.py renamed to gui.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# PyWorkout GUI
2+
# Copyright (C) 2021-2022
3+
# This is the GUI frontend for the PyWorkout CLI interface. It is not yet completed.
4+
15
# Import Statements
26
from tkinter import *
37
from tkinter.ttk import *
@@ -170,4 +174,4 @@ def percent_dialog():
170174
progress_info.grid(row = 3, column = 5, padx = 10)
171175

172176
# Sustain Window
173-
window.mainloop()
177+
window.mainloop()

main.py

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
# PyWORKOUT CLI
22
# (C) 2021 - 2022
33

4-
# Workout Options
5-
# Stats - time, percentage complete
6-
# Video - play video for that group
7-
84
# Import Statements
9-
import subprocess
105
from datetime import datetime
116
import time
7+
import os
8+
import sys
9+
import subprocess
1210

1311
# Workout Lists
1412
groups = ["Abs", "Quads", "Glutes", "Triceps", "Biceps", "Back", "Chest"]
@@ -27,10 +25,24 @@
2725
chest = ["Pushups\t", "Chest Expansions", "Chest Squeezes", "Pike Pushups\t", "Shoulder Taps"]
2826
chest_count = [25, 25, 25, 25, 25, 25]
2927
complete = []
28+
times = []
3029

31-
# Videos
32-
def openvideo():
33-
sunday = subprocess.Popen(["C:\Program Files\VideoLAN\VLC\vlc.exe", "file:\\\D:\Videos\Workout Videos\10 Minute Ab Workout.mp4"])
30+
# Video File Paths
31+
abs_video = "D:\\Videos\\Workout Videos\\10 Minute Ab Workout.mp4" # change these to personal video path
32+
quads_video = "D:\\Videos\\Workout Videos\\12 Min Leg Workout.mp4"
33+
glutes_video = "D:\\Videos\\Workout Videos\\10 Minute Glute Bridge Workout.mp4"
34+
triceps_video = "D:\\Videos\\Workout Videos\\10 Minute Upper Body Workout.mp4"
35+
biceps_video = "D:\\Videos\\Workout Videos\\15 Minute Full Body HIIT Workout.mp4"
36+
back_video = "D:\\Videos\\Workout Videos\\20 Minute Full Body Workout.mp4"
37+
chest_video = "D:\\Videos\\Workout Videos\\15 Minute Intense Bodyweight Workout.mp4"
38+
39+
# Video Function
40+
def video(path):
41+
if sys.platform == "win32":
42+
os.startfile(path)
43+
else:
44+
opener = "open" if sys.platform == "darwin" else "xdg-open"
45+
subprocess.call([opener, path])
3446

3547
# Welcome
3648
print(" WELCOME TO PyWORKOUT")
@@ -112,6 +124,7 @@ def openvideo():
112124
activity_num = 0
113125
global start
114126
start = datetime.now()
127+
times.append(start)
115128
print("You have started the " + select + " muscle group. ")
116129
print("The current time is: " + str(time.strftime("%H:%M:%S")))
117130
if select == "abs":
@@ -147,6 +160,7 @@ def openvideo():
147160
run_activity = True
148161
elif activity.lower() == "next":
149162
now = datetime.now()
163+
times.append(now)
150164
print("You are in the " + select + " muscle group. ")
151165
print("The current time is: " + str(time.strftime("%H:%M:%S")) + ". " + str(now-start) + " has elapsed.")
152166
if select == "abs":
@@ -212,17 +226,82 @@ def openvideo():
212226
print("You are in the " + select + " muscle group. ")
213227
print("The current time is: " + str(time.strftime("%H:%M:%S")) + ". " + str(now-start) + " has elapsed.")
214228
complete.pop(-1)
229+
times.pop(-1)
215230
print("Activity skipped! Run the `next` command to move on. \n")
216231
run_activity = True
217232
elif activity.lower() == "end":
218233
now = datetime.now()
234+
times.append(now)
219235
print("You have completed the " + select + " muscle group.")
220236
print("It took " + str(now-start) + " to complete this workout.")
221-
print("The following activities were completed: ")
237+
print("The following activities were completed (time elapsed):")
222238
for i in range(len(complete)):
223-
print(str(i+1) + ". " + str(complete[i]))
239+
print(str(i+1) + ". " + str(complete[i]) + "\t(" + str(times[i+1]-times[i]) + ")")
224240
print("Congratulations! \n")
225-
run_activity = False
241+
run_activity = True
242+
elif activity.lower() == "stats":
243+
try:
244+
now = datetime.now()
245+
times.append(now)
246+
print("You are in the " + select + " muscle group. ")
247+
print("The current time is: " + str(time.strftime("%H:%M:%S")) + ". " + str(now-start) + " has elapsed.")
248+
print("The following activities have been completed (time elapsed):")
249+
for i in range(len(complete)):
250+
print(str(i+1) + ". " + str(complete[i]) + "\t(" + str(times[i+1]-times[i]) + ")")
251+
print("The following activites still need to be completed:")
252+
if select == "abs":
253+
for i in range(len(abs)-len(complete)):
254+
print(str(i+1) + ". " + str(abs[i+activity_num]))
255+
elif select == "quads":
256+
for i in range(len(quads)-len(complete)):
257+
print(str(i+1) + ". " + str(quads[i+activity_num]))
258+
elif select == "glutes":
259+
for i in range(len(glutes)-len(complete)):
260+
print(str(i+1) + ". " + str(glutes[i+activity_num]))
261+
elif select == "triceps":
262+
for i in range(len(triceps)-len(complete)):
263+
print(str(i+1) + ". " + str(triceps[i+activity_num]))
264+
elif select == "biceps":
265+
for i in range(len(biceps)-len(complete)):
266+
print(str(i+1) + ". " + str(biceps[i+activity_num]))
267+
elif select == "back":
268+
for i in range(len(back)-len(complete)):
269+
print(str(i+1) + ". " + str(back[i+activity_num]))
270+
elif select == "chest":
271+
for i in range(len(chest)-len(complete)):
272+
print(str(i+1) + ". " + str(chest[i+activity_num]))
273+
print("")
274+
except IndexError:
275+
print("You cannot use both the `skip` and `stats` commands, sorry! \n")
276+
run_activity = True
277+
elif activity.lower() == "video":
278+
now = datetime.now()
279+
times.append(now)
280+
print("You are in the " + select + " muscle group. ")
281+
print("The current time is: " + str(time.strftime("%H:%M:%S")) + ". " + str(now-start) + " has elapsed.")
282+
if select == "abs":
283+
video(abs_video)
284+
complete.append("Abs Video \t")
285+
elif select == "quads":
286+
video(quads_video)
287+
complete.append("Quads Video \t")
288+
elif select == "glutes":
289+
video(glutes_video)
290+
complete.append("Glutes Video")
291+
elif select == "triceps":
292+
video(triceps_video)
293+
complete.append("Triceps Video")
294+
elif select == "biceps":
295+
video(biceps_video)
296+
complete.append("Biceps Video\t")
297+
elif select == "back":
298+
video(back_video)
299+
complete.append("Back Video \t")
300+
elif select == "chest":
301+
video(chest_video)
302+
complete.append("Chest Video \t")
303+
print("")
304+
run_activity = True
226305
elif activity.lower() == "quit":
227306
run_activity = False
228307
exit()
@@ -235,7 +314,7 @@ def openvideo():
235314
print("next Moves to the next workout activity.")
236315
print("skip Skips the current workout activity.")
237316
print("end Completes the workout and display full workout statistics.")
238-
print("stats Shows workout statistics at any point and time.")
317+
print("stats Shows workout statistics at any point (does not work with the `skip` command).")
239318
print("video Opens the workout video assigned to each muscle group.")
240319
print("help Prints this help text.")
241320
print("quit Ends the program.")
@@ -248,7 +327,7 @@ def openvideo():
248327
print("next Moves to the next workout activity.")
249328
print("skip Skips the current workout activity.")
250329
print("end Completes the workout and display full workout statistics.")
251-
print("stats Shows workout statistics at any point and time.")
330+
print("stats Shows workout statistics at any point.")
252331
print("video Opens the workout video assigned to each muscle group.")
253332
print("help Prints a similar help text.")
254333
print("quit Ends the program. \n")

0 commit comments

Comments
 (0)