Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions add_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
26 changes: 16 additions & 10 deletions add_form.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ color: #fff;
padding: 5%;</string>
</property>
<property name="text">
<string>Submit</string>
<string>Thêm</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>130</x>
<y>140</y>
<width>221</width>
<width>241</width>
<height>31</height>
</rect>
</property>
Expand All @@ -55,7 +55,7 @@ padding: 5%;</string>
</font>
</property>
<property name="text">
<string>Sign in to yout existing account</string>
<string>Thêm thông tin học sinh vào BXH</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
Expand All @@ -73,7 +73,7 @@ padding: 5%;</string>
</font>
</property>
<property name="text">
<string>Username</string>
<string>Họ và tên</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
Expand All @@ -91,7 +91,7 @@ padding: 5%;</string>
</font>
</property>
<property name="text">
<string>Password</string>
<string>Điểm</string>
</property>
</widget>
<widget class="QLineEdit" name="name">
Expand All @@ -107,7 +107,7 @@ padding: 5%;</string>
<string notr="true">border-radius: 5%;</string>
</property>
<property name="placeholderText">
<string>Nhập tên tài khoản</string>
<string>Nhập họ và tên</string>
</property>
</widget>
<widget class="QLineEdit" name="pwd">
Expand All @@ -127,25 +127,31 @@ padding: 5%;</string>
<enum>QLineEdit::Normal</enum>
</property>
<property name="placeholderText">
<string>Nhập mật khẩu</string>
<string>Nhập điểm</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>210</x>
<x>150</x>
<y>90</y>
<width>71</width>
<width>191</width>
<height>41</height>
</rect>
</property>
<property name="font">
<font>
<family>Segoe UI</family>
<pointsize>20</pointsize>
<italic>false</italic>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font: 700 20pt &quot;Segoe UI&quot;;</string>
</property>
<property name="text">
<string>Login</string>
<string>Thêm học sinh</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
Expand Down
Loading