def ChooseTeam(self): try: if(int(GroupNames.curselection()[0]) == 0): self.CreateNewFolder() else: self.TeamIds = gdrive.GetFolders(drive,self.TeacherIds[self.teacher]) Teams = GetList(self.TeamIds) currentselection = Teams[int(GroupNames.curselection()[0])-1] DisplayText.set("Current Selected Team: "+ currentselection) GroupNames.pack_forget () gns.pack_forget() chooseGroupButton.pack_forget() m.buttons.pack_forget() #m.packMenu(GroupFolders,gfs) #GroupFolders.pack() #m.menu.pack_forget () os = platform.platform().split('-')[0] if(os == "Windows"): TechnicalReport.pack() ChooseUploadFolder.pack() ChooseDownloadCode.pack() self.Unit, self.UnitChoices = m.drawRadioButtons(m.menu); m.buttons.pack(pady = 10) currentTeamID = self.TeamIds[currentselection] self.TeamFolder = gdrive.GetFolders (drive,currentTeamID) InnerFolders = GetList(self.TeamFolder) except: self.CreateAlert("Please Choose a Team")
def FolderCreation(self): newid = gdrive.CreateFolder(drive,self.NewNameObject.get(),self.TeacherIds[self.teacher]) self.slave.destroy() DocId = gdrive.CreateFolder(drive,"Documents",newid) CodeId = gdrive.CreateFolder(drive,"Code",newid) #gdrive.CopyTechnicalReport(drive,DocId) self.TeamFolder = gdrive.GetFolders (drive,self.TeacherIds[self.teacher]) Teams = GetList(self.TeamFolder) m.UpdateMenu(GroupNames,Teams,True)
def SchoolHandler(self,p,a,c): try: self.school = LocationVar.get() self.TeacherIds = gdrive.GetFolders(drive,folders[LocationVar.get()]) Teachers = GetList(self.TeacherIds) m.UpdateList(TeachersObj,TeachersVar,Teachers) except: print("Starting") pass
def TeacherHandler(self,p,a,c): self.teacher = TeachersVar.get() self.TeamIds = gdrive.GetFolders(drive,self.TeacherIds[self.teacher]) Teams = GetList(self.TeamIds) try: for radio in self.UnitChoices: radio.pack_forget() except: # print("Radio Buttons don't Exist") pass ChooseDownloadCode.pack_forget() ChooseUploadFolder.pack_forget() TechnicalReport.pack_forget() m.buttons.pack_forget() m.menu.pack() #m.packMenu(GroupNames,gns) GroupNames.pack() DisplayText.set("Please Choose Your Teacher\n"+"_"*30+"\n\nChoose Your Team \nor Create a New One") m.UpdateMenu(GroupNames,Teams,True) chooseGroupButton.pack(pady = 10) m.buttons.pack()
def GetList(tup,ex = []): newlist = tup.keys() toreturn = [] for thing in newlist: if(not thing in ex): toreturn.append(thing) return toreturn m = Menu() h = Handlers() drive = gdrive.Connect() folders = gdrive.GetFolders(drive) LocationObj,LocationVar = m.drawDropDown(m.master,"h.SchoolHandler",GetList(folders,["Technical Report Template"]),True) TeachersObj,TeachersVar = m.drawDropDown(m.master,"h.TeacherHandler",[""]) DisplayText = m.drawMessage(m.master,"Please Choose a School") GroupNames,gns = m.drawMenu(m.menu,[],True) chooseGroupButton = m.drawButton(m.buttons,"Choose","h.ChooseTeam") TechnicalReport = m.drawButton(m.buttons,"Technical Report", "h.TechnicalReport") ChooseUploadFolder = m.drawButton(m.buttons,"Upload Code","h.UploadButton") ChooseDownloadCode = m.drawButton(m.buttons,"Download Code", "h.DownloadButton") m.menu.pack() m.buttons.pack ()