Skip to content

Commit

Permalink
Fix saving function
Browse files Browse the repository at this point in the history
deepcopy
  • Loading branch information
malloc3141 committed Jul 20, 2023
1 parent 6e5d45b commit d7058cc
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 252 deletions.
25 changes: 11 additions & 14 deletions uitest.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def roomPlan2(self, ifsave):
QMessageBox.about(self, 'Warning', 'No File Selected')
return
if ifsave:
self.plan[0] = self.tmpPlan[0]
self.plan[0] = copy.deepcopy(self.tmpPlan[0])
self.tmpPlan[0].clear()
getRoom()
rd.shuffle(freshman_list)
Expand Down Expand Up @@ -278,7 +278,7 @@ def roomPlan3(self, ifsave):
QMessageBox.about(self, 'Warning', 'No File Selected')
return
if ifsave:
self.plan[1] = self.tmpPlan[1]
self.plan[1] = copy.deepcopy(self.tmpPlan[1])
self.tmpPlan[1].clear()
getRoom()
rd.shuffle(junior_list)
Expand Down Expand Up @@ -310,7 +310,7 @@ def roomPlan4(self, ifsave):
QMessageBox.about(self, 'Warning', 'No File Selected')
return
if ifsave:
self.plan[2] = self.tmpPlan[2]
self.plan[2] = copy.deepcopy(self.tmpPlan[2])
self.tmpPlan[2].clear()
getRoom()
rd.shuffle(senior_list)
Expand Down Expand Up @@ -342,7 +342,7 @@ def studyPlanM(self, ifsave):
QMessageBox.about(self, 'Warning', 'No File Selected')
return
if ifsave:
self.plan[3] = self.tmpPlan[3]
self.plan[3] = copy.deepcopy(self.tmpPlan[3])
self.tmpPlan[3].clear()
count=[0,0,0]
rd.shuffle(freshman_m_list)
Expand Down Expand Up @@ -391,7 +391,7 @@ def studyPlanF(self, ifsave):
QMessageBox.about(self, 'Warning', 'No File Selected')
return
if ifsave:
self.plan[4] = self.tmpPlan[4]
self.plan[4] = copy.deepcopy(self.tmpPlan[4])
self.tmpPlan[4].clear()
count = [0, 0, 0]
seat_list=[]
Expand Down Expand Up @@ -441,16 +441,13 @@ def exportTXT(self):
f=open('배치.txt', 'w')
for i in range(5):
if not self.plan[i]:
if not self.tmpPlan[i]:
f.write('<배치 정보 없음>\n')
continue
else:
for tmp in self.tmpPlan[i]:
if i==0 or i==1 or i==2:
f.write(tmp.name+' '+str(tmp.room)+'\n')
else:
f.write(tmp.name + ' ' + str(tmp.seat) + '\n')
for tmp in self.tmpPlan[i]:
if i == 0 or i == 1 or i == 2:
f.write(tmp.name + ' ' + str(tmp.room) + '\n')
else:
f.write(tmp.name + ' ' + str(tmp.seat) + '\n')
else:
print(1)
for tmp in self.plan[i]:
if i == 0 or i == 1 or i == 2:
f.write(tmp.name + ' ' + str(tmp.room) + '\n')
Expand Down
Loading

0 comments on commit d7058cc

Please sign in to comment.