# -*- coding: iso-8859-1 -*- # Copyright 20003 - 2008: Julien Bourdaillet (julien.bourdaillet@lip6.fr), Jean-Gabriel Ganascia (jean-gabriel.ganascia@lip6.fr) # This file is part of MEDITE. # # MEDITE is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # MEDITE is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Foobar; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #---------------------------------------------------------------------------- # Nom: Formulaires.py # Objet: Ce fichier regroupe les differentes classes de formulaire # concernant le menu Dossiers #---------------------------------------------------------------------------- #from wx.Python.wx. import * import wx from Utile.constantesGUI import * from Utile.exceptionsDonnees import * import Donnees.planTravail import Controleurs.DGManager #--------------------------------------------------------------------------------------------------# #Classe qui cree un formulaire affichant le commentaire existant #Si le bouton remplacer est enclenche, le nouveau commentaire remplacera l'ancien #Si le bouton ajouter est enclenche, le nouveau commentaire s'ajoutera ŕ l'ancien class FormEnregistrerCommentaire(wx.Frame): def __init__(self,parent, oldComment, pParametres): wx.Frame.__init__(self, parent, -1, "Commentaire existant", pos = wx.Point(100,50) ,size = (380,430), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE|wx.FRAME_FLOAT_ON_PARENT) self.fenetreMedite=parent self.param = pParametres panel=wx.Panel(self,-1) textCom=wx.StaticText(panel,-1,u"Un commentaire exite d\xe9ja !\n ",wx.Point(15,10)) textComA=wx.StaticText(panel,-1,"L'ancien commentaire",wx.Point(15,40)) textComOld=wx.TextCtrl(panel,-1,oldComment,wx.Point(40,60),size=(300,80), style=wx.TE_READONLY|wx.TE_MULTILINE) textComN=wx.StaticText(panel,-1,"Le nouveau commentaire",wx.Point(15,150)) textComNew=wx.TextCtrl(panel,-1,self.fenetreMedite.getCompPanel().commentaire.GetValue(), wx.Point(40,170),size=(300,80), style=wx.TE_READONLY|wx.TE_MULTILINE) msg = u"Vous avez 3 possibilit\xe9s :\n- remplacer l\'ancien commentaire par votre nouveau\n- ajouter le nouveau \xe0 l\'ancien\n- annuler la commande" textMsg=wx.StaticText(panel,-1,msg,wx.Point(50,280)) bValider = wx.Button(panel, ID_REMPLACER, "REMPLACER", wx.Point(50, 360)) wx.EVT_BUTTON(self, ID_REMPLACER, self.onRemplacer) bValider = wx.Button(panel, ID_AJOUTER, "AJOUTER", wx.Point(150, 360)) wx.EVT_BUTTON(self, ID_AJOUTER, self.onAjouter) bAnnuler = wx.Button(panel, ID_ANNULER, "ANNULER", wx.Point(250,360)) wx.EVT_BUTTON(self, ID_ANNULER, self.onAnnuler) def onRemplacer(self,event): try: self.fenetreMedite.cinfos.remplacerCommentaire(self.fenetreMedite.getPlanTravail(), self.fenetreMedite.getCompPanel().commentaire.GetValue()) except AuteurNonTrouve, eANT: dlg = wx.MessageDialog(self, u"L'auteur n'a pas \xe9t\xe9 trouv\xe9 !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except OeuvreNonTrouvee, eONT: dlg = wx.MessageDialog(self, u"L'oeuvre n'a pas \xe9t\xe9 trouv\xe9e !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except InformationsNonTrouvees, eINT: dlg = wx.MessageDialog(self, u"L'application Medite n'a pas \xe9t\xe9 appliqu\xe9 sur ce couple d'états !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() def onAjouter(self,event): try: self.fenetreMedite.cinfos.ajouterCommentaire(self.fenetreMedite.getPlanTravail(), self.fenetreMedite.getCompPanel().commentaire.GetValue()) except AuteurNonTrouve, eANT: dlg = wx.MessageDialog(self, u"L'auteur n'a pas \xe9t\xe9 trouv\xe9 !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except OeuvreNonTrouvee, eONT: dlg = wx.MessageDialog(self, u"L'oeuvre n'a pas \xe9t\xe9 trouv\xe9e !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except InformationsNonTrouvees, eINT: dlg = wx.MessageDialog(self, u"L'application Medite n'a pas \xe9t\xe9 appliqu\xe9 sur ce couple d'états !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() def onAnnuler(self,event): self.Close() # Fenetre de dialogue de selection d'un element dans une liste class SelectionListe(wx.SingleChoiceDialog): def __init__(self, parent,pPhrase, pTitre, pListe): wx.SingleChoiceDialog.__init__(self, parent,pPhrase,pTitre,pListe, wx.OK|wx.CANCEL) # Classe qui cree un formulaire de selection a partir de la selection de l'auteur, # de l'oeuvre, de la version source, de l'état source, de la version cible, # de l'état cible # la classe appelle la methode supprimerInformations de cInformations class FormSupprimerInformations(wx.Frame): def __init__(self,parent, title): wx.Frame.__init__(self, parent, -1,title, pos = wx.Point(200,200) ,size = ( 330,380), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE|wx.FRAME_FLOAT_ON_PARENT) self.fenetreMedite=parent self.dgm = Controleurs.DGManager.DGManager() panel=wx.Panel(self,-1) textAuteur=wx.StaticText(panel,-1,"Auteur : ",wx.Point(15,12)) self.ctrlAuteur=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getAuteur(), wx.Point(100,10),size=(125,-1),style=wx.TE_READONLY) self.ctrlAuteur.SetInsertionPoint(0) bAuteur = wx.Button(panel, ID_SELECT_AUTEUR, u"S\xe9lection",wx.Point(230,10)) wx.EVT_BUTTON(self, ID_SELECT_AUTEUR, self.onSelectAuteur) textOeuvre=wx.StaticText(panel,-1,"Oeuvre : ",wx.Point(15,52)) self.ctrlOeuvre=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getOeuvre(), wx.Point(100,50),size=(125,-1),style=wx.TE_READONLY) self.ctrlOeuvre.SetInsertionPoint(0) bOeuvre = wx.Button(panel, ID_SELECT_OEUVRE, u"S\xe9lection",wx.Point(230,50)) wx.EVT_BUTTON(self, ID_SELECT_OEUVRE, self.onSelectOeuvre) textVersionS=wx.StaticText(panel,-1,"Version Source: ",wx.Point(15,92)) self.ctrlVersionS=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getVersionSource(), wx.Point(100,90),size=(125,-1),style=wx.TE_READONLY) self.ctrlVersionS.SetInsertionPoint(0) bVersionS = wx.Button(panel, ID_SELECT_VERSION_S, u"S\xe9lection",wx.Point(230,90)) wx.EVT_BUTTON(self, ID_SELECT_VERSION_S, self.onSelectVersionS) textEtatS=wx.StaticText(panel,-1,"Etat Source: ",wx.Point(15,132)) self.ctrlEtatS=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getEtatSource(), wx.Point(100,130),size=(125,-1),style=wx.TE_READONLY) self.ctrlEtatS.SetInsertionPoint(0) bEtatS = wx.Button(panel, ID_SELECT_ETAT_S, u"S\xe9lection",wx.Point(230,130)) wx.EVT_BUTTON(self, ID_SELECT_ETAT_S, self.onSelectEtatS) textVersionC=wx.StaticText(panel,-1,"Version Cible: ",wx.Point(15,172)) self.ctrlVersionC=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getVersionCible(), wx.Point(100,170),size=(125,-1),style=wx.TE_READONLY) self.ctrlVersionC.SetInsertionPoint(0) bVersionC = wx.Button(panel, ID_SELECT_VERSION_C, u"S\xe9lection",wx.Point(230,170)) wx.EVT_BUTTON(self, ID_SELECT_VERSION_C, self.onSelectVersionC) textEtatC=wx.StaticText(panel,-1,"Etat Cible: ",wx.Point(15,212)) self.ctrlEtatC=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getEtatCible(), wx.Point(100,210),size=(125,-1),style=wx.TE_READONLY) self.ctrlEtatC.SetInsertionPoint(0) bEtatC = wx.Button(panel, ID_SELECT_ETAT_C, u"S\xe9lection",wx.Point(230,210)) wx.EVT_BUTTON(self, ID_SELECT_ETAT_C, self.onSelectEtatC) textParam=wx.StaticText(panel,-1,u"Param\xe8tres: ", wx.Point(15,252)) self.parametresChoix = self.fenetreMedite.getCompPanel().param.donnerParametres() texte = '(%s,%s,%s)'%(self.parametresChoix.getp1(), self.parametresChoix.getp2(), self.parametresChoix.getp3()) self.ctrlParam=wx.TextCtrl(panel,-1,texte,wx.Point(100,250), size=(125,-1),style=wx.TE_READONLY) self.ctrlParam.SetInsertionPoint(0) bParam = wx.Button(panel, ID_SELECT_PARAM, u"S\xe9lection",wx.Point(230,250)) wx.EVT_BUTTON(self, ID_SELECT_PARAM, self.onSelectParam) bValider = wx.Button(panel, ID_OK, "VALIDER", wx.Point(70, 290)) wx.EVT_BUTTON(self, ID_OK, self.onValider) bAnnuler = wx.Button(panel, ID_ANNULER, "ANNULER", wx.Point(170, 290)) wx.EVT_BUTTON(self, ID_ANNULER, self.onAnnuler) def onSelectAuteur(self,event): #On recupere la liste des auteurs de la base #listeAuteurs=self.fenetreMedite.cdon.getListeNomsAuteurs() listeAuteurs = self.dgm.getListeAuteurs() msg = "Choisissez l\'auteur" titre = "Choix de l\'auteur" self.auteurFormSelect = SelectionListe(self.fenetreMedite,msg,titre, listeAuteurs) if self.auteurFormSelect.ShowModal() == wx.ID_OK: self.ctrlAuteur.SetValue(self.auteurFormSelect.GetStringSelection()) def onSelectOeuvre(self,event): if (self.ctrlAuteur.GetValue()!=""): #on recupere la liste des oeuvres de l'auteur selectionne #listeOeuvres=self.fenetreMedite.cdon.getListeTitresByAuteur(self.ctrlAuteur.GetValue()) listeOeuvres=self.dgm.getListeOeuvresAuteur(self.ctrlAuteur.GetValue()) msg = "Choisissez l\'oeuvre" titre = "Choix de l\'oeuvre" self.oeuvreFormSelect=SelectionListe(self.fenetreMedite, msg, titre, listeOeuvres) if self.oeuvreFormSelect.ShowModal() == wx.ID_OK: self.ctrlOeuvre.SetValue(self.oeuvreFormSelect.GetStringSelection()) else: text=u"Vous devez s\xe9lectionner un auteur" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectVersionS(self,event): if (self.ctrlOeuvre.GetValue()!=""): listeVersions=self.fenetreMedite.cdos.getListeDossiersVersions(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) msg = 'Choisissez la version source' titre = u"S\xe9lectionner une version" self.versionFormSelectS=SelectionListe(self.fenetreMedite,msg,titre,listeVersions) if self.versionFormSelectS.ShowModal() == wx.ID_OK: self.ctrlVersionS.SetValue(self.versionFormSelectS.GetStringSelection()) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectEtatS(self,event): if (self.ctrlVersionS.GetValue()!=""): #listeEtats=self.fenetreMedite.cdos.getListeEtats(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue()) listeEtats=self.dgm.getListeEtatsVersion(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue()) msg = u"Choisissez l\'état source \xe0" titre = u"S\xe9lectionner un état" self.etatFormSelectS=SelectionListe(self.fenetreMedite,msg,titre,listeEtats) if self.etatFormSelectS.ShowModal() == wx.ID_OK: self.ctrlEtatS.SetValue(self.etatFormSelectS.GetStringSelection()) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectVersionC(self,event): if (self.ctrlOeuvre.GetValue()!=""): listeVersions=self.fenetreMedite.cdos.getListeDossiersVersions(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) msg = 'Choisissez la version source' titre = u"S\xe9lectionner une version" self.versionFormSelectC=SelectionListe(self.fenetreMedite,msg,titre,listeVersions) if self.versionFormSelectC.ShowModal() == wx.ID_OK: self.ctrlVersionC.SetValue(self.versionFormSelectC.GetStringSelection()) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectEtatC(self,event): if (self.ctrlVersionC.GetValue()!=""): #listeEtats=self.fenetreMedite.cdos.getListeEtats(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionC.GetValue()) listeEtats=self.dgm.getListeEtatsVersion(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionC.GetValue()) msg = u"Choisissez l\'état source \xe0" titre = u"S\xe9lectionner un état" self.etatFormSelectC=SelectionListe(self.fenetreMedite,msg,titre,listeEtats) if self.etatFormSelectC.ShowModal() == wx.ID_OK: self.ctrlEtatC.SetValue(self.etatFormSelectC.GetStringSelection()) else: text="Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectParam(self,event): if (self.ctrlEtatS.GetValue()!="") & (self.ctrlEtatC.GetValue()!=""): # 1ere etape : rechercher toutes les infos existantes pour le couple de etats # charge liste=self.fenetreMedite.cinfos.rechercherToutesInformations(self.fenetreMedite.getPlanTravail()) if len(liste) == 0: dlg=wx.MessageDialog(self, u"Les informations n'ont pas \xe9t\xe9 trouv\xe9es !!","Attention",wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() # 2eme etape : choix des parametres else: listeParam = [] for i in liste : param = i.getParametres() lpara = '(%s,%s,%s)'%(param.getp1(),param.getp2(),param.getp3()) listeParam.append(lpara) msg = u"Il existe plusieurs informations concernant ces états.\n Choisissez les param\xe8tres\n (lg pivot, ratio, seuil)" titre = u"S\xe9lectionner les param\xe8tres" self.paramFormSelect=SelectionListe(self.fenetreMedite,msg,titre,listeParam) if self.paramFormSelect.ShowModal() == wx.ID_OK: choix = self.paramFormSelect.GetStringSelection() self.ctrlParam.SetValue(choix) n = 0 for p in listeParam : if choix == p : self.parametresChoix=liste[n].getParametres() else : n+=1 else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onValider(self,event): if (self.ctrlEtatS.GetValue()!="") & (self.ctrlEtatC.GetValue()!="") & (self.ctrlParam.GetValue()!=""): try: msg = 'Voulez-vous vraiment supprimer les informations' dlg=wx.MessageDialog(self.fenetreMedite, msg,"Attention!",wx.YES_NO | wx.ICON_EXCLAMATION ) if dlg.ShowModal() ==wx.ID_YES: planTravail = Donnees.planTravail.PlanTravail(self.ctrlAuteur.GetValue(), self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue(), self.ctrlEtatS.GetValue(),self.ctrlVersionC.GetValue(), self.ctrlEtatC.GetValue(),self.parametresChoix) self.fenetreMedite.cinfos.supprimerInformations(planTravail) except AuteurNonTrouve, eANT: dlg = wx.MessageDialog(self, u"L'auteur n'a pas \xe9t\xe9 trouv\xe9 !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except OeuvreNonTrouvee, eONT: dlg = wx.MessageDialog(self, u"L'oeuvre n'a pas \xe9t\xe9 trouv\xe9e !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except InformationsNonTrouvees, eINT: dlg = wx.MessageDialog(self, u"L'application Medite n'a pas \xe9t\xe9 appliqu\xe9 sur ce couple d'états !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() else: dlg = wx.MessageDialog(self, "Vous devez remplir tous les champs !", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onAnnuler(self,event): self.Close() # Classe qui cree un formulaire de selection # A partir de la selection de l'auteur, de l'oeuvre, de la version source, de l'état source, # de la version cible, de l'état cible la classe appelle la methode supprimerCommentaire # de cInformations class FormSupprimerCommentaire(wx.Frame): def __init__(self,parent, title): wx.Frame.__init__(self, parent, -1,title,pos = wx.Point(200,200), size = (330,380), style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE|wx.FRAME_FLOAT_ON_PARENT) self.fenetreMedite=parent self.dgm = Controleurs.DGManager.DGManager() panel=wx.Panel(self,-1) textAuteur=wx.StaticText(panel,-1,"Auteur : ",wx.Point(15,12)) self.ctrlAuteur=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getAuteur(), wx.Point(100,10),size=(125,-1),style=wx.TE_READONLY) self.ctrlAuteur.SetInsertionPoint(0) bAuteur = wx.Button(panel, ID_SELECT_AUTEUR, u"S\xe9lection",wx.Point(230,10)) wx.EVT_BUTTON(self, ID_SELECT_AUTEUR, self.onSelectAuteur) textOeuvre=wx.StaticText(panel,-1,"Oeuvre : ",wx.Point(15,52)) self.ctrlOeuvre=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getOeuvre(), wx.Point(100,50),size=(125,-1),style=wx.TE_READONLY) self.ctrlOeuvre.SetInsertionPoint(0) bOeuvre = wx.Button(panel, ID_SELECT_OEUVRE, u"S\xe9lection",wx.Point(230,50)) wx.EVT_BUTTON(self, ID_SELECT_OEUVRE, self.onSelectOeuvre) textVersionS=wx.StaticText(panel,-1,"Version Source: ",wx.Point(15,92)) self.ctrlVersionS=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getVersionSource() ,wx.Point(100,90),size=(125,-1),style=wx.TE_READONLY) self.ctrlVersionS.SetInsertionPoint(0) bVersionS = wx.Button(panel, ID_SELECT_VERSION_S, u"S\xe9lection",wx.Point(230,90)) wx.EVT_BUTTON(self, ID_SELECT_VERSION_S, self.onSelectVersionS) textEtatS=wx.StaticText(panel,-1,"Etat Source: ",wx.Point(15,132)) self.ctrlEtatS=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getEtatSource(), wx.Point(100,130),size=(125,-1),style=wx.TE_READONLY) self.ctrlEtatS.SetInsertionPoint(0) bEtatS = wx.Button(panel, ID_SELECT_ETAT_S, u"S\xe9lection",wx.Point(230,130)) wx.EVT_BUTTON(self, ID_SELECT_ETAT_S, self.onSelectEtatS) textVersionC=wx.StaticText(panel,-1,"Version Cible: ",wx.Point(15,172)) self.ctrlVersionC=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getVersionCible(), wx.Point(100,170),size=(125,-1),style=wx.TE_READONLY) self.ctrlVersionC.SetInsertionPoint(0) bVersionC = wx.Button(panel, ID_SELECT_VERSION_C, u"S\xe9lection",wx.Point(230,170)) wx.EVT_BUTTON(self, ID_SELECT_VERSION_C, self.onSelectVersionC) textEtatC=wx.StaticText(panel,-1,"Etat Cible: ",wx.Point(15,212)) self.ctrlEtatC=wx.TextCtrl(panel,-1,self.fenetreMedite.getPlanTravail().getEtatCible(), wx.Point(100,210),size=(125,-1),style=wx.TE_READONLY) self.ctrlEtatC.SetInsertionPoint(0) bEtatC = wx.Button(panel, ID_SELECT_ETAT_C, u"S\xe9lection",wx.Point(230,210)) wx.EVT_BUTTON(self, ID_SELECT_ETAT_C, self.onSelectEtatC) textParam=wx.StaticText(panel,-1,u"Param\xe8tres: ", wx.Point(15,252)) self.parametresChoix = self.fenetreMedite.getCompPanel().param.donnerParametres() texte = '(%s,%s,%s)'%(self.parametresChoix.getp1(), self.parametresChoix.getp2(), self.parametresChoix.getp3()) self.ctrlParam=wx.TextCtrl(panel,-1,texte,wx.Point(100,250), size=(125,-1),style=wx.TE_READONLY) self.ctrlParam.SetInsertionPoint(0) bParam = wx.Button(panel, ID_SELECT_PARAM, u"S\xe9lection",wx.Point(230,250)) wx.EVT_BUTTON(self, ID_SELECT_PARAM, self.onSelectParam) bValider = wx.Button(panel, ID_OK, "VALIDER", wx.Point(70, 290)) wx.EVT_BUTTON(self, ID_OK, self.onValider) bAnnuler = wx.Button(panel, ID_ANNULER, "ANNULER", wx.Point(160, 290)) wx.EVT_BUTTON(self, ID_ANNULER, self.onAnnuler) def onSelectAuteur(self,event): #On recupere la liste des auteurs de la base #listeAuteurs=self.fenetreMedite.cdon.getListeNomsAuteurs() listeAuteurs = self.dgm.getListeAuteurs() self.auteurFormSelect=SelectionListe(-1,u"S\xe9lectionner un auteur",listeAuteurs,self.ctrlAuteur) self.auteurFormSelect.Show(1) def onSelectOeuvre(self,event): if (self.ctrlAuteur.GetValue()!=""): #on recupere la liste des oeuvres de l'auteur selectionne #listeOeuvres=self.fenetreMedite.cdon.getListeTitresByAuteur(self.ctrlAuteur.GetValue()) listeOeuvres=self.dgm.getListeOeuvresAuteur(self.ctrlAuteur.GetValue()) self.oeuvreFormSelect=SelectionListe(-1,u"S\xe9lectionner une oeuvre",listeOeuvres,self.ctrlOeuvre) self.oeuvreFormSelect.Show(1) else: text="Vous devez s\xe9lectionner un auteur" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectVersionS(self,event): if (self.ctrlOeuvre.GetValue()!=""): #listeVersions=self.fenetreMedite.cdos.getListeDossiersVersions(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) listeVersions=self.dgm.getListeVersionsDG(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) self.versionFormSelect=SelectionListe(-1,u"S\xe9lectionner une version",listeVersions,self.ctrlVersionS) self.versionFormSelect.Show(1) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectEtatS(self,event): if (self.ctrlVersionS.GetValue()!=""): #listeEtats=self.fenetreMedite.cdos.getListeEtats(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue()) listeEtats=self.dgm.getListeEtatsVersion(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue()) self.versionFormSelect=SelectionListe(-1,u"S\xe9lectionner un etat",listeEtats,self.ctrlEtatS) self.versionFormSelect.Show(1) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectVersionC(self,event): if (self.ctrlOeuvre.GetValue()!=""): #listeVersions=self.fenetreMedite.cdos.getListeDossiersVersions(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) listeVersions=self.dgm.getListeVersionsDG(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue()) self.versionFormSelect=SelectionListe(-1,u"S\xe9lectionner une version" ,listeVersions,self.ctrlVersionC) self.versionFormSelect.Show(1) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectEtatC(self,event): if (self.ctrlVersionC.GetValue()!=""): #listeEtats=self.fenetreMedite.cdos.getListeEtats(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionC.GetValue()) listeEtats=self.dgm.getListeEtatsVersion(self.ctrlAuteur.GetValue(),self.ctrlOeuvre.GetValue(),self.ctrlVersionC.GetValue()) self.versionFormSelect=SelectionListe(-1,u"S\xe9lectionner un etat", listeEtats,self.ctrlEtatC) self.versionFormSelect.Show(1) else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onSelectParam(self,event): if (self.ctrlEtatS.GetValue()!="") & (self.ctrlEtatC.GetValue()!=""): # 1ere etape : rechercher toutes les infos existantes pour le couple de # etats charge liste=self.fenetreMedite.cinfos.rechercherToutesInformations(self.fenetreMedite.getPlanTravail()) if len(liste) == 0: dlg=wx.MessageDialog(self, u"Les informations n'ont pas \xe9t\xe9 trouv\xe9es !!","Attention",wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() # 2eme etape : choix des parametres else: listeParam = [] for i in liste : param = i.getParametres() lpara = '(%s,%s,%s)'%(param.getp1(),param.getp2(),param.getp3()) listeParam.append(lpara) msg = u"Il existe plusieurs informations concernant ces etats.\n Choisissez les param\xe8tres\n (lg pivot, ratio, seuil)" titre = u"S\xe9lectionner les param\xe8tres" self.paramFormSelect=SelectionListe(self.fenetreMedite,msg,titre,listeParam) if self.paramFormSelect.ShowModal() == wx.ID_OK: choix = self.paramFormSelect.GetStringSelection() self.ctrlParam.SetValue(choix) n = 0 for p in listeParam : if choix == p : self.parametresChoix=liste[n].getParametres() else : n+=1 else: text=u"Vous devez remplir les champs sup\xe9rieurs!!" dlg = wx.MessageDialog(self, text, 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onValider(self,event): if (self.ctrlEtatS.GetValue()!="") & (self.ctrlEtatC.GetValue()!=""): try: msg = 'Voulez-vous vraiment supprimer le comentaire' dlg=wx.MessageDialog(self.fenetreMedite, msg,"Attention!",wx.YES_NO | wx.ICON_EXCLAMATION ) if dlg.ShowModal() ==wx.ID_YES: planTravail = Donnees.planTravail.PlanTravail(self.ctrlAuteur.GetValue(), self.ctrlOeuvre.GetValue(),self.ctrlVersionS.GetValue(), self.ctrlEtatS.GetValue(),self.ctrlVersionC.GetValue(), self.ctrlEtatC.GetValue(),self.parametresChoix) self.fenetreMedite.cinfos.supprimerCommentaire(planTravail) except AuteurNonTrouve, eANT: dlg = wx.MessageDialog(self, u"L'auteur n'a pas \xe9t\xe9 trouv\xe9 !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except OeuvreNonTrouvee, eONT: dlg = wx.MessageDialog(self, u"L'oeuvre n'a pas \xe9t\xe9 trouv\xe9e !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except CommentaireNonTrouve, eCNT: dlg = wx.MessageDialog(self, u"Le commentaire n'a pas \xe9t\xe9 trouv\xe9 !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() except InformationsNonTrouvees, eINT: dlg = wx.MessageDialog(self, u"L'application Medite n'a pas \xe9t\xe9 appliqu\xe9 sur ce couple de etats !!", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() self.Close() else: dlg = wx.MessageDialog(self, "Vous devez remplir tous les champs !", 'Attention !',wx.OK) dlg.ShowModal() dlg.Destroy() def onAnnuler(self,event): self.Close()