コード例 #1
0
 def export_roster_file_target_path_with_name(self):
     if (self.mainView.nb.index("current") == 0 and self.num_popup == 0):
         target = filedialog.asksaveasfilename(initialdir="/",
                                               title="Select file",
                                               filetypes=(('CSV', '*.csv'),
                                                          ('TSV', '*.tsv')))
         IO.instance().exportRoster(target)
コード例 #2
0
 def remove_stuent_at(self, position: int) -> bool:
     curr_queue = IO.instance().get_curr_queue()
     if (curr_queue.isEmpty() or position >= curr_queue.length()):
         return False
     the_student = curr_queue.popfrom(position)
     the_student.calledOnCount += 1
     curr_queue.pushRandom(the_student)
     dailyRemove(the_student)
     IO.instance().set_curr_queue(curr_queue)
     self.last_remove_time = time()
     return True
コード例 #3
0
 def import_roster_file_path_with_name(self):
     if (self.mainView.nb.index("current") == 0 and self.num_popup == 0):
         path_with_file_name = filedialog.askopenfilename(
             title='Choose your csv/tsv file',
             filetypes=(('CSV', '*.csv'), ('TSV', '*.tsv')))
         rslt = IO.instance().importRoster(path_with_file_name)
         if (rslt[0] == 1):
             self.not_found_window()
         elif (rslt[0] == 2):
             self.overwrite_window(rslt[1], path_with_file_name)
         else:
             self.update_students_info()
コード例 #4
0
 def concern_recent_student(self) -> bool:
     now = time()
     if now - self.last_remove_time <= 2:
         curr_queue = IO.instance().get_curr_queue()
         if (not curr_queue.has_recent_student_on_deck()
                 or curr_queue.isEmpty()):
             return False
         the_student = curr_queue.lastRemove()
         the_student.concernCount += 1
         dailyConcern(the_student)
         return True
     return False
コード例 #5
0
 def _import_roster(self, path_with_name):
     IO.instance().importRoster(path_with_name, True)
     self.update_students_info()
コード例 #6
0
 def onclosing():
     IO.instance().set_curr_queue()
     self.root.destroy()
コード例 #7
0
 def get_studnt_at(self, position: int) -> Student:
     curr_queue = IO.instance().get_curr_queue()
     if (curr_queue.isEmpty() or position >= curr_queue.length()):
         return None
     return curr_queue.get_student_at(position)
コード例 #8
0
 def get_queue_length(self):
     return IO.instance().get_curr_queue().length()