1 # CONFIGURATION MANAGEMENT OF EDF VERSION
2 # ======================================================================
3 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
4 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
5 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
6 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
7 # (AT YOUR OPTION) ANY LATER VERSION.
9 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
10 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
11 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
12 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
14 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
15 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
16 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
19 # ======================================================================
31 def __init__(self,appli,parent):
32 # parent représente l'objet graphique parent
34 # appli représente l'objet application parent
37 self.l_boutons_a_activer = []
38 self.barreboutons=Frame(self.parent,relief='ridge',bd=2)
39 self.barreboutons.pack(anchor='nw',expand=0,fill=X)
40 # bouton Infos à l'extrême droite de la barre des boutons
41 b = Button(self.barreboutons,
42 image = images.get_image('About24'),
43 command = self.view_infos)
45 texte = "Infos EFICAS"
46 b.bind("<Enter>",lambda e,s=self,but=b,t=texte : s.affiche_balloon(e,but,t,pos='right'))
47 b.bind("<Leave>", self.efface_balloon)
49 def inactive_boutons(self):
51 Inactive les boutons de la liste self.l_boutons_a_activer
52 --> cette méthode est appelée dès qu'il n'y a pas de JDC courant
54 for but in self.l_boutons_a_activer:
55 but.configure(state='disabled')
57 def active_boutons(self):
59 Active les boutons de la liste self.l_boutons_a_activer
60 --> cette méthode est appelée dès qu'il y a un JDC courant
62 for but in self.l_boutons_a_activer:
63 but.configure(state='normal')
65 def affiche_balloon(self,event,bouton,bulle,pos='left'):
67 Affiche le balloon bulle associé au bouton bouton
69 etat = bouton.cget('state')
70 if etat != 'normal' : return
71 geom = bouton.winfo_geometry()
72 l_args = string.split(geom,'+')
73 x = eval(l_args[1])+event.x+10
74 self.balloon = Label(self.parent,
80 self.balloon.place(in_=self.parent,x=x,y=32)
82 self.balloon.place(in_=self.parent,x=x,y=32,anchor='ne')
84 def efface_balloon(self,event=None):
86 Efface le balloon courant
89 self.balloon.destroy()
94 Permet d'afficher des infos sur la session courante d'EFICAS
96 self.fen_infos = Pmw.Dialog(self.parent,
97 title = 'Informations session EFICAS',
98 buttons = ('Fermer',),
99 command = self.close_infos)
100 self.fen_infos.withdraw()
101 texte_infos = self.appli.get_texte_infos()
102 Label(self.fen_infos.interior(),
104 anchor='center').pack(side='top',anchor='center')
105 self.fen_infos.activate(geometry = 'centerscreenalways')
107 def close_infos(self,lbl):
109 Ferme la fenêtre des infos
111 self.fen_infos.destroy()
113 def creer_boutons_appli_composant(self,l_boutons,appli_composant):
114 for bouton in l_boutons :
116 # on veut afficher un bouton vide (=espace entre boutons)
117 Button(self.barreboutons,
118 image = images.get_image('Sep'),
120 relief = 'flat').pack(side='left')
122 nom_fic,commande,texte,statut = bouton
123 commande=getattr(appli_composant,commande)
124 b = Button(self.barreboutons,
125 image = images.get_image(nom_fic),
129 b.bind("<Enter>",lambda e,s=self,but=b,t=texte : s.affiche_balloon(e,but,t))
130 b.bind("<Leave>", self.efface_balloon)
131 if statut != 'always':
132 self.l_boutons_a_activer.append(b)
134 # inactive les boutons qui doivent l'être tant qu'aucun JDC courant
135 self.inactive_boutons()