From: eficas <> Date: Mon, 5 Dec 2005 09:07:31 +0000 (+0000) Subject: chgt du panneau pour les complexes X-Git-Tag: CC_param_poursuite~49 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5a37f0dcfa3d13592c6ff9ad9f6892949d72c300;p=tools%2Feficas.git chgt du panneau pour les complexes --- diff --git a/Editeur/uniquecomppanel.py b/Editeur/uniquecomppanel.py index ec6814c4..08dff729 100644 --- a/Editeur/uniquecomppanel.py +++ b/Editeur/uniquecomppanel.py @@ -59,14 +59,20 @@ class UNIQUE_COMP_Panel(UNIQUE_Panel): self.frame_valeur.pack(fill='both',expand=1) self.frame_valeur.bind("",lambda e,s=self,a=bulle_aide : s.parent.appli.affiche_aide(e,a)) self.frame_valeur.bind("",self.parent.appli.efface_aide) - self.label = Label(self.frame_valeur,text='Valeur :') - self.label.place(relx=0.1,rely=0.7) + self.label = Label(self.frame_valeur,text='Complexe de la forme : a+bj') + self.label1 = Label(self.frame_valeur,text='Imaginaire') + self.label2 = Label(self.frame_valeur,text='Phase') + self.label3 = Label(self.frame_valeur,text='OU') + self.label.place (relx=0.15,rely=0.1) + self.label1.place(relx=0.6,rely=0.50) + self.label2.place(relx=0.6,rely=0.57) + self.label3.place(relx=0.15,rely=0.4) self.typ_cplx=StringVar() self.typ_cplx.set('RI') - rb1 = Radiobutton(self.frame_valeur, text='RI',variable=self.typ_cplx,value='RI') - rb2 = Radiobutton(self.frame_valeur, text='MP',variable=self.typ_cplx,value='MP') - rb1.place(relx=0.05,rely = 0.6) - rb2.place(relx=0.05,rely = 0.8) + rb1 = Radiobutton(self.frame_valeur, text='RI : Réel',variable=self.typ_cplx,value='RI') + rb2 = Radiobutton(self.frame_valeur, text='MP : Module',variable=self.typ_cplx,value='MP') + rb1.place(relx=0.15,rely = 0.50) + rb2.place(relx=0.15,rely = 0.57) self.entry1 = Pmw.EntryField(self.frame_valeur,validate='real') self.entry2 = Pmw.EntryField(self.frame_valeur,validate='real') self.entry3 = Pmw.EntryField(self.frame_valeur) @@ -76,10 +82,12 @@ class UNIQUE_COMP_Panel(UNIQUE_Panel): self.entry2.component('entry').bind("",lambda e,c=self.valid_valeur:c()) self.entry3.component('entry').bind("",lambda e,c=self.valid_complexe:c()) self.entry3.component('entry').bind("",lambda e,c=self.valid_complexe:c()) - self.entry1.place(relx=0.27,rely = 0.7,relwidth=0.35) - self.entry2.place(relx=0.65,rely = 0.7,relwidth=0.35) - self.entry3.place(relx=0.27,rely = 0.4,relwidth=0.60) + self.entry1.place(relx=0.15,rely = 0.65,relwidth=0.35) + self.entry2.place(relx=0.60,rely = 0.65,relwidth=0.35) + self.entry3.place(relx=0.15,rely = 0.20,relwidth=0.60) self.entry1.focus() + self.bouton_val=Button(self.frame_valeur,text="Valider",command=self.valider,width=14) + self.bouton_val.place(relx=0.4,rely=0.8) self.frame_valeur.update() self.aide = Label(self.frame_valeur, text = aide, @@ -89,6 +97,14 @@ class UNIQUE_COMP_Panel(UNIQUE_Panel): # affichage de la valeur du MCS self.display_valeur() + def valider(self): + if ((self.entry3.get() != None) and (self.entry3.get() != "" )): + self.erase_valeur() + self.valid_complexe() + else : + self.valid_valeur() + + def display_valeur(self): """ Affiche la valeur de l'objet pointé par self @@ -135,8 +151,11 @@ class UNIQUE_COMP_Panel(UNIQUE_Panel): """ l=[] l.append(self.typ_cplx.get()) - l.append(string.atof(self.entry1.get())) - l.append(string.atof(self.entry2.get())) + try : + l.append(string.atof(self.entry1.get())) + l.append(string.atof(self.entry2.get())) + except : + return None return `tuple(l)` def erase_valeur(self):