diff --git a/add_form.py b/add_form.py index 45ebebf..c556707 100644 --- a/add_form.py +++ b/add_form.py @@ -8,9 +8,9 @@ class AddForm(QDialog): def __init__(self, parent=None): super(AddForm, self).__init__(parent) - with open("data.json", "r", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "r", encoding="utf-8") as f: self.data = json.load(f) - uic.loadUi("add_form.ui", self) + uic.loadUi("../ClassRanking/add_form.ui", self) self.submit.clicked.connect(self.addNewData) def addNewData(self): @@ -21,7 +21,7 @@ def addNewData(self): else: self.new_entity = {"name": self.nameInput, "pwd": self.pwdInput} self.data.append(self.new_entity) - with open("data.json", "w", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "w", encoding="utf-8") as f: self.data = json.dump(self.data, f, indent=4, sort_keys=True, ensure_ascii=False) self.parent().loadCurrentRank() self.close() \ No newline at end of file diff --git a/add_form.ui b/add_form.ui index 6f012b2..03213bf 100644 --- a/add_form.ui +++ b/add_form.ui @@ -37,7 +37,7 @@ color: #fff; padding: 5%; - Submit + Thêm @@ -45,7 +45,7 @@ padding: 5%; 130 140 - 221 + 241 31 @@ -55,7 +55,7 @@ padding: 5%; - Sign in to yout existing account + Thêm thông tin học sinh vào BXH @@ -73,7 +73,7 @@ padding: 5%; - Username + Họ và tên @@ -91,7 +91,7 @@ padding: 5%; - Password + Điểm @@ -107,7 +107,7 @@ padding: 5%; border-radius: 5%; - Nhập tên tài khoản + Nhập họ và tên @@ -127,25 +127,31 @@ padding: 5%; QLineEdit::Normal - Nhập mật khẩu + Nhập điểm - 210 + 150 90 - 71 + 191 41 + Segoe UI 20 + false + true + + font: 700 20pt "Segoe UI"; + - Login + Thêm học sinh Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/backup.ui b/backup.ui new file mode 100644 index 0000000..e1a8f81 --- /dev/null +++ b/backup.ui @@ -0,0 +1,454 @@ + + + MainWindow + + + + 0 + 0 + 900 + 600 + + + + MainWindow + + + height: 200px; +background: qlineargradient(x1:0, y1:0, x2:1, y2:1, +stop:0 rgb(227, 31, 38), stop: 0.4 rgb(231, 55, 36), stop:1 rgb(246, 139, 31) +) + + + + + + + + + + 0 + 150 + + + + + 16777215 + 150 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + 400 + 0 + + + + + 400 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 40 + 90 + 341 + 41 + + + + font: 700 20pt "Arial"; +color: white; + + + BẢNG XẾP HẠNG TỔNG + + + + + + 130 + 10 + 150 + 70 + + + + + 150 + 70 + + + + + 150 + 70 + + + + + + + icons/eOj2se7dy.png + + + true + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + + + 0 + 70 + + + + + 16777215 + 70 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + + + + 500 + 0 + + + + border-radius: 5px; +font: 12pt "Segoe UI"; +border: 1px solid white; +color: white; + + + Search + + + + + + + + + + + 90 + 40 + + + + + 90 + 40 + + + + background-color: white; +color: black; +font: 12pt "Segoe UI"; +border-radius: 5px; + + + + Tất cả + + + + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + 8 + 5 + 181 + 41 + + + + PointingHandCursor + + + font: 700 14pt "Arial"; +color: white; + + + Add Student + + + + icons/icons8-add-24.pngicons/icons8-add-24.png + + + + 48 + 48 + + + + + + + + + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + 20 + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + color: white; + + + STT + + + + + + + + 12 + true + + + + color: white; + + + Họ và Tên + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + + 12 + true + + + + color: white; + + + Lớp + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + + 12 + true + + + + color: white; + + + Điểm + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + color: white; + + + Sửa + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + color: white; + + + Xóa + + + + + + + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + + + diff --git a/data.json b/data.json index 8ef805b..90d5e8a 100644 --- a/data.json +++ b/data.json @@ -1,26 +1,22 @@ [ { - "name": "Vật lý", - "pwd": "1" + "name": "Tường Duy", + "pwd": "9.5" }, { - "name": "Hoá học", - "pwd": "45" + "name": "Đình Phước", + "pwd": "10" }, { - "name": "Sinh học", - "pwd": "48" + "name": "Gia Bảo", + "pwd": "9" }, { - "name": "Java", - "pwd": "12" + "name": "Anh Khoa", + "pwd": "8" }, { - "name": "Python", - "pwd": "90" - }, - { - "name": "Vietnamese", - "pwd": "99" + "name": "Ngọc Hân", + "pwd": "8.5" } ] \ No newline at end of file diff --git a/demoui.ui b/demoui.ui new file mode 100644 index 0000000..580f221 --- /dev/null +++ b/demoui.ui @@ -0,0 +1,583 @@ + + + MainWindow + + + + 0 + 0 + 900 + 600 + + + + + 12 + + + + MainWindow + + + + + 10 + + + + + + 200 + 0 + + + + + 200 + 16777215 + + + + background-color: #F5F6F8; +border-radius: 15px; + + + + + + + 0 + 100 + + + + + 16777215 + 100 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + 0 + 18 + 71 + 61 + + + + + + + icons/TuongDii.png + + + true + + + + + + 77 + 18 + 91 + 31 + + + + + 12 + true + + + + + + + Tường Dii + + + + + false + + + + 81 + 45 + 49 + 16 + + + + + 10 + true + false + + + + + + + Twdii + + + + + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + 0 + + + 0 + + + + + + 16777215 + 50 + + + + + 12 + true + + + + + + + Trang cá nhân + + + + + + + + 16777215 + 50 + + + + + 12 + true + + + + + + + Bảng xếp hạng + + + + + + + + 16777215 + 50 + + + + + 12 + true + + + + + + + Ghi chú + + + + + + + + + + + + + + + + background-color: white; +border-radius: 15px; + + + + + + + + 0 + 100 + + + + + 16777215 + 100 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + 300 + 0 + + + + + 300 + 16777215 + + + + + + + + Arial + 16 + false + true + + + + font: 700 16pt "Arial"; + + + + BẢNG XẾP HẠNG TỔNG + + + + + + + + + + + + + + + + + + + + + 0 + 70 + + + + + 16777215 + 70 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + + + border-radius: 5px; +font: 12pt "Segoe UI"; +border: 1px solid ; + + + Search + + + + + + + + + + + 100 + 40 + + + + + 100 + 40 + + + + background-color: white; + + + + + + + 12 + + + + + Tất cả + + + + + + + + + + + + 100 + 0 + + + + + 100 + 16777215 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + 12 + true + + + + + + + Thêm + + + + icons/add.pngicons/add.png + + + + 32 + 32 + + + + + + + + + + + + + + + 0 + 40 + + + + + 16777215 + 40 + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + + + + STT + + + + + + + + 12 + true + + + + + + + Họ và Tên + + + + + + + + 12 + true + + + + + + + Lớp + + + + + + + + 12 + true + + + + + + + Điểm + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + + + + Sửa + + + + + + + + 80 + 0 + + + + + 80 + 16777215 + + + + + 12 + true + + + + + + + Xóa + + + + + + + + + + background-color: rgba( 255, 255, 255, 0% ) + + + + + + + + + + + + diff --git a/edit_form.py b/edit_form.py index 8559e22..19bbc4e 100644 --- a/edit_form.py +++ b/edit_form.py @@ -9,9 +9,9 @@ class EditForm(QDialog): def __init__(self, parent, index, dashboard): super(EditForm, self).__init__(parent) self.index = index - with open("data.json", "r", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "r", encoding="utf-8") as f: self.data = json.load(f) - uic.loadUi("add_form.ui", self) + uic.loadUi("../ClassRanking/add_form.ui", self) self.name.setText(self.data[self.index]["name"]) self.pwd.setText(self.data[self.index]["pwd"]) self.submit.clicked.connect(self.updateData) @@ -23,7 +23,7 @@ def updateData(self): if len(self.data[self.index]["name"])==0 or len(self.data[self.index]["pwd"])==0: self.error.setText("Vui lòng nhập số liệu hợp lệ") else: - with open("data.json", "w", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "w", encoding="utf-8") as f: json.dump(self.data, f, indent=4, sort_keys=True, ensure_ascii=False) self.dashboard.loadCurrentRank() self.close() \ No newline at end of file diff --git a/icons/MindX_Technology School_logo_Final-03.png b/icons/MindX_Technology School_logo_Final-03.png new file mode 100644 index 0000000..fbfdc6d Binary files /dev/null and b/icons/MindX_Technology School_logo_Final-03.png differ diff --git a/icons/TuongDii.png b/icons/TuongDii.png new file mode 100644 index 0000000..0aa5c25 Binary files /dev/null and b/icons/TuongDii.png differ diff --git a/icons/XSchool (2).png b/icons/XSchool (2).png new file mode 100644 index 0000000..d37c971 Binary files /dev/null and b/icons/XSchool (2).png differ diff --git a/icons/icons8-add-24.png b/icons/icons8-add-24.png new file mode 100644 index 0000000..4e526f3 Binary files /dev/null and b/icons/icons8-add-24.png differ diff --git a/icons/icons8-male-user-48.png b/icons/icons8-male-user-48.png new file mode 100644 index 0000000..9977c5f Binary files /dev/null and b/icons/icons8-male-user-48.png differ diff --git a/icons/icons8-note-48.png b/icons/icons8-note-48.png new file mode 100644 index 0000000..61fd3c7 Binary files /dev/null and b/icons/icons8-note-48.png differ diff --git a/icons/icons8-ranking-48.png b/icons/icons8-ranking-48.png new file mode 100644 index 0000000..478818d Binary files /dev/null and b/icons/icons8-ranking-48.png differ diff --git a/main.py b/main.py index cd06efa..11025c7 100644 --- a/main.py +++ b/main.py @@ -8,7 +8,7 @@ class Dashboard(qtw.QWidget): def __init__(self): super(Dashboard, self).__init__() - uic.loadUi("main.ui", self) + uic.loadUi("../ClassRanking/main.ui", self) self.loadCurrentRank() self.show_new = ShowNew(self) self.detail = None diff --git a/main.ui b/main.ui index 0360eb2..6a4e586 100644 --- a/main.ui +++ b/main.ui @@ -10,21 +10,33 @@ 606 + + + 0 + 60 + + + + + 16777215 + 606 + + Form - 0 + 9 - 0 + 9 0 - 0 + 9 0 @@ -33,238 +45,319 @@ - 148 + 200 0 - 148 + 200 16777215 - QWidget#sidebar { - background-color: #fa1 -} + + background-color: #F5F6F8; + border-radius: 15px; + - - + + - 128 - 40 + 0 + 100 - 128 - 40 + 200 + 100 - - - 8 + + + + 80 + 20 + 91 + 31 + - - 0 + + + 12 + true + - - 0 + + - - 0 + + Tường Dii - - 0 + + + + false - - - - - 32 - 32 - - - - - 32 - 32 - - - - - - - - icons/rank.pngicons/rank.png - - - - 32 - 32 - - - - - + + + 82 + 48 + 49 + 16 + + + + + 10 + true + false + + + + + + + Twdii + + + + + + 7 + 20 + 71 + 61 + + + + + + + icons/TuongDii.png + + + true + + - + - 128 + 0 0 - 128 + 190 16777215 - - - + + + - 80 - 32 + 0 + 60 - 80 - 32 - - - - PointingHandCursor - - - All - - - - icons/all.pngicons/all.png - - - - 28 - 28 + 16777215 + 60 - - false - + + + + + + 30 + 30 + + + + + 30 + 30 + + + + + + + icons/icons8-male-user-48.png + + + true + + + + + + + + 16777215 + 50 + + + + + 12 + true + + + + background-color: #F5F6F8; + + + + Trang cá nhân + + + + - - + + - 80 - 32 + 0 + 60 - 80 - 32 - - - - PointingHandCursor - - - Math - - - - icons/math.pngicons/math.png - - - - 24 - 24 + 16777215 + 60 - - false - + + + + + + 30 + 30 + + + + + 30 + 30 + + + + + + + icons/icons8-ranking-48.png + + + true + + + + + + + + 16777215 + 50 + + + + + 12 + true + + + + + + + Bảng xếp hạng + + + + - - + + - 80 - 32 + 0 + 60 - 80 - 32 - - - - PointingHandCursor - - - Code - - - - icons/code.pngicons/code.png - - - - 32 - 32 + 16777215 + 60 - - false - + + + + + + 30 + 30 + + + + + 30 + 30 + + + + + + + icons/icons8-note-48.png + + + true + + + + + + + + 16777215 + 50 + + + + + 12 + true + + + + + + + Ghi chú + + + + - - - - - 80 - 32 - - - - - 80 - 32 - - - - PointingHandCursor - - - Eng - - - - icons/english.pngicons/english.png - - - - 32 - 32 - - - - false - - + + @@ -274,6 +367,11 @@ + + background-color: white; +border-radius: 15px; + + @@ -306,11 +404,18 @@ + Arial 16 + false + true + + font: 700 16pt "Arial"; + + - Learn To Earn - L2E + Bảng xếp hạng tổng @@ -331,8 +436,11 @@ PointingHandCursor + + font: 700 11pt "Segoe UI"; + - Add New Student + Thêm @@ -378,10 +486,11 @@ 11 + true - Name + Họ Tên @@ -390,10 +499,11 @@ 11 + true - Password + Điểm @@ -402,10 +512,11 @@ 11 + true - Action + Sửa @@ -414,10 +525,11 @@ 11 + true - Action + Xóa @@ -435,7 +547,14 @@ 480 - + + font: 12pt "Segoe UI"; + + + + 0 + + diff --git a/show_new.py b/show_new.py index 3872c39..572d155 100644 --- a/show_new.py +++ b/show_new.py @@ -11,9 +11,9 @@ class ShowNew(QDialog): def __init__(self, dashboard, parent=None): super(ShowNew, self).__init__(parent) self.dashboard = dashboard - with open("data.json", "r", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "r", encoding="utf-8") as f: self.data = json.load(f) - uic.loadUi("show_new.ui", self) + uic.loadUi("../ClassRanking/show_new.ui", self) self.setupUi() def setupUi(self): @@ -39,9 +39,9 @@ def setupUi(self): self.valueEdit = QPushButton(self.editCol) self.valueEdit.setObjectName(id) # store the identifier in the objectName property iconEdit = QIcon() - iconEdit.addFile(u"icons/edit.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off) + iconEdit.addFile(u"../ClassRanking/icons/edit.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off) self.valueEdit.setIcon(iconEdit) - self.valueEdit.setIconSize(QSize(24, 24)) + self.valueEdit.setIconSize(QSize(30, 30)) self.verticalLayout_3.addWidget(self.valueEdit, 0, Qt.AlignmentFlag.AlignHCenter) self.horizontalLayout.addWidget(self.editCol) self.valueEdit.setText("") @@ -51,9 +51,9 @@ def setupUi(self): self.valueDelete = QPushButton(self.deleteCol) self.valueDelete.setObjectName(id) # store the identifier in the objectName property iconDelete = QIcon() - iconDelete.addFile(u"icons/remove.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off) + iconDelete.addFile(u"../ClassRanking/icons/remove.png", QSize(), QIcon.Mode.Normal, QIcon.State.Off) self.valueDelete.setIcon(iconDelete) - self.valueDelete.setIconSize(QSize(24, 24)) + self.valueDelete.setIconSize(QSize(30, 30)) self.verticalLayout_4.addWidget(self.valueDelete, 0, Qt.AlignmentFlag.AlignHCenter) self.horizontalLayout.addWidget(self.deleteCol) self.valueDelete.setText("") @@ -72,6 +72,6 @@ def deleteClicked(self): QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No) if reply == QMessageBox.StandardButton.Yes: self.data.pop(index) - with open("data.json", "w", encoding="utf-8") as f: + with open("../ClassRanking/data.json", "w", encoding="utf-8") as f: json.dump(self.data, f, indent=4, sort_keys=True, ensure_ascii=False) self.dashboard.loadCurrentRank() \ No newline at end of file diff --git a/tempCodeRunnerFile.py b/tempCodeRunnerFile.py new file mode 100644 index 0000000..abbcaff --- /dev/null +++ b/tempCodeRunnerFile.py @@ -0,0 +1 @@ +AlignHCenter \ No newline at end of file diff --git a/users.json b/users.json new file mode 100644 index 0000000..f7f07cf --- /dev/null +++ b/users.json @@ -0,0 +1,22 @@ +[ + { + "name": "Di", + "age": "12" + }, + { + "name": "Duy", + "age": "12" + }, + { + "name": "duy", + "age": "12" + }, + { + "name": "Duy", + "age": "20" + }, + { + "name": "Duy", + "age": "20" + } +] \ No newline at end of file