diff --git a/img/logo.png b/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..8f1d783af96fc182c27706439da1fe021feb3527 Binary files /dev/null and b/img/logo.png differ diff --git a/src/controller.py b/src/controller.py index 7bafc807d6aac898ac1484bd28611b7e29340e63..bec3560578d6ecebc6f35857a56ccdf7e8af5d99 100644 --- a/src/controller.py +++ b/src/controller.py @@ -25,9 +25,10 @@ class controller: self.plan = plan() self.plan.switch.connect(self.fromPlan) self.plan2 = plan2(1) - self.plan.switch.connect(self.toPlan2) + self.plan2.switch.connect(self.fromPlan2) + # self.plan2.switch.connect(self.toDashboard) self.endOfExe = endOfExe() - self.endOfExe.switch.connect(self.toEndOfExe) + # self.endOfExe.switch.connect(self.toEndOfExe) self.endOfExe.switch.connect(self.fromEndOfExe) pass @@ -37,7 +38,6 @@ class controller: c.execute("SELECT * FROM user") count = c.fetchone() if (count != None): - # print("dashboard") self.dashboard.show() else: self.registerWin.show() @@ -80,7 +80,7 @@ class controller: self.listLatihan.show() elif (page == "plan2"): self.plan2 = plan2(program_id) - self.plan2.switch.connect(self.toEndOfExe) + self.plan2.switch.connect(self.fromPlan2) self.plan2.show() def fromCustomize(self, page, program_id): @@ -94,18 +94,13 @@ class controller: self.plan.switch.connect(self.fromPlan) self.plan.show() - def toPlan2(self, page, program_id): - self.plan.close() - if (page == "plan2"): - print("ctrl" + str(program_id)) - self.plan2 = plan2(program_id) - self.plan2.switch.connect(self.toEndOfExe) - self.plan2.show() - def toEndOfExe(self,page): + def fromPlan2(self,page): self.plan2.close() if (page == "endOfExe"): self.endOfExe.show() + elif (page == "plan"): + self.plan.show() def fromEndOfExe(self,page): self.endOfExe.close() @@ -172,22 +167,22 @@ class controller: INSERT or IGNORE INTO daftar_latihan (exercise_id, title, description, goals, duration, repetition, gif) VALUES - (101, "Hip Dip", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-hipdip.gif"), - (102, "Bear Crawl", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-bearcrawl.gif"), - (103, "Jumping Jacks", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-jumpingjack.gif"), - (104, "Plank", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-plank.gif"), - (105, "Bridge", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-bridges.gif"), - (106, "High Knees", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-highknee.gif"), - (107, "Mountain Climber", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-mountain.gif"), - (108, "Russian Twist", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL,"img/exe-russian.gif"), - (201, 'Push Up', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor','Goals', NULL, 10, 'img/exe-pushup.gif'), - (202, "Sit Up", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-situp.gif"), - (203, "Toe Tap", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-toetap.gif"), - (204, "Shoulder Tap", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-shouldertap.gif"), - (205, "Lunges", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-lunges.gif"), - (206, "Crunches", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-crunches.gif"), - (207, "Burpees", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-burpees.gif"), - (208, "Bicycle Crunch", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-bicycle.gif") + (101, "Hip Dip", "The hip dip exercise is performed by placing your forearms on the ground with your elbows bent at a 90-degree angle, and then raising your hips off the ground, keeping your feet and forearms on the ground. This exercise targets the oblique muscles and helps to tone and strengthen them.", 'Thin, Fit', 30, NULL, "img/exe-hipdip.gif"), + (102, "Bear Crawl", "The bear crawl exercise is performed by getting into a push-up position and then crawling forward on your hands and feet, keeping your back flat and your core engaged. This exercise targets multiple muscle groups including the shoulders, chest, triceps, and core.", 'Thin, Fit', 30, NULL, "img/exe-bearcrawl.gif"), + (103, "Jumping Jacks", "Jumping jacks are a simple and effective exercise that involves jumping with your feet spread apart and your arms raised above your head, then returning to a standing position with your arms at your sides. This exercise is a great way to get your heart rate up and work on your cardiovascular fitness.", 'Thin, Fit', 30, NULL, "img/exe-jumpingjack.gif"), + (104, "Plank", "The plank is an isometric exercise that involves holding a push-up position for an extended period of time. This exercise targets the core and helps to improve stability and overall strength.", 'Thin, Fit', 30, NULL, "img/exe-plank.gif"), + (105, "Bridge", "The bridge exercise is performed by lying on your back with your knees bent and your feet flat on the ground. Then, you lift your hips up towards the ceiling, squeezing your glutes at the top of the movement. This exercise targets the glutes and helps to tone and strengthen them.", 'Thin, Fit', 30, NULL, "img/exe-bridges.gif"), + (106, "High Knees", "High knees are performed by running in place while lifting your knees up towards your chest as high as possible. This exercise targets the hip flexors and helps to improve speed, agility, and coordination.", 'Thin, Fit', 30, NULL, "img/exe-highknee.gif"), + (107, "Mt. Climber", "The mountain climber exercise is performed by getting into a push-up position and then bringing one knee up towards your chest, alternating legs in a running motion. This exercise targets the core and helps to improve cardiovascular fitness.", 'Thin, Fit', 30, NULL, "img/exe-mountain.gif"), + (108, "Russian Twist", "The Russian twist exercise is performed by sitting on the ground with your knees bent and your feet flat on the ground. Then, you lean back slightly and twist your torso from side to side, touching the ground with your hands on each side. This exercise targets the oblique muscles and helps to improve core strength.", 'Thin, Fit', 30, NULL,"img/exe-russian.gif"), + (201, 'Push Up', 'The push-up is a classic exercise that involves getting into a plank position with your hands placed slightly wider than shoulder-width apart. Then, you lower your body down towards the ground by bending your elbows and push back up to the starting position. This exercise targets multiple muscle groups including the chest, triceps, and shoulders.','Thin, Fit', NULL, 10, 'img/exe-pushup.gif'), + (202, "Sit Up", "The sit-up is performed by lying on your back with your knees bent and your feet flat on the ground. Then, you lift your upper body up towards your knees by contracting your abs. This exercise targets the abdominal muscles and helps to improve core strength.", 'Thin, Fit', NULL, 10, "img/exe-situp.gif"), + (203, "Toe Tap", "The toe tap exercise is performed by lying on your back with your legs extended towards the ceiling. Then, you lower one leg down towards the ground and tap your toe on the floor before raising it back up to the starting position. This exercise targets the lower abdominal muscles and helps to improve core strength.", 'Thin, Fit', NULL, 10, "img/exe-toetap.gif"), + (204, "Shoulder Tap", "The shoulder tap exercise is performed by getting into a push-up position and then tapping one hand to the opposite shoulder, alternating hands. This exercise targets the core and helps to improve stability and overall strength.", 'Thin, Fit', NULL, 10, "img/exe-shouldertap.gif"), + (205, "Lunges", "Lunges are performed by stepping forward with one foot and bending both knees, lowering your body towards the ground before returning to the starting position. This exercise targets the legs and helps to improve lower body strength.", 'Thin, Fit', NULL, 10, "img/exe-lunges.gif"), + (206, "Crunches", "Crunches are a classic abdominal exercise that target the rectus abdominis muscle (the six-pack muscles) and the obliques. To perform a crunch, lie on your back with your knees bent and feet flat on the ground. Place your hands behind your head or across your chest, and engage your core to lift your shoulders and upper back off the ground. Exhale as you crunch up, and inhale as you lower back down.", 'Thin, Fit', NULL, 10, "img/exe-crunches.gif"), + (207, "Burpees", "Burpees are a full-body exercise that incorporate cardio and strength training. To perform a burpee, start in a standing position, then drop down into a squat and place your hands on the ground. Jump or step your feet back into a plank position, then perform a push-up. Jump or step your feet back up to your hands, then explode up into a jump, reaching your arms overhead. That's one rep", 'Thin, Fit', NULL, 10, "img/exe-burpees.gif"), + (208, "Bicycle Crunch", "The bicycle crunch is a core exercise that targets the rectus abdominis and the obliques. To perform a bicycle crunch, lie on your back with your hands behind your head and your knees bent. Lift your shoulders off the ground and bring your right elbow towards your left knee, while straightening your right leg. Then, switch sides, bringing your left elbow towards your right knee, while straightening your left leg. Continue alternating sides in a pedaling motion.", 'Thin, Fit', NULL, 10, "img/exe-bicycle.gif") """) cur.execute(""" @@ -217,41 +212,30 @@ class controller: (3, 106) """) - # cur.execute(""" - # INSERT INTO riwayat_latihan - # (program_id, name, title_program, calories, date, tot_duration) - # VALUES - # (1, 'Push Up', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Sit Up', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Pull Up', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Squat Jump', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Lunges', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Crunches', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Burpees', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Bicycle Crunch', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Jumping Rope', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Running', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Jumping Jacks', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Plank', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Bridge', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'High Knees', 'Chest Day', 100, '2020-12-12', 30), - # (1, 'Squat', 'Chest Day', 100, '2020-12-12', 30), - # (2, 'Push Up', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Sit Up', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Pull Up', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Squat Jump', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Lunges', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Crunches', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Burpees', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Bicycle Crunch', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Jumping Rope', 'Leg Day', 100, '2020-12-15', 30), - # (2, 'Running', 'Leg Day', 100, '2020-12-15', 30) - # """) + cur.execute(""" + CREATE TABLE IF NOT EXISTS quotes ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + quote TEXT + )""") + + cur.execute(""" + INSERT OR IGNORE INTO quotes + (quote) + VALUES + ('“Strength does not come from\nphysical capacity. It comes from\nan indomitable will.â€\n-Mahatma Gandhi'), + ('“Push harder than yesterday if you\nwant a different tomorrow.â€\n- Unknown'), + ('“Motivation is what gets you\nstarted. Habit is what keeps\nyou going.â€\n-Jim Ryun'), + ('“There are two types of pain in this\nworld: pain that hurts you, and pain\nthat changes you.â€\n- Unknown'), + ('“When you hit failure, your\nworkout has just begun.â€\n-Ronnie Coleman'), + ('“It never gets easier, you just\nget better.â€\n-Unknown'), + ('“Don’t limit your challenges.\nChallenge your limits.â€\n-Jerry Dunn') + + + """) self.con.commit() self.con.close() - else: - print("Database already exists") + if __name__ == "__main__": app = QApplication(sys.argv) controller = controller() diff --git a/src/customize.py b/src/customize.py index f5b1b80ad3ebd16618a87dfccb6a45655d3e51d3..9dbd251a933570ca02d40c7dccc5d99d664a114b 100644 --- a/src/customize.py +++ b/src/customize.py @@ -36,8 +36,8 @@ class customizeWorkout(QWidget): self.label = QLabel("") self.label.setParent(self) self.setFixedSize(1280, 720) - self.setWindowTitle("FitU - Customize Workout") self.setWindowIcon(QIcon("img/logo.png")) + self.setWindowTitle("FitU - Customize Workout") self.setStyleSheet("background-color: #5A8D6C;") self.elements() @@ -302,7 +302,6 @@ class customizeWorkout(QWidget): if self.program_id != 0: cur = self.con.cursor() self.latihan = cur.execute(f"SELECT exercise_id FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall() - print(self.latihan) for i in range(len(self.latihan)): button = addButtonList[i] button.setEnabled(False) @@ -425,7 +424,6 @@ class customizeWorkout(QWidget): cur.execute( f"INSERT INTO latihan_program (program_id, exercise_id) VALUES ({lenProg+1} ,{i})" ) - print(lenProg) self.con.commit() diff --git a/src/dashboard.py b/src/dashboard.py index c5a9398bc669b6050c284a313e4748c24833b1b9..0ede1441ecd215d884c014f997d92a763531beda 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -1,9 +1,10 @@ import sys from PyQt6.QtCore import Qt, pyqtSignal, QSize -from PyQt6.QtGui import QCursor, QFont, QPixmap, QMovie +from PyQt6.QtGui import QCursor, QFont, QPixmap, QMovie, QIcon from PyQt6.QtWidgets import QApplication, QLabel, QPushButton, QWidget, QScrollArea, QVBoxLayout, QHBoxLayout import sqlite3 +import random # cur = sqlite3.connect("fitu.db").cursor() @@ -58,26 +59,14 @@ class dashboard(QWidget): self.con = sqlite3.connect("fitu.db") self.cur = self.con.cursor() self.biodata = self.cur.execute("SELECT * FROM user").fetchall() - print(self.biodata) - # if (self.biodata == None): - # self.switch.emit('register', {}) - # self.user = { - # 'name': f'{self.biodata[0][0]}', - # 'height': self.biodata[0][1], - # 'weight': self.biodata[0][2], - # 'goal': f'{self.biodata[0][3]}', - # 'gender': f'{self.biodata[0][4]}', - # 'age': self.biodata[0][5] - # } - # else: - # self.user = user - + self.index_history = int(-1) self.banyaknyaKartu = int(-1) self.dashboardWindow() def dashboardWindow(self): - self.setWindowTitle('Dashboard - FitU') + self.setWindowTitle('FitU - Dashboard') + self.setWindowIcon(QIcon("img/logo.png")) self.setFixedSize(1280, 720) self.setStyleSheet(f'background-color: {background};') self.label = QLabel("") @@ -86,7 +75,6 @@ class dashboard(QWidget): def historyElement(self, historyIdx, idx): # self.cur = self.con.cursor() - print(idx) self.index_history = idx tanggal = self.cur.execute(f""" SELECT strftime(date) FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}' @@ -104,7 +92,6 @@ class dashboard(QWidget): jumlahCard = len(daftar_latihan) self.banyaknyaKartu = jumlahCard - print(self.banyaknyaKartu) self.date = QLabel(self) self.date.setText(f"{tanggal}") @@ -116,7 +103,6 @@ class dashboard(QWidget): keterangan = self.cur.execute(f""" SELECT tot_duration, title_program FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}' """).fetchone() - print(keterangan) self.duration = QLabel(self) self.duration.setText("Duration : " + str(keterangan[0]) + " minutes") self.duration.setStyleSheet(f'color: {button_color}; background-color: {card_color};') @@ -146,13 +132,13 @@ class dashboard(QWidget): scroll_bar_style = """ QScrollBar:horizontal { border : 0px; - background-color: #5A8D6C; + background-color: #D2DCC4; height: 10px; margin: 0px 0px 0px 0px; } QScrollBar::handle:horizontal { background-color: #174728; - border-radius: 50px; + border-radius: 3px; border: 0px; } """ @@ -372,8 +358,11 @@ class dashboard(QWidget): self.hello.setAlignment(Qt.AlignmentFlag.AlignLeft) # quote + # quote + angka = random.randint(1, 7) + isi_quote = self.cur.execute(f"SELECT quote FROM quotes WHERE id = {angka}").fetchone() quote = QLabel(self) - quote.setText("“Strength does not come from\nphysical capacity. It comes from\nan indomitable will.â€\n-Mahatma Gandhi") + quote.setText(isi_quote[0]) quote.setStyleSheet(f'color: {text_color};') quote.move(101, 320) quote.setFont(quoteFont) @@ -405,7 +394,6 @@ class dashboard(QWidget): SELECT DISTINCT history_id FROM riwayat_latihan """).fetchall() - print(historyIdx) # menyiapkan history card if (len(historyIdx) <= 0): @@ -431,7 +419,6 @@ class dashboard(QWidget): tanggal = self.cur.execute(f""" SELECT strftime(date) FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}' """).fetchone()[0] - print('tanggal',tanggal) self.date.setText(f"{tanggal}") daftar_latihan = self.cur.execute(f""" SELECT name FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}' @@ -440,7 +427,6 @@ class dashboard(QWidget): keterangan = self.cur.execute(f""" SELECT tot_duration, title_program FROM riwayat_latihan WHERE history_id = '{historyIdx[self.index_history][0]}' """).fetchone() - print('keterangan',keterangan) self.duration.setText("Duration : " + str(keterangan[0]) + " minutes") self.prog.setText("Program Name: " + keterangan[1]) @@ -459,13 +445,13 @@ class dashboard(QWidget): scroll_bar_style = """ QScrollBar:horizontal { border : 0px; - background-color: #5A8D6C; + background-color: #D2DCC4; height: 10px; margin: 0px 0px 0px 0px; } QScrollBar::handle:horizontal { background-color: #174728; - border-radius: 50px; + border-radius: 3px; border: 0px; } """ @@ -565,13 +551,13 @@ class dashboard(QWidget): scroll_bar_style = """ QScrollBar:horizontal { border : 0px; - background-color: #5A8D6C; + background-color: #D2D2D2; height: 10px; margin: 0px 0px 0px 0px; } QScrollBar::handle:horizontal { background-color: #174728; - border-radius: 50px; + border-radius: 3px; border: 0px; } """ diff --git a/src/endOfExercise.py b/src/endOfExercise.py index c89186a7351c8704085cfccf1fcede4a71b2c2b7..a8ae1a2ab6bc1fdd903e5abc07157a706f764593 100644 --- a/src/endOfExercise.py +++ b/src/endOfExercise.py @@ -1,7 +1,7 @@ import sqlite3 import sys from PyQt6.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QPushButton, QRadioButton, QCheckBox, QMessageBox -from PyQt6.QtGui import QFont, QPixmap, QCursor +from PyQt6.QtGui import QFont, QPixmap, QCursor, QIcon from PyQt6.QtCore import Qt, pyqtSignal class endOfExe(QWidget): @@ -14,6 +14,7 @@ class endOfExe(QWidget): def setUpWindow(self): self.setWindowTitle("FitU - End Of Exercise") self.setFixedSize(1280, 720) + self.setWindowIcon(QIcon("img/logo.png")) self.setUpEndOfExe() def setUpEndOfExe(self): @@ -71,6 +72,7 @@ class endOfExe(QWidget): backButton.move(560, 450) backButton.clicked.connect(self.backToDash) + def backToDash(self): self.switch.emit("dashboard", {}) diff --git a/src/listLatihan.py b/src/listLatihan.py deleted file mode 100644 index 3175aecb2cd83057e567d864778e9a01f4b280a6..0000000000000000000000000000000000000000 --- a/src/listLatihan.py +++ /dev/null @@ -1,571 +0,0 @@ -import sqlite3 -from PyQt6.QtWidgets import (QWidget, QSlider, QLineEdit, QLabel, QPushButton, QScrollArea,QApplication, - QHBoxLayout, QVBoxLayout, QMainWindow) -from PyQt6.QtCore import Qt, QSize -from PyQt6 import QtWidgets, uic -from PyQt6.QtGui import QPixmap, QIcon, QPalette, QFont, QCursor -import sys - -background = '#5A8D6C' -button_color = '#174728' -text_color = '#EEEEE2' -card_color = '#D2DCC4' - -class listLatihan(QMainWindow): - - def __init__(self): - super().__init__() - self.con = sqlite3.connect('fitu.db') - self.listLat = self.fetchListLatihan() - self.setUpListLatihanWindow() - self.initUI() - - def fetchListLatihan(self): - cur = self.con.cursor() - rows = cur.execute("SELECT * FROM daftar_latihan") - rows = cur.fetchall() - cur.close() - - return rows - - def setUpListLatihanWindow(self): - self.resize(1280,720) - self.setWindowIcon(QIcon("../img/logo.png")) - self.setWindowTitle("Fit-U - Daftar Latihan") - self.setStyleSheet('background-color: #5A8D6C;') - - def initUI(self): - - self.scroll = QScrollArea() # Scroll Area which contains the widgets, set as the centralWidget - self.widget = QWidget() # Widget that contains the collection of Vertical Box - self.vbox = QVBoxLayout() # The Vertical Box that contains the Horizontal Boxes of labels and buttons - - stylesheet1 = ( - 'background-color: #5A8D6C;' - ) - stylesheet2 = ( - 'background-color: #D2DCC4;' - 'border-top-left-radius: 20px;' - 'border-top-right-radius: 20px;' - ) - stylesheet3 = ( - 'background-color: #D2DCC4;' - 'border-bottom-left-radius: 20px;' - 'border-bottom-right-radius: 20px;' - 'padding-left: 10px;' - 'padding-right: 10px;' - 'padding-top: 5px;' - ) - header = QLabel() - header.setFixedSize(10,5) - header.setStyleSheet(stylesheet1) - self.vbox.addWidget(header) - - logo = QLabel(self) - logo.setPixmap(QPixmap('../img/logo-dashboard.png')) - logo.move(60, 45) - - helloFont = QFont() - helloFont.setFamily('Segoe UI') - helloFont.setPointSize(47) - - quoteFont = QFont() - quoteFont.setFamily('Segoe UI') - quoteFont.setPointSize(25) - - buttonFont = QFont() - buttonFont.setFamily('Segoe UI') - buttonFont.setPointSize(18) - - dateFont = QFont() - dateFont.setFamily('Segoe UI') - dateFont.setPointSize(23) - - historyFont = QFont() - historyFont.setFamily('Segoe UI') - historyFont.setPointSize(16) - - # tombol home - homeButton = QPushButton() - homeButton.setText('Home') - homeButton.setStyleSheet(f''' - QPushButton {{ - color: {text_color}; - background-color: {background}; - border: none; - border-radius: 20px; - }} - ''') - homeButton.setFont(buttonFont) - homeButton.setCursor( - QCursor(Qt.CursorShape.PointingHandCursor)) - - # tombol customize - customizeButton = QPushButton() - customizeButton.setText('Customize') - customizeButton.setStyleSheet(f''' - QPushButton {{ - color: {text_color}; - background-color: {background}; - border: none; - border-radius: 20px; - }} - ''') - customizeButton.setFont(buttonFont) - customizeButton.setCursor( - QCursor(Qt.CursorShape.PointingHandCursor)) - - # tombol plan - planButton = QPushButton() - planButton.setText('Plan') - planButton.setStyleSheet(f''' - QPushButton {{ - color: {text_color}; - background-color: {background}; - border: none; - border-radius: 20px; - }} - ''') - planButton.setFont(buttonFont) - planButton.setCursor( - QCursor(Qt.CursorShape.PointingHandCursor)) - - # tombol list - listButton = QPushButton() - listButton.setText('List') - listButton.setStyleSheet(f''' - QPushButton {{ - color: {text_color}; - background-color: {button_color}; - border: none; - border-radius: 20px; - }} - ''') - listButton.setFont(buttonFont) - listButton.setFixedSize(96, 42) - listButton.setCursor( - QCursor(Qt.CursorShape.PointingHandCursor)) - - # tombol history - historyButton = QPushButton() - historyButton.setText('History') - historyButton.setStyleSheet(f''' - QPushButton {{ - color: {text_color}; - background-color: {background}; - border: none; - border-radius: 20px; - }} - ''') - historyButton.setFont(buttonFont) - historyButton.setCursor( - QCursor(Qt.CursorShape.PointingHandCursor)) - - # foto profil - profilePhoto = QLabel() - profilePhoto.setPixmap(QPixmap('../img/profile-dashboard.png')) - - - kotakKecil = QLabel() - kotakKecil.setFixedSize(5,5) - kotakKecil2 = QLabel() - kotakKecil2.setFixedSize(10,10) - kotakKecil3 = QLabel() - kotakKecil3.setFixedSize(30,30) - kotakKecil4 = QLabel() - kotakKecil4.setFixedSize(50,50) - kotakKecil5 = QLabel() - kotakKecil5.setFixedSize(3,3) - - # self.vbox.addWidget(kotakKecil) - # self.vbox.addWidget(kotakKecil) - # self.vbox.addWidget(kotakKecil) - # self.vbox.addWidget(kotakKecil) - # self.vbox.addWidget(kotakKecil) - # self.vbox.addWidget(kotakKecil5) - - hbox = QHBoxLayout() - hbox.setSpacing(0) - hbox.setContentsMargins(0,50,63,0) - hbox.addWidget(logo) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil2) - hbox.addWidget(kotakKecil5) - hbox.addWidget(homeButton) - hbox.addWidget(kotakKecil) - hbox.addWidget(kotakKecil4) - hbox.addWidget(customizeButton) - hbox.addWidget(kotakKecil3) - hbox.addWidget(kotakKecil2) - hbox.addWidget(kotakKecil) - hbox.addWidget(planButton) - hbox.addWidget(kotakKecil) - hbox.addWidget(listButton) - hbox.addWidget(kotakKecil2) - hbox.addWidget(kotakKecil5) - hbox.addWidget(historyButton) - hbox.addWidget(kotakKecil4) - hbox.addWidget(kotakKecil2) - hbox.addWidget(kotakKecil2) - hbox.addWidget(kotakKecil5) - hbox.addWidget(kotakKecil) - hbox.addWidget(profilePhoto) - # hbox.addWidget(kotakKecil4) - # hbox.addWidget(kotakKecil2) - # hbox.addWidget(kotakKecil5) - hbox.setAlignment(Qt.AlignmentFlag.AlignRight) - - - self.vbox.addLayout(hbox) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - - kotakKecil.setFixedSize(10,10) - - - - pixmap1 = QPixmap("../img/push-up.gif") - card1 = QLabel() - card1.setFixedSize(266, 100) - card1.setStyleSheet(stylesheet2) - card1.setPixmap(pixmap1.scaled(100,100)) - card1.setWordWrap(True) - card1.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[0][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[0][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[0][2]}</font></p></b>' - card101 = QLabel() - card101.setFixedSize(266, 168) - card101.setStyleSheet(stylesheet3) - card101.setText(text) - card101.setWordWrap(True) - card101.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[1][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[1][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[1][2]}</font></p></b>' - card2 = QLabel() - card2.setFixedSize(266, 100) - card2.setStyleSheet(stylesheet2) - card2.setPixmap(pixmap1.scaled(100,100)) - card2.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card102 = QLabel() - card102.setFixedSize(266, 168) - card102.setStyleSheet(stylesheet3) - card102.setText(text) - card102.setWordWrap(True) - card102.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[2][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[2][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[2][2]}</font></p></b>' - card3 = QLabel() - card3.setFixedSize(266, 100) - card3.setStyleSheet(stylesheet2) - card3.setPixmap(pixmap1.scaled(100,100)) - card3.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card103 = QLabel() - card103.setFixedSize(266, 168) - card103.setStyleSheet(stylesheet3) - card103.setText(text) - card103.setWordWrap(True) - card103.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[3][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[3][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[3][2]}</font></p></b>' - card4 = QLabel() - card4.setFixedSize(266, 100) - card4.setStyleSheet(stylesheet2) - card4.setPixmap(pixmap1.scaled(100,100)) - card4.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card104 = QLabel() - card104.setFixedSize(266, 168) - card104.setStyleSheet(stylesheet3) - card104.setText(text) - card104.setWordWrap(True) - card104.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[4][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[4][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[4][2]}</font></p></b>' - card5 = QLabel() - card5.setFixedSize(266, 100) - card5.setStyleSheet(stylesheet2) - card5.setPixmap(pixmap1.scaled(100,100)) - card5.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card105 = QLabel() - card105.setFixedSize(266, 168) - card105.setStyleSheet(stylesheet3) - card105.setText(text) - card105.setWordWrap(True) - card105.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[5][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[5][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[5][2]}</font></p></b>' - card6 = QLabel() - card6.setFixedSize(266, 100) - card6.setStyleSheet(stylesheet2) - card6.setPixmap(pixmap1.scaled(100,100)) - card6.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card106 = QLabel() - card106.setFixedSize(266, 168) - card106.setStyleSheet(stylesheet3) - card106.setText(text) - card106.setWordWrap(True) - card106.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[6][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[6][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[6][2]}</font></p></b>' - card7 = QLabel() - card7.setFixedSize(266, 100) - card7.setStyleSheet(stylesheet2) - card7.setPixmap(pixmap1.scaled(100,100)) - card7.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card107 = QLabel() - card107.setFixedSize(266, 168) - card107.setStyleSheet(stylesheet3) - card107.setText(text) - card107.setWordWrap(True) - card107.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[7][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[7][4]} Repetisi</font></p><b> <b><p><font color="aqua">{self.listLat[7][2]}</font></p></b>' - card8 = QLabel() - card8.setFixedSize(266, 100) - card8.setStyleSheet(stylesheet2) - card8.setPixmap(pixmap1.scaled(100,100)) - card8.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card108 = QLabel() - card108.setFixedSize(266, 168) - card108.setStyleSheet(stylesheet3) - card108.setText(text) - card108.setWordWrap(True) - card108.setAlignment(Qt.AlignmentFlag.AlignJustify) - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[8][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[8][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[8][2]}</font></p></b>' - card9 = QLabel() - card9.setFixedSize(266, 100) - card9.setStyleSheet(stylesheet2) - card9.setPixmap(pixmap1.scaled(100,100)) - card9.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card109 = QLabel() - card109.setFixedSize(266, 168) - card109.setStyleSheet(stylesheet3) - card109.setText(text) - card109.setWordWrap(True) - card109.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[9][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[9][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[9][2]}</font></p></b>' - card10 = QLabel() - card10.setFixedSize(266, 100) - card10.setStyleSheet(stylesheet2) - card10.setPixmap(pixmap1.scaled(100,100)) - card10.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card110 = QLabel() - card110.setFixedSize(266, 168) - card110.setStyleSheet(stylesheet3) - card110.setText(text) - card110.setWordWrap(True) - card110.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[10][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[10][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[10][2]}</font></p></b>' - card11 = QLabel() - card11.setFixedSize(266, 100) - card11.setStyleSheet(stylesheet2) - card11.setPixmap(pixmap1.scaled(100,100)) - card11.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card111 = QLabel() - card111.setFixedSize(266, 168) - card111.setStyleSheet(stylesheet3) - card111.setText(text) - card111.setWordWrap(True) - card111.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[11][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[11][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[11][2]}</font></p></b>' - card12 = QLabel() - card12.setFixedSize(266, 100) - card12.setStyleSheet(stylesheet2) - card12.setPixmap(pixmap1.scaled(100,100)) - card12.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card112 = QLabel() - card112.setFixedSize(266, 168) - card112.setStyleSheet(stylesheet3) - card112.setText(text) - card112.setWordWrap(True) - card112.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[12][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[12][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[12][2]}</font></p></b>' - card13 = QLabel() - card13.setFixedSize(266, 100) - card13.setStyleSheet(stylesheet2) - card13.setPixmap(pixmap1.scaled(100,100)) - card13.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card113 = QLabel() - card113.setFixedSize(266, 168) - card113.setStyleSheet(stylesheet3) - card113.setText(text) - card113.setWordWrap(True) - card113.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[13][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[13][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[13][2]}</font></p></b>' - card14 = QLabel() - card14.setFixedSize(266, 100) - card14.setStyleSheet(stylesheet2) - card14.setPixmap(pixmap1.scaled(100,100)) - card14.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card114 = QLabel() - card114.setFixedSize(266, 168) - card114.setStyleSheet(stylesheet3) - card114.setText(text) - card114.setWordWrap(True) - card114.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[14][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[14][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[14][2]}</font></p></b>' - card15 = QLabel() - card15.setFixedSize(266, 100) - card15.setStyleSheet(stylesheet2) - card15.setPixmap(pixmap1.scaled(100,100)) - card15.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card115 = QLabel() - card115.setFixedSize(266, 168) - card115.setStyleSheet(stylesheet3) - card115.setText(text) - card115.setWordWrap(True) - card115.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - text = f'<b><p><font style="font-size:24px;" color="purple">{self.listLat[15][1]}</font><tab></p></b> <b><p><font color="red" style="font-size:14px;">{self.listLat[15][5]} Detik</font></p><b> <b><p><font color="aqua">{self.listLat[15][2]}</font></p></b>' - card16 = QLabel() - card16.setFixedSize(266, 100) - card16.setStyleSheet(stylesheet2) - card16.setPixmap(pixmap1.scaled(100,100)) - card16.setAlignment(Qt.AlignmentFlag.AlignHCenter) - - card116 = QLabel() - card116.setFixedSize(266, 168) - card116.setStyleSheet(stylesheet3) - card116.setText(text) - card116.setWordWrap(True) - card116.setAlignment(Qt.AlignmentFlag.AlignJustify) - - - self.vbox.setSpacing(0) - self.vbox.setContentsMargins(0, 0,0,0) - - hbox1 = QHBoxLayout() - hbox1.addWidget(card1) - hbox1.addWidget(card2) - hbox1.addWidget(card3) - hbox1.addWidget(card4) - hbox1.setSpacing(1) - self.vbox.addLayout(hbox1) - hbox11 = QHBoxLayout() - hbox11.addWidget(card101) - hbox11.addWidget(card102) - hbox11.addWidget(card103) - hbox11.addWidget(card104) - hbox11.setSpacing(1) - self.vbox.addLayout(hbox11) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - - - hbox2 = QHBoxLayout() - hbox2.addWidget(card5) - hbox2.addWidget(card6) - hbox2.addWidget(card7) - hbox2.addWidget(card8) - hbox2.setSpacing(1) - self.vbox.addLayout(hbox2) - hbox12 = QHBoxLayout() - hbox12.addWidget(card105) - hbox12.addWidget(card106) - hbox12.addWidget(card107) - hbox12.addWidget(card108) - hbox12.setSpacing(1) - self.vbox.addLayout(hbox12) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - - - hbox3 = QHBoxLayout() - hbox3.addWidget(card9) - hbox3.addWidget(card10) - hbox3.addWidget(card11) - hbox3.addWidget(card12) - hbox3.setSpacing(1) - self.vbox.addLayout(hbox3) - hbox13 = QHBoxLayout() - hbox13.addWidget(card109) - hbox13.addWidget(card110) - hbox13.addWidget(card111) - hbox13.addWidget(card112) - hbox13.setSpacing(1) - self.vbox.addLayout(hbox13) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - - - hbox4 = QHBoxLayout() - hbox4.addWidget(card13) - hbox4.addWidget(card14) - hbox4.addWidget(card15) - hbox4.addWidget(card16) - hbox4.setSpacing(1) - self.vbox.addLayout(hbox4) - hbox14 = QHBoxLayout() - hbox14.addWidget(card113) - hbox14.addWidget(card114) - hbox14.addWidget(card115) - hbox14.addWidget(card116) - hbox14.setSpacing(1) - self.vbox.addLayout(hbox14) - self.vbox.addWidget(kotakKecil) - self.vbox.addWidget(kotakKecil) - - - - self.widget.setLayout(self.vbox) - - #Scroll Area Properties - self.scroll.setVerticalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOn) - self.scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarPolicy.ScrollBarAlwaysOff) - self.scroll.setWidgetResizable(True) - self.scroll.setWidget(self.widget) - - self.setCentralWidget(self.scroll) - - self.show() - - return - - -if(__name__ == "__main__"): - app = QtWidgets.QApplication(sys.argv) - window = listLatihan() - sys.exit(app.exec()) \ No newline at end of file diff --git a/src/listlatihan2.py b/src/listlatihan2.py index 62060e7badd9b3bda415ba9679661adbc817c41d..4a1cb4a7ac281f02fa231e280fbf3d9f2c54da3e 100644 --- a/src/listlatihan2.py +++ b/src/listlatihan2.py @@ -36,7 +36,7 @@ class listLatihan2(QWidget): def setUpListLatihanWindow(self): self.setFixedSize(1280,720) self.setWindowIcon(QIcon("img/logo.png")) - self.setWindowTitle("Fit-U - Daftar Latihan") + self.setWindowTitle("FitU - Daftar Latihan") self.setStyleSheet('background-color: #5A8D6C;') def openDetail(self, count, listLat): @@ -140,7 +140,7 @@ class listLatihan2(QWidget): ''') listButton.setFont(buttonFont) listButton.setFixedSize(96, 42) - listButton.move(1025, 53) + listButton.move(1020, 53) listButton.setCursor( QCursor(Qt.CursorShape.PointingHandCursor)) # listButton.clicked.connect(self.listWindow) @@ -232,13 +232,13 @@ class listLatihan2(QWidget): repDur = QLabel(card) if(count<8): - repDur.setText(f'<font style="font-size:14px;font-family="Sogoe UI;"><b>{self.listLat[count][4]} Detik<b>') + repDur.setText(f'<font style="font-size:14px;font-family="Sogoe UI;"><b>{self.listLat[count][4]} Seconds<b>') repDur.setStyleSheet("color: #174728") - repDur.move(203, 130) + repDur.move(185, 130) else: - repDur.setText(f'<font style="font-size:14px;font-family="Sogoe UI;"><b>{self.listLat[count][5]} Repetisi<b>') + repDur.setText(f'<font style="font-size:14px;font-family="Sogoe UI;"><b>{self.listLat[count][5]} Repetition<b>') repDur.setStyleSheet("color: #174728") - repDur.move(187,130) + repDur.move(170,130) desc = QLabel(card) t = f'<font style="font-size:12px;font-family="Sogoe UI;">{self.listLat[count][2]}' @@ -339,11 +339,11 @@ class MyPopup(QDialog): repDur = QLabel(bg) if(count<8): - repDur.setText(f'<font style="font-size:17px;font-family="Sogoe UI;"><b>{listLat[count][4]} Detik<b>') - repDur.move(760, 140) + repDur.setText(f'<font style="font-size:17px;font-family="Sogoe UI;"><b>{listLat[count][4]} Seconds<b>') + repDur.move(755, 140) else: - repDur.setText(f'<font style="font-size:17px;font-family="Sogoe UI;"><b>{listLat[count][5]} Repetisi<b>') - repDur.move(740, 140) + repDur.setText(f'<font style="font-size:17px;font-family="Sogoe UI;"><b>{listLat[count][5]} Repetition<b>') + repDur.move(735, 140) repDur.setStyleSheet("color: #174728; background-color: #D2DCC4;") diff --git a/src/plan.py b/src/plan.py index 25c67347fd8f3bf35cda9e296532fccace3c5eff..7e7b69d55b67689285cc73d45ed825200154964b 100644 --- a/src/plan.py +++ b/src/plan.py @@ -2,7 +2,7 @@ import sqlite3 import sys from PyQt6.QtCore import Qt, pyqtSignal -from PyQt6.QtGui import QPixmap, QCursor, QFont +from PyQt6.QtGui import QPixmap, QCursor, QFont, QIcon from PyQt6.QtWidgets import QApplication, QWidget, QLabel, QHBoxLayout, QVBoxLayout, QPushButton, QScrollArea BACKGROUNDCOLOR = '#5A8D6C' @@ -29,7 +29,8 @@ class plan(QWidget): def planWindow(self): self.label = QLabel("") self.label.setParent(self) - self.setWindowTitle('FitU') + self.setWindowTitle('FitU - Plan') + self.setWindowIcon(QIcon("img/logo.png")) self.setFixedSize(1280, 720) self.setStyleSheet(f'background-color: {BACKGROUNDCOLOR};') self.elements() @@ -168,23 +169,24 @@ class plan(QWidget): logo.setPixmap(QPixmap('img/logo-dashboard.png')) logo.move(60, 45) - # Home Button + # tombol home homeButton = QPushButton(self) homeButton.setText('Home') - homeButton.setStyleSheet(styleSheetNavbar0) + homeButton.setStyleSheet(styleSheetNavbar0) homeButton.setFont(buttonFont) - homeButton.setFixedSize(96, 42) - homeButton.move(507, 53) + homeButton.setFixedSize(96, 42) #pake ini buat kalau dia buletan + homeButton.move(660, 53) + homeButton.clicked.connect(self.dashboardWindow) homeButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) - homeButton.clicked.connect(self.dashboardWindow) - - # Customize Button + + # tombol customize customizeButton = QPushButton(self) customizeButton.setText('Customize') customizeButton.setStyleSheet(styleSheetNavbar0) customizeButton.setFont(buttonFont) - customizeButton.move(649, 58) - customizeButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + customizeButton.move(798, 58) + customizeButton.setCursor( + QCursor(Qt.CursorShape.PointingHandCursor)) customizeButton.clicked.connect(self.customWindow) # Plan Button @@ -193,29 +195,21 @@ class plan(QWidget): planButton.setStyleSheet(styleSheetNavbar1) planButton.setFont(buttonFont) planButton.setFixedSize(80, 42) - planButton.move(784, 58) + planButton.move(942, 53) - # List Button listButton = QPushButton(self) listButton.setText('List') listButton.setStyleSheet(styleSheetNavbar0) listButton.setFont(buttonFont) - listButton.move(898, 58) - listButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + listButton.move(1047, 58) + listButton.setCursor( + QCursor(Qt.CursorShape.PointingHandCursor)) listButton.clicked.connect(self.listWindow) - - # History Button - historyButton = QPushButton(self) - historyButton.setText('History') - historyButton.setStyleSheet(styleSheetNavbar0) - historyButton.setFont(buttonFont) - historyButton.move(979, 58) - historyButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) - - # Profile Picture - profilePicture = QLabel(self) - profilePicture.setPixmap(QPixmap('img/profile-dashboard.png')) - profilePicture.move(1133, 45) + + # foto profil + profilePhoto = QLabel(self) + profilePhoto.setPixmap(QPixmap('img/profile-dashboard.png')) + profilePhoto.move(1133, 45) # Create Card # Right Side @@ -248,6 +242,7 @@ class plan(QWidget): exButton.setFont(buttonFont) exButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) exButton.clicked.connect(lambda state, index=i: showExercise(index)) + exButton.clicked.connect(self.enableStartButton) title = QLabel(exButton) title.setText(f'<font style="font-size:24px;" color="#D2DCC4"; font-family="Sogoe UI";><b>{data[i][1]}<b>') title.move(20, 15) @@ -260,6 +255,8 @@ class plan(QWidget): # c.commit() c.close() + + # self.enableStartButton() predict = len(self.data2) dur = QLabel(exButton) dur.setText(f'<font style="font-size:18px;" color="#D2DCC4"; font-family="Sogoe UI";>{predict} Minutes') @@ -294,7 +291,6 @@ class plan(QWidget): c = con.cursor() c.execute("SELECT title, repetition, duration, gif FROM latihan_program, daftar_latihan WHERE latihan_program.exercise_id = daftar_latihan.exercise_id AND latihan_program.program_id = ?", (self.clickedRowData,)) self.data3 = c.fetchall() - # print("clicked:" + str(clickedRowData)) c.close() # clear the exercise data list @@ -357,15 +353,16 @@ class plan(QWidget): progText.setFont(font) progText.move(599, 182) - startButton = QPushButton(self) - startButton.setFont(font) - startButton.setText("START >") - startButton.move(1004, 620) - startButton.setFixedSize(144, 42) - startButton.setStyleSheet(styleSheetStart) - startButton.setFont(font1) - startButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) - startButton.clicked.connect(self.plan2Window) + self.startButton = QPushButton(self) + self.startButton.setFont(font) + self.startButton.setText("START >") + self.startButton.move(1004, 620) + self.startButton.setFixedSize(144, 42) + self.startButton.setStyleSheet(styleSheetStart) + self.startButton.setFont(font1) + self.startButton.setEnabled(False) + self.startButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) + self.startButton.clicked.connect(self.plan2Window) custButton = QPushButton(self) custButton.setFont(font) @@ -384,11 +381,12 @@ class plan(QWidget): def customWindow(self): self.switch.emit("customize", self.clickedRowData, {}) - # else: - # self.switch.emit("customize", 0, {}) def plan2Window(self): self.switch.emit("plan2", self.clickedRowData, {}) + + def enableStartButton(self): + self.startButton.setEnabled(True) if __name__ == '__main__': app = QApplication(sys.argv) diff --git a/src/plan2.py b/src/plan2.py index 267a48b89f6e62af1ef9126df836eb0788fee87c..bc2ae0ab078ce0f1fc1a23a22802045e1cfca69a 100644 --- a/src/plan2.py +++ b/src/plan2.py @@ -9,17 +9,14 @@ import time import time import sys class plan2(QWidget): - switch = pyqtSignal(str, dict) + switch = pyqtSignal(str, int, dict) def __init__(self, program_id): super().__init__() self.index = 0 self.conn = sqlite3.connect("fitu.db") self.c = self.conn.cursor() self.program_id = program_id - print("prgram" + str(self.program_id)) self.latihan = self.c.execute(f"SELECT gif FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall() - print(self.latihan) - # self.remaining_time = 0 self.timer = QTimer(self) self.timer.timeout.connect(self.updateTimer) self.remaining_time = 0 # initial value in seconds @@ -28,22 +25,12 @@ class plan2(QWidget): # self.setUpRegisterWindow() def setUpWindowPlan(self): - self.setWindowTitle("FitU - Plan") + self.setWindowTitle("FitU - Exercise") self.setFixedSize(1280, 720) - # background = QMovie("img/background.gif") - # background.setScaledSize(QSize(1280, 720)) - # background_label = QLabel(self) - # background_label.setGeometry(0, 0, 1280, 720) - # background_label.setMovie(background) - # background.start() - - # set the background style sheet - # self.setStyleSheet("background-image: url(img/background.gif);") - + self.setWindowIcon(QIcon("img/logo.png")) self.setUpPlan() def updateTimer(self): - # print(type(self.remaining_time)) if int(self.remaining_time) > 0: self.remaining_time = int(self.remaining_time) - 1 minutes = int(self.remaining_time) // 60 @@ -51,8 +38,7 @@ class plan2(QWidget): self.timer_label.setText(f"{minutes:02d}:{seconds:02d}") else: self.timer.stop() - QMessageBox.information(self, "Time's up!", "The countdown timer has ended.") - # QMessageBox.setStyleSheet(QLabel("color: white")) + QMessageBox.information(self, "Time's up!", "Let's go to next exercise!") def resetTimer(self): self.remaining_time = self.duration[self.index][0] @@ -68,7 +54,6 @@ class plan2(QWidget): def setUpPlan(self): self.setStyleSheet('background-color: #5A8D6C') - backButton = QPushButton(self) backButton.setGeometry(200, 150, 100, 100) backButton.resize(60, 60) @@ -77,7 +62,7 @@ class plan2(QWidget): backButton.setStyleSheet("background-color: #174728; color: #EEEEE2; border-radius: 30px; border: 2px;") backButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) backButton.move(50, 64) - backButton.clicked.connect(self.backToPlan) + backButton.clicked.connect(lambda: self.switch.emit("plan", 0, {})) self.currEx = QLabel(self) self.currEx.setFixedSize(360, 335) @@ -86,20 +71,9 @@ class plan2(QWidget): self.movie = QMovie(self.latihan[0][0]) self.currEx.setMovie(self.movie) self.movie.start() - # self.movie.setScaledSize(QSize(330, 305)) self.currEx.setScaledContents(True) self.movie.setSpeed(60) - # nextLabel = QLabel(self) - # nextLabel.setFixedSize(360, 335) - # nextLabel.move(460, 105) - # nextLabel.setStyleSheet("background-color: #5A8D6C; border-radius: 20px;") - - # prevLabel = QLabel(self) - # prevLabel.setFixedSize(360, 335) - # prevLabel.move(513, 581) - # prevLabel.setStyleSheet("background-color: #5A8D6C; border-radius: 20px;") - self.nextButton = QPushButton(self) self.nextButton.setGeometry(200, 150, 100, 100) self.nextButton.setIcon(QIcon("img/arrow-right.png")) @@ -117,10 +91,8 @@ class plan2(QWidget): self.prevButton = QPushButton(self) self.prevButton.setGeometry(200, 150, 100, 100) - # self.prevButton.setStyleSheet("background-image: url(img/arrow-left.png)") self.prevButton.setIcon(QIcon("img/arrow-left.png")) self.prevButton.setIconSize(QPixmap("img/arrow-left.png").size()) - # print("size: "+ str(QPixmap("img/arrow-left.png").size())) self.prevButton.setStyleSheet(''' QPushButton{ border: 5px #5A8D6C; @@ -132,22 +104,16 @@ class plan2(QWidget): self.prevButton.move(513, 581) self.prevButton.clicked.connect(self.prevEx) - # filename = "img/BGM NKCTHI.mp3" - # effect = QSoundEffect(self) - # effect.setSource(QUrl.fromLocalFile(filename)) - # # possible bug: QSoundEffect::Infinite cannot be used in setLoopCount - # effect.setLoopCount(-2) - # effect.play() self.name = self.c.execute(f"SELECT title FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall() - print(self.name) self.nameLabel = QLabel(self) self.nameLabel.setText(self.name[self.index][0]) - print(self.name[self.index][0]) self.nameLabel.setFont(QFont("Segoe UI", 20, QFont.Weight.Bold)) + self.nameLabel.setWordWrap(True) + self.nameLabel.setAlignment(Qt.AlignmentFlag.AlignCenter) self.nameLabel.setStyleSheet("color: #EEEEE2") - self.nameLabel.move(600, 461) - self.nameLabel.setFixedWidth(200) + self.nameLabel.move(0, 461) + self.nameLabel.setFixedWidth(1280) # duration = QLabel(self) self.repLabel = QLabel(self) @@ -159,52 +125,37 @@ class plan2(QWidget): self.timer_label.setGeometry(0, 0, 200, 50) self.timer_label.setAlignment(Qt.AlignmentFlag.AlignCenter) self.timer_label.move(547, 510) - self.timer_label.setFont(QFont("Arial", 20, QFont.Weight.Bold)) + self.timer_label.setFont(QFont("Segoe UI", 20, QFont.Weight.Bold)) self.timer_label.setStyleSheet("background-color: #EEEEE2; border-radius: 10px; border: 2px") self.start = time.time() # durationCount = c.execute(f"SELECT duration FROM daftar_self.latihan WHERE exercise_id in (SELECT exercise_id FROM self.latihan_program WHERE program_id = 1)").fetchall() self.repCount = self.c.execute(f"SELECT repetition FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall() self.duration = self.c.execute(f"SELECT duration FROM daftar_latihan NATURAL JOIN latihan_program WHERE program_id = {self.program_id}").fetchall() - print(type(self.duration[self.index+1][0])) - for i in self.repCount: - print("rep",i) - for i in self.duration: - print("dur",i) if self.duration[self.index][0] != None: self.remaining_time = self.duration[self.index][0] self.resetTimer() else: - self.repetitionLabel() - print((self.repCount[self.index][0])==None) + self.repetitionLabel() self.historyButton = QPushButton(self) - self.historyButton.setFixedSize(100, 100) + self.historyButton.setFixedSize(80, 80) self.historyButton.setEnabled(False) - self.historyButton.setText("End") - # self.historyButton.setIcon(QIcon("img/history.png")) - # self.historyButton.setIconSize(QPixmap("img/history.png").size()) + self.historyButton.setText("end") + self.historyButton.setFont(QFont("Segoe UI", 20, QFont.Weight.Bold, )) + self.historyButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) self.historyButton.setStyleSheet(''' QPushButton{ border: 5px #5A8D6C; + color: #EEEEE2; + border-radius: 30px; } QPushButton:hover { background-color: #174728; }''') - self.historyButton.move(1000, 500) + self.historyButton.move(615, 585) self.historyButton.clicked.connect(self.addHistory) - # player = QMediaPlayer() - # # playlist = QMediaPlaylist() - # media = QMediaContent(QUrl.fromLocalFile("BGM ITS OKAY NOT TO BE OKAY.mp3")) # Add your background music file here - # player.setMedia(media) - # player.setPlaybackMode(QMediaPlaylist.Loop) - # player.setMedia(player) - - # button = QPushButton("Toggle BGM") - # button.clicked.connect(lambda: player.play() if player.state() == QMediaPlayer.StoppedState else player.stop()) - # player.play() - def prevEx(self): if self.index > 0: @@ -214,14 +165,14 @@ class plan2(QWidget): self.movie.start() self.movie.setScaledSize(QSize(330, 305)) self.movie.setSpeed(60) - print("kiri:" + str(self.index)) + if self.duration[self.index][0] != None: self.remaining_time = self.duration[self.index][0] self.resetTimer() else: self.repetitionLabel() self.nameLabel.setText(self.name[self.index][0]) - print(self.index) + @@ -233,64 +184,37 @@ class plan2(QWidget): self.movie.start() self.movie.setScaledSize(QSize(330, 305)) self.movie.setSpeed(100) - print("kanan:" + str(self.index)) + if self.duration[self.index][0] != None: self.remaining_time = self.duration[self.index][0] self.resetTimer() else: self.repetitionLabel() self.nameLabel.setText(self.name[self.index][0]) - print(self.index) if self.index == (len(self.latihan)) - 1: - print("selsdasi") self.historyButton.setEnabled(True) def addHistory(self): # if self.index +1 >= len(self.latihan): - print(len(self.latihan)) - print("selesai") + self.timer.stop() self.nextButton.setEnabled(False) titleProgram = self.c.execute(f"SELECT title_program FROM program WHERE program_id = {self.program_id}").fetchone() - print("tit", titleProgram[0]) nameExe = self.c.execute(f"SELECT title FROM daftar_latihan WHERE exercise_id in (SELECT exercise_id FROM latihan_program WHERE program_id = {self.program_id})").fetchall() - print(nameExe) date = time.strftime("%Y-%m-%d", time.localtime()) - print(date) histId = self.c.execute("SELECT DISTINCT history_id FROM riwayat_latihan").fetchall() - totDuration = time.time() - self.start - print(totDuration) + totDuration = (time.time() - self.start) // 60 for i in range (len(self.latihan)): - print(nameExe[i][0], titleProgram[0], date, int(totDuration)) self.c.execute(f"""INSERT INTO riwayat_latihan (history_id, program_id, name, title_program, date, calories, tot_duration) VALUES ({len(histId)+401}, {self.program_id}, '{nameExe[i][0]}', '{(titleProgram[0])}', '{date}', NULL, {int(totDuration)})""") self.conn.commit() - self.switch.emit("endOfExe", {}) - - # def endButton(self): - # # historyButton = QPushButton(self) - # # historyButton.setFixedSize(100, 100) - # # historyButton.setText("End") - # # # historyButton.setIcon(QIcon("img/history.png")) - # # # historyButton.setIconSize(QPixmap("img/history.png").size()) - # # historyButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) - # # historyButton.setStyleSheet(''' - # # QPushButton{ - # # border: 5px #5A8D6C; - # # } - # # QPushButton:hover { - # # background-color: #174728; - # # }''') - # # historyButton.move(1000, 500) - # # historyButton.clicked.connect(self.addHistory) - - def backToPlan(self): - self.switch.emit("plan", 0, {}) + self.switch.emit("endOfExe",0, {}) + if __name__ == "__main__": app = QApplication(sys.argv) - window = plan() + window = plan2() window.show() app.exec() diff --git a/src/register.py b/src/register.py index 13982027e676e2cdb9b52076a288a293f658b933..0d5d8c690550fda30f22adc9ed74ae4474a32662 100644 --- a/src/register.py +++ b/src/register.py @@ -1,6 +1,6 @@ import sqlite3 from PyQt6.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QPushButton, QRadioButton, QCheckBox, QMessageBox -from PyQt6.QtGui import QFont, QPixmap, QCursor +from PyQt6.QtGui import QFont, QPixmap, QCursor, QIcon from PyQt6.QtCore import Qt, pyqtSignal import sys class register(QWidget): @@ -9,12 +9,10 @@ class register(QWidget): super().__init__() self.conn = sqlite3.connect('fitu.db') self.setUpWindow() - - # self.setUpRegisterWindow() - # self.conn = sqlite3.connect("fitu.db") def setUpWindow(self): self.setWindowTitle("FitU - Register") + self.setWindowIcon(QIcon("img/logo.png")) self.setFixedSize(1280, 720) self.setUp() @@ -25,7 +23,6 @@ class register(QWidget): background.setPixmap(bacgroundImage) background.move(0, 0) - inputSize = QFont() inputSize.setFamily("Segoe UI") inputSize.setPointSize(10) @@ -116,6 +113,7 @@ class register(QWidget): } QPushButton:hover { background-color: #5A8D6C; + color: #D2DCC4; } ''') self.registerButton.move(873, 545) @@ -139,7 +137,9 @@ class register(QWidget): self.thin.setCursor(QCursor(Qt.CursorShape.PointingHandCursor)) def register(self): - if (self.nameInput == '' or self.age == '' or self.height == '' or self.weight == '' or (not self.male and not self.female) or self.fit == '' or self.thin == ''): + if (self.nameInput.text() == '' or self.age.text() == '' or self.height.text() == '' or self.weight.text() == '' + or (not self.male.isChecked() and not self.female.isChecked()) + or (not self.fit.isChecked() and not self.thin.isChecked())): msgBox = QMessageBox() msgBox.setText("<p>Please fill out the form properly!</p>") msgBox.setWindowTitle("Registration Failed") @@ -148,12 +148,29 @@ class register(QWidget): msgBox.setStandardButtons(QMessageBox.StandardButton.Ok) msgBox.exec() return + # elif (not self.nameInput.text().isalpha() and self.nameInput.text().isspace()): + # msgBox = QMessageBox() + # msgBox.setText("<p>Name must be in alphabet</p>") + # msgBox.setWindowTitle("Registration Failed") + # msgBox.setIcon(QMessageBox.Icon.Warning) + # msgBox.setStyleSheet("background-color: white") + # msgBox.setStandardButtons(QMessageBox.StandardButton.Ok) + # msgBox.exec() + # return + + elif not self.age.text().isdigit() or not self.height.text().isdigit() or not self.weight.text().isdigit(): + msgBox = QMessageBox() + msgBox.setText("<p>Age, Height, and Weight must be in number</p>") + msgBox.setWindowTitle("Registration Failed") + msgBox.setIcon(QMessageBox.Icon.Warning) + msgBox.setStyleSheet("background-color: white") + msgBox.setStandardButtons(QMessageBox.StandardButton.Ok) + msgBox.exec() + else: c = self.conn.cursor() if (self.female.isChecked()): - print("female") if (self.fit.isChecked() == self.thin.isChecked()): - print("both") c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'fit, thin', 'female', '{self.age.text()}')" ) @@ -162,10 +179,8 @@ class register(QWidget): c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'thin', 'female', '{self.age.text()}')" ) - print("thin") self.conn.commit() elif (self.fit.isChecked()): - print("fit") c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'fit', 'female', '{self.age.text()}')" ) @@ -175,22 +190,18 @@ class register(QWidget): elif(self.male.isChecked()): - print("male") if(self.fit.isChecked() and self.thin.isChecked()): - print("both") c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'fit, thin', 'male', '{self.age.text()}')" ) self.conn.commit() elif (self.thin.isChecked()): - print("thin") c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'thin', 'male', '{self.age.text()}')" ) self.conn.commit() elif (self.fit.isChecked()): - print("fit") c.execute( f"INSERT INTO user (name, height, weight, goal, gender, age) VALUES ('{self.nameInput.text()}', '{self.height.text()}', '{self.weight.text()}', 'fit', 'male', '{self.age.text()}')" ) @@ -203,11 +214,7 @@ class register(QWidget): self.height.clear() self.weight.clear() self.switch.emit() - - # def showDashboard(self): - # self.switch.emit("dashboard", {}) - if __name__ == "__main__": app = QApplication(sys.argv) diff --git a/src/tesBacaDB.py b/src/tesBacaDB.py deleted file mode 100644 index 14ea10eef17f53d98e3ad497c7371da404af3446..0000000000000000000000000000000000000000 --- a/src/tesBacaDB.py +++ /dev/null @@ -1,153 +0,0 @@ -import sqlite3 - -def tesBaca(): - con = sqlite3.connect("fitu.db") - cur = con.cursor() - - cur.execute(""" - CREATE TABLE IF NOT EXISTS user ( - name text PRIMARY KEY, - height integer, - weight integer, - goal text, - gender text, - age integer - ) - """) - cur.execute(""" - CREATE TABLE IF NOT EXISTS daftar_latihan ( - exercise_id integer PRIMARY KEY, - title text, - description text, - goals text, - duration integer, - repetition integer, - gif text - ) - """) - - cur.execute(""" - CREATE TABLE IF NOT EXISTS riwayat_latihan ( - history_id integer PRIMARY KEY AUTOINCREMENT, - program_id integer, - name text, - title_program text, - calories integer, - date text, - tot_duration integer - ) - """) - cur.execute(""" - CREATE TABLE IF NOT EXISTS program ( - program_id integer PRIMARY KEY AUTOINCREMENT, - title_program text - ) - """) - - cur.execute(""" - CREATE TABLE IF NOT EXISTS latihan_program ( - program_id integer, - exercise_id integer, - FOREIGN KEY (program_id) REFERENCES program (program_id) - ) - """) - - cur.execute(""" - INSERT or IGNORE INTO daftar_latihan - (exercise_id, title, description, goals, duration, repetition, gif) - VALUES - (101, "Jumping Rope", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/"), - (102, "Running", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/"), - (103, "Jumping Jacks", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-jumpingjack.gif"), - (104, "Plank", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-plank.gif"), - (105, "Bridge", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-bridges.gif"), - (106, "High Knees", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-highknee.gif"), - (107, "Mountain Climber", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL, "img/exe-mountain.gif"), - (108, "Russian Twist", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', 30, NULL,"img/exe-russian.gif"), - (201, 'Push Up', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor','Goals', NULL, 10, 'img/exe-pushup.gif'), - (202, "Sit Up", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-situp.gif"), - (203, "Pull Up", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/"), - (204, "Squat Jump", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/"), - (205, "Lunges", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-lunges.gif"), - (206, "Crunches", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-crunches.gif"), - (207, "Burpees", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-burpees.gif"), - (208, "Bicycle Crunch", "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ac venenatis purus. Nulla a fringilla ante. Aenean id ipsum pellentesque, convallis ex eget, cursus dolor", 'Goals', NULL, 10, "img/exe-bicycle.gif") - """) - - cur.execute(""" - INSERT or IGNORE INTO program - (program_id, title_program) - VALUES - (1, 'Full Body Workout'), - (2, 'Upper Body Workout'), - (3, 'Lower Body Workout'), - (4, 'Core Workout') - """) - - cur.execute(""" - INSERT or IGNORE INTO latihan_program - (program_id, exercise_id) - VALUES - (1, 201), - (1, 105), - (1, 106), - (1, 202) - """) - cur.execute(""" - INSERT INTO riwayat_latihan - (program_id, name, title_program, calories, date, tot_duration) - VALUES - (1, 'Push Up', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Sit Up', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Pull Up', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Squat Jump', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Lunges', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Crunches', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Burpees', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Bicycle Crunch', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Jumping Rope', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Running', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Jumping Jacks', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Plank', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Bridge', 'Chest Day', 100, '2020-12-12', 30), - (1, 'High Knees', 'Chest Day', 100, '2020-12-12', 30), - (1, 'Squat', 'Chest Day', 100, '2020-12-12', 30), - (2, 'Push Up', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Sit Up', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Pull Up', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Squat Jump', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Lunges', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Crunches', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Burpees', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Bicycle Crunch', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Jumping Rope', 'Leg Day', 100, '2020-12-15', 30), - (2, 'Running', 'Leg Day', 100, '2020-12-15', 30) - """) - - con.commit() - con.close() - # cur.execute(""" - # INSERT INTO daftar_request - # (user_id, trainer_id, umur, jenis_kelamin, berat_badan, tinggi_badan, tujuan, status, title, description) - # VALUES - # (1, 2, 20, 'Laki-laki', 65, 170, 'I want to have a sixpack stomach', True, 'Chest Day', 'This workout plan is made to strengthen your \nabdominal muscles.'), - # (1,2,20, 'Laki-laki', 65, 170, 'I want to have a strong leg muscles', True, 'Leg Day', 'This workout plan is made to strengthen your \nleg muscles.') - # """) - # cur.execute(""" - # INSERT INTO workout - # (request_id, olahraga_id, status) - # VALUES - # (1, 2, False), - # (1, 3, False), - # (1, 6, False), - # (2, 4, False), - # (2, 7, False) - # """) - - - # daftarLatihan = cur.execute("SELECT * FROM daftar_latihan") - # daftarLatihan = daftarLatihan.fetchall() - - # for i in daftarLatihan: - # print(i) -tesBaca() \ No newline at end of file diff --git a/src/tesQuery.py b/src/tesQuery.py deleted file mode 100644 index ee8fe52a0f133bf2ea36609bcf55e7fac40a0dc4..0000000000000000000000000000000000000000 --- a/src/tesQuery.py +++ /dev/null @@ -1,10 +0,0 @@ -import sqlite3 - -con = sqlite3.connect("fitu.db") -cur = con.cursor() -daftarLatihan = cur.execute("SELECT * FROM daftar_latihan") - -count = 1 -for i in daftarLatihan.fetchall(): - print(f"{count}. {i[0]}") - count+=1 \ No newline at end of file