コード例 #1
0
ファイル: GUI.py プロジェクト: bradtaniguchi/IMSRoomRenter
 def clockin(self, name, studentid, room):
     """
     Clocks a student into a room, calls checkroom, to check the room, and checks inputs
     for student id and name. All inputs must come back valid to proceed.
     Gathers time and date
     :param name: Name of Student to Clock in
     :param studentid: Id of student that needs to clock in
     :param room: Room of Student to clockin
     :return:
     """
     booleanreturn, stringreturn = self.validinput(name, studentid)
     if booleanreturn is True:  # Room and inputs OK
         if room == 0:
             self.controller.sysprint("ERROR! Room 0!")
             mypopup = Popups("ERROR!", "Bad Input Choose  room!")
             mypopup.mainloop()
         else:
             clockindate = str(datetime.now().date())  # format: 2015-12-31
             clockintime = str(datetime.now().time().hour) + ":" + str(datetime.now().time().minute)
             mystudentlogin = Student(studentid, name, clockindate, room, clockintime)  # no clockin as None
             mydatabaseinterface = DataBaseInterface()  # default file location
             mydatabaseinterface.clockin(mystudentlogin)
             self.clearinputs()
             self.controller.sysprint(">DEBUG: Clockedin Student")
             mypopup = Popups("Clock In", "Clocked in " + str(name) + " at " + str(clockintime))
             mypopup.mainloop()
             self.controller.updateflag = True  # dangerous is it not?
             self.changeframe("PrimaryPage")
     else:
         self.controller.sysprint(">ERROR! Bad Input: " + stringreturn)
         mypopup = Popups("Error!", "Bad Input " + stringreturn)
         mypopup.mainloop()