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 # ======================================================================
21 Ce module contient la classe APPLI qui est la classe mère de
22 l'application EFICAS. Elle prend en charge l'organisation générale
23 des composants graphiques et l'initialisation Tk
24 L'aspect applicatif doit etre pris en charge par la classe dérivée
37 def __init__ (self,master,code='ASTER',fichier=None) :
40 self.top.protocol("WM_DELETE_WINDOW",self.exitEFICAS)
41 self.top.minsize(900,500)
42 self.top.geometry("900x500")
43 self.top.title('EFICAS v1.1 pour '+self.code)
45 self.initializeTk(master)
46 Pmw.initialise(master)
47 self.lecture_parametres()
48 self.format_fichier = Tkinter.StringVar()
50 self.cree_composants_graphiques()
51 self.load_extensions()
55 def send_message(self,message):
64 def lecture_parametres(self):
66 Active la lecture des paramètres standards et utilisateur
68 splash._splash.configure(text = "Chargement des paramètres utilisateur")
70 self.CONFIGURATION = configuration.make_config(self,prefs.REPINI)
72 def cree_composants_graphiques(self):
74 Cree les constituants de l'application :
80 splash._splash.configure(text = "Chargement de l'IHM")
81 splash._splash.configure(text = "Chargement de la menubar")
83 self.menubar=menubar.MENUBAR(self,self.top)
84 splash._splash.configure(text = "Chargement de la toolbar")
86 self.toolbar=toolbar.TOOLBAR(self,self.top)
87 splash._splash.configure(text = "Chargement de la statusbar")
89 self.statusbar=statusbar.STATUSBAR(self.top)
91 def load_extensions(self):
92 splash._splash.configure(text = "Chargement des extensions")
93 for mname in self.extensions:
94 self.load_extension(mname)
96 def load_extension(self,mname):
97 module=__import__(mname,globals(),locals())
98 factory=getattr(module,mname.upper())
99 extension=factory(self,self.top)
100 setattr(self,mname,extension)
101 self.fill_menus(extension,extension.menu_defs)
102 self.toolbar.creer_boutons_extension(extension.button_defs,extension)
104 def affiche_FAQ(self):
106 faq.affiche(self.top)
108 def affiche_infos(self,message):
109 self.statusbar.affiche_infos(message)
112 def initializeTk(self, root):
114 Initialize platform specific options
116 if sys.platform == 'mac':
117 self.initializeTk_mac(root)
118 elif sys.platform == 'win32':
119 self.initializeTk_win32(root)
121 self.initializeTk_unix(root)
123 def initializeTk_win32(self, root):
124 root.option_add('*Font', fontes.standard)
125 root.option_add('*EntryField.Entry.Font', fontes.standard)
126 root.option_add('*Listbox*Font',fontes.standard)
128 def initializeTk_colors_common(self, root):
129 root.option_add('*background', 'grey')
130 root.option_add('*foreground', 'black')
131 root.option_add('*EntryField.Entry.background', 'white')
132 root.option_add('*Entry*background', 'white')
133 root.option_add('*Listbox*background', 'white')
134 root.option_add('*Listbox*selectBackground', '#00008b')
135 root.option_add('*Listbox*selectForeground', 'white')
137 def initializeTk_mac(self, root):
138 self.initializeTk_colors_common(root)
140 def initializeTk_unix(self, root):
141 root.option_add('*Font', fontes.standard)
142 root.option_add('*EntryField.Entry.Font',fontes.standard )
143 root.option_add('*Listbox*Font', fontes.standard)
144 self.initializeTk_colors_common(root)
146 def get_texte_infos(self):
148 Retourne un texte d'informations sur la session courante d'EFICAS
150 texte = 'EFICAS v1.1\n\n'
151 texte = texte + 'EFICAS est un produit développé par \nEDF-Division Stratégie et Développement\n'
152 texte = texte + 'Equipe : MTI/MMN\n\n'
153 texte = texte + 'Code utilisé : %s\n' %self.code
156 def efface_aide(self,event):
158 Efface la bulle d'aide d'un panneau
166 def affiche_aide(self,event,aide):
168 Affiche l'aide concernant un panneau
173 self.aide = Tkinter.Label(widget ,text = aide,
174 bg="yellow",relief="ridge",anchor='w')
175 self.aide.place(in_=widget,
176 relx=0.5,rely=0.5,anchor='center')
180 def fill_menus(self,extension,defs):
181 menudict=self.menubar.menudict
182 for mname,itemlist in defs:
183 menu=menudict.get(mname)
185 for item in itemlist:
190 command=getattr(extension,method)
191 menu.add_command(label=label,command=command)