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
39 def __init__ (self,master,code='ASTER',fichier=None) :
42 self.top.protocol("WM_DELETE_WINDOW",self.exitEFICAS)
43 self.top.minsize(900,500)
44 self.top.geometry("900x500")
45 self.top.title(VERSION + ' pour '+self.code)
47 self.initializeTk(master)
48 Pmw.initialise(master)
49 self.lecture_parametres()
50 self.format_fichier = Tkinter.StringVar()
52 self.cree_composants_graphiques()
53 self.load_extensions()
57 def send_message(self,message):
66 def lecture_parametres(self):
68 Active la lecture des paramètres standards et utilisateur
70 splash._splash.configure(text = "Chargement des paramètres utilisateur")
72 self.CONFIGURATION = configuration.make_config(self,prefs.REPINI)
74 def cree_composants_graphiques(self):
76 Cree les constituants de l'application :
82 splash._splash.configure(text = "Chargement de l'IHM")
83 splash._splash.configure(text = "Chargement de la menubar")
85 self.menubar=menubar.MENUBAR(self,self.top)
86 splash._splash.configure(text = "Chargement de la toolbar")
88 self.toolbar=toolbar.TOOLBAR(self,self.top)
89 splash._splash.configure(text = "Chargement de la statusbar")
91 self.statusbar=statusbar.STATUSBAR(self.top)
93 def load_extensions(self):
94 splash._splash.configure(text = "Chargement des extensions")
95 for mname in self.extensions:
96 self.load_extension(mname)
98 def load_extension(self,mname):
99 module=__import__(mname,globals(),locals())
100 factory=getattr(module,mname.upper())
101 extension=factory(self,self.top)
102 setattr(self,mname,extension)
103 self.fill_menus(extension,extension.menu_defs)
104 self.toolbar.creer_boutons_extension(extension.button_defs,extension)
106 def affiche_FAQ(self):
108 faq.affiche(self.top)
110 def affiche_infos(self,message):
111 self.statusbar.affiche_infos(message)
114 def initializeTk(self, root):
116 Initialize platform specific options
118 if sys.platform == 'mac':
119 self.initializeTk_mac(root)
120 elif sys.platform == 'win32':
121 self.initializeTk_win32(root)
123 self.initializeTk_unix(root)
125 def initializeTk_win32(self, root):
126 root.option_add('*Font', fontes.standard)
127 root.option_add('*EntryField.Entry.Font', fontes.standard)
128 root.option_add('*Listbox*Font',fontes.standard)
130 def initializeTk_colors_common(self, root):
131 root.option_add('*background', 'grey')
132 root.option_add('*foreground', 'black')
133 root.option_add('*EntryField.Entry.background', 'white')
134 root.option_add('*Entry*background', 'white')
135 root.option_add('*Listbox*background', 'white')
136 root.option_add('*Listbox*selectBackground', '#00008b')
137 root.option_add('*Listbox*selectForeground', 'white')
139 def initializeTk_mac(self, root):
140 self.initializeTk_colors_common(root)
142 def initializeTk_unix(self, root):
143 root.option_add('*Font', fontes.standard)
144 root.option_add('*EntryField.Entry.Font',fontes.standard )
145 root.option_add('*Listbox*Font', fontes.standard)
146 self.initializeTk_colors_common(root)
148 def get_texte_infos(self):
150 Retourne un texte d'informations sur la session courante d'EFICAS
152 texte = VERSION + '\n\n'
153 texte = texte + 'EFICAS est un produit développé par \nEDF-Division Stratégie et Développement\n'
154 texte = texte + 'Equipe : MTI/MMN\n\n'
155 texte = texte + 'Code utilisé : %s\n' %self.code
158 def efface_aide(self,event):
160 Efface la bulle d'aide d'un panneau
168 def affiche_aide(self,event,aide):
170 Affiche l'aide concernant un panneau
175 self.aide = Tkinter.Label(widget ,text = aide,
176 bg="yellow",relief="ridge",anchor='w')
177 self.aide.place(in_=widget,
178 relx=0.5,rely=0.5,anchor='center')
182 def fill_menus(self,extension,defs):
183 menudict=self.menubar.menudict
184 for mname,itemlist in defs:
185 menu=menudict.get(mname)
187 for item in itemlist:
192 command=getattr(extension,method)
193 menu.add_command(label=label,command=command)