Skip to content
Snippets Groups Projects
Commit 1ccc0f84 authored by Afnan  Ramadhan's avatar Afnan Ramadhan
Browse files
parents 69e74837 a1439b6f
Branches
Tags
No related merge requests found
img/card-dashboard.png

7.45 KiB

img/logo-dashboard.png

2.75 KiB

img/logo-square.png

18 KiB

img/profile-dashboard.png

1.59 KiB

img/register-page.png

25.2 KiB

import sys
from PyQt6.QtCore import Qt, pyqtSignal
from PyQt6.QtGui import QCursor, QFont, QPixmap
from PyQt6.QtWidgets import QApplication, QLabel, QPushButton, QWidget
background = '#5A8D6C'
button_color = '#174728'
text_color = '#EEEEE2'
card_color = '#D2DCC4'
class dashboard(QWidget):
def __init__(self, user=None):
super().__init__()
if (user == None):
self.user = {
'name': 'krisi',
'height': 170,
'weight': 65,
'gender': 'Perempuan',
'age': 20,
'goal': 'I want to have a sixpack stomach'
}
else:
self.user = user
self.dashboardWindow()
def dashboardWindow(self):
self.setWindowTitle('Dashboard - FitU')
self.setFixedSize(1280, 720)
self.setStyleSheet(f'background-color: {background};')
self.element()
def element(self):
# kumpulan font
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)
# masukkan logo
logo = QLabel(self)
logo.setPixmap(QPixmap('img/logo-dashboard.png'))
logo.move(60, 45)
# tombol home
homeButton = QPushButton(self)
homeButton.setText('Home')
homeButton.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {button_color};
border: none;
border-radius: 20px;
}}
''')
homeButton.setFont(buttonFont)
homeButton.setFixedSize(96, 42) #pake ini buat kalau dia buletan
homeButton.move(507, 53)
homeButton.setCursor(
QCursor(Qt.CursorShape.PointingHandCursor))
# tombol customize
customizeButton = QPushButton(self)
customizeButton.setText('Customize')
customizeButton.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {background};
border: none;
border-radius: 20px;
}}
''')
customizeButton.setFont(buttonFont)
customizeButton.move(649, 58)
customizeButton.setCursor(
QCursor(Qt.CursorShape.PointingHandCursor))
# tombol plan
planButton = QPushButton(self)
planButton.setText('Plan')
planButton.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {background};
border: none;
border-radius: 20px;
}}
''')
planButton.setFont(buttonFont)
planButton.move(807, 58)
planButton.setCursor(
QCursor(Qt.CursorShape.PointingHandCursor))
# tombol list
listButton = QPushButton(self)
listButton.setText('List')
listButton.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {background};
border: none;
border-radius: 20px;
}}
''')
listButton.setFont(buttonFont)
listButton.move(898, 58)
listButton.setCursor(
QCursor(Qt.CursorShape.PointingHandCursor))
# tombol history
historyButton = QPushButton(self)
historyButton.setText('History')
historyButton.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {background};
border: none;
border-radius: 20px;
}}
''')
historyButton.setFont(buttonFont)
historyButton.move(979, 58)
historyButton.setCursor(
QCursor(Qt.CursorShape.PointingHandCursor))
# foto profil
profilePhoto = QLabel(self)
profilePhoto.setPixmap(QPixmap('img/profile-dashboard.png'))
profilePhoto.move(1133, 45)
# say Hello
self.hello = QLabel(self)
self.hello.setText(f"Hello, {self.user['name']}!")
self.hello.move(101, 236)
self.hello.setFont(helloFont)
self.hello.setStyleSheet(f'color: {text_color};')
self.hello.setAlignment(Qt.AlignmentFlag.AlignLeft)
# quote
quote = QLabel(self)
quote.setText("Saran quote dong maz\nbingung mau naro quote apa nih")
quote.setStyleSheet(f'color: {text_color};')
quote.move(101, 320)
quote.setFont(quoteFont)
quote.setAlignment(Qt.AlignmentFlag.AlignLeft)
# tombol start
start = QPushButton(self)
start.setText("Let's Start!")
start.setStyleSheet(f'''
QPushButton {{
color: {text_color};
background-color: {button_color};
border: none;
border-radius: 20px;
}}
''')
start.setFont(buttonFont)
start.setFixedSize(233, 47) #pake ini buat kalau dia buletan
start.move(101, 511)
start.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
# membuat history card
card = QLabel(self)
card.setPixmap(QPixmap('img/card-dashboard.png'))
card.move(633, 172)
kiri = QPushButton(self)
kiri.setText('<')
kiri.setStyleSheet(f'''
QPushButton {{
color: {button_color};
background-color: {card_color};
border: none;
border-radius: 20px;
}}
''')
kiri.setFont(dateFont)
kiri.move(727, 195)
kiri.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
date = QLabel(self)
date.setText("Date :")
date.setStyleSheet(f'color: {button_color}; background-color: {card_color};')
date.move(793, 195)
date.setFont(dateFont)
date.setAlignment(Qt.AlignmentFlag.AlignLeft)
kanan = QPushButton(self)
kanan.setText('>')
kanan.setStyleSheet(f'''
QPushButton {{
color: {button_color};
background-color: {card_color};
border: none;
border-radius: 20px;
}}
''')
kanan.setFont(dateFont)
kanan.move(1047, 195)
kanan.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
duration = QLabel(self)
duration.setText("Duration :")
duration.setStyleSheet(f'color: {button_color}; background-color: {card_color};')
duration.move(667,282)
duration.setFont(historyFont)
duration.setAlignment(Qt.AlignmentFlag.AlignLeft)
prog = QLabel(self)
prog.setText("Program Name: ")
prog.setStyleSheet(f'color: {button_color}; background-color: {card_color};')
prog.move(667, 317)
prog.setFont(historyFont)
prog.setAlignment(Qt.AlignmentFlag.AlignLeft)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = dashboard()
window.show()
sys.exit(app.exec())
\ No newline at end of file
import sqlite3
from PyQt6.QtWidgets import QApplication, QLabel, QWidget, QLineEdit, QPushButton, QRadioButton, QCheckBox, QMessageBox
from PyQt6.QtGui import QFont, QPixmap, QCursor
from PyQt6.QtCore import Qt
import sys
class register(QWidget):
def __init__(self):
super().__init__()
self.setUpWindow()
# self.setUpRegisterWindow()
# self.conn = sqlite3.connect("fitu.db")
def setUpWindow(self):
self.setWindowTitle("FitU - Register")
self.setFixedSize(1280, 720)
self.setUp()
def setUp(self):
#Background
background = QLabel(self)
bacgroundImage = QPixmap("img/register-page.png")
background.setPixmap(bacgroundImage)
background.move(0, 0)
inputSize = QFont()
inputSize.setFamily("Segoe UI")
inputSize.setPointSize(10)
genderSize = QFont()
genderSize.setFamily("Segoe UI")
genderSize.setPointSize(14)
registerText = QFont()
registerText.setFamily("Segoe UI")
registerText.setPointSize(16)
self.nameInput = QLineEdit(self)
self.nameInput.setPlaceholderText("Input Your Name")
self.nameInput.setFixedSize(379, 44)
self.nameInput.setFont(inputSize)
self.nameInput.setStyleSheet('''
padding: 11px 30px 11px 30px;
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20px;
color: rgba(23, 71, 40, 1);
background-color: #D2DCC4
''')
self.nameInput.move(773, 196)
self.age = QLineEdit(self)
self.age.setPlaceholderText("Input Your Age")
self.age.setFixedSize(172, 44)
self.age.setFont(inputSize)
self.age.setStyleSheet('''
padding: 11px 30px 11px 30px;
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20px;
color: rgba(23, 71, 40, 1);
background-color: #D2DCC4
''')
self.age.move(976, 285)
self.height = QLineEdit(self)
self.height.setPlaceholderText("Input Your Height")
self.height.setFixedSize(172, 44)
self.height.setFont(inputSize)
self.height.setStyleSheet('''
padding: 11px 30px 11px 30px;
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20px;
color: rgba(23, 71, 40, 1);
background-color: #D2DCC4
''')
self.height.move(769, 392)
self.weight = QLineEdit(self)
self.weight.setPlaceholderText("Input Your Weight")
self.weight.setFixedSize(172, 44)
self.weight.setFont(inputSize)
self.weight.setStyleSheet('''
padding: 11px 30px 11px 30px;
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20px;
color: rgba(23, 71, 40, 1);
background-color: #D2DCC4
''')
self.weight.move(976, 392)
self.male = QRadioButton(self)
self.male.move(780, 285)
self.male.setStyleSheet(f'background-color: #174728 ; color: #D2DCC4 ')
self.male.setText("Male")
self.male.setFont(genderSize)
self.male.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.female = QRadioButton(self)
self.female.move(780, 315)
self.female.setStyleSheet('background-color: #174728 ; color: #D2DCC4 ')
self.female.setText("Female")
self.female.setFont(genderSize)
self.female.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.registerButton = QPushButton(self)
self.registerButton.setText("Register")
self.registerButton.setFixedSize(172, 44)
self.registerButton.setStyleSheet('''
border: 1px solid rgba(255, 255, 255, 0.8);
border-radius: 20px;
color: rgba(23, 71, 40, 1);
background-color: #D2DCC4
''')
self.registerButton.move(873, 545)
self.registerButton.setFont(registerText)
self.registerButton.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.fit = QCheckBox(self)
self.fit.move(781, 486)
self.fit.setText("Fit our body")
self.fit.setFont(genderSize)
self.fit.setStyleSheet('background-color: #174728 ; color: #D2DCC4 ')
self.fit.setCursor(QCursor(Qt.CursorShape.PointingHandCursor))
self.thin = QCheckBox(self)
self.thin.move(781, 516)
self.thin.setText("Thin")
self.thin.setFont(genderSize)
self.thin.setStyleSheet('background-color: #174728 ; color: #D2DCC4 ')
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):
msgBox = QMessageBox()
msgBox.setText("<p>Please fill out the form properly!</p>")
msgBox.setWindowTitle("Registration Failed")
msgBox.setIcon(QMessageBox.Icon.Warning)
msgBox.setStyleSheet("background-color: white")
msgBox.setStandardButtons(QMessageBox.StandardButton.Ok)
msgBox.exec()
c = self.conn.cursor()
if (self.female):
if (self.thin):
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()}')"
)
self.conn.commit()
elif (self.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()}')"
)
self.conn.commit()
else:
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()}')"
)
self.conn.commit()
if (self.male):
if (self.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):
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()}')"
)
self.conn.commit()
else:
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()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = register()
window.show()
app.exec()
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment