def addDisc(self): if (self.nomeTextCtrl.GetValue() == '') or (self.profChoice.GetSelection() == -1): self.erroTextCtrl.SetValue('Insira o nome e o professor para adicionar uma nova disciplina!') else: self.erroTextCtrl.SetValue('') disc = Disciplina() if disc.carregar(self.nomeTextCtrl.GetValue()): self.erroTextCtrl.SetValue('disciplina ja existe!') else: disc.setDisciplina(self.nomeTextCtrl.GetValue()) select = self.profChoice.GetSelection() disc.setProfessor(self.listProfId[select][0]) disc.add(disc.getDisciplina(), disc.getProfessor()) self.nomeTextCtrl.SetValue('')
def OnAplicarButtonButton(self, event): if self.verificador == 1: discEdit = Disciplina() discEdit.carregar(self.nomeDisc) select = self.profChoice.GetSelection() if (select == -1):None else: discEdit.setProfessor(self.listProfId[select][0]) discEdit.salvarEdit(discEdit.getDisciplina(), discEdit.getProfessor()) self.verificador = 0 self.nomeDisc = '' self.nomeTextCtrl.SetValue('') self.carregarDisc() else: self.addDisc() self.carregarDisc() event.Skip()