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 permet de créer, mettre à jour et détruire
26 from centerwindow import centerwindow
27 from Tools.foztools.foztools import Slider
33 def init_splash(*pos,**args):
35 _splash=SplashScreen(*pos,**args)
42 class SplashScreen(Toplevel):
44 Provides a splash screen. Usage:
45 Subclass and override 'CreateWidgets()'
46 In constructor of main window/application call
47 - S = SplashScreen(main=self) (if caller is Toplevel)
48 - S = SplashScreen(main=self.master) (if caller is Frame)
49 - S.quit() after you are done creating your widgets etc.
51 def __init__(self, master=None,**args):
52 Toplevel.__init__(self, master, relief='groove',
55 if self.main != None :
58 self.frame = Frame(self)
59 self.frame.pack(expand=1,fill='both')
61 self.geometry("300x200")
67 def init(self,args={}):
68 self.text = StringVar()
70 self.text2 = StringVar()
72 self.icone = 'logo_edf.gif'
74 if args == {} : return
75 if args.has_key('text'):
76 self.text.set(args['text'])
77 if args.has_key('info'):
78 self.text2.set(args['info'])
79 if args.has_key('titre'):
80 self.title(args['titre'])
81 if args.has_key('code'):
82 self.code = args['code']
85 if args.has_key('icone'):
86 self.icone = args['icone']
87 if self.code == 'ASTER' :
88 self.icone = 'code_aster.gif'
89 elif self.code == 'SATURNE':
90 self.icone = 'code_saturne.gif'
91 elif self.code == 'DESCARTES':
92 self.icone = 'code_descartes.gif'
94 def CreateWidgets(self):
95 self.catIcon = images.get_image(self.icone)
96 self.label = Label(self.frame, image=self.catIcon)
97 self.label.pack(side=TOP)
98 self.label = Label(self.frame, textvariable=self.text,font = fontes.standard_gras)
99 self.label.pack(side=TOP,expand=1,fill='both')
100 self.label2 = Label(self.frame, textvariable=self.text2,font = fontes.standard_italique)
101 self.label2.pack(side=TOP,expand=1,fill='both')
102 self.progress = Slider(self.frame,value=0,max=100,orientation='horizontal',
103 fillColor='#00008b',width=200,height=30,
104 background='white',labelColor='red')
107 def update_barre(self,event=None):
108 """ Permet de faire avancer la barre de progression """
110 self.progress.value = self.progress.value+self.increment
111 self.progress.update()
115 def configure_barre(self):
117 Calcule l'incrément de progression de la barre en fonction
118 du nombre d'opérations à effectuer afin que le compteur
119 soit à 100% à la fin des opérations
121 self.increment = 100./self.ratio
122 self.progress.update()
124 def configure(self,**args):
125 if args.has_key('text'):
126 self.text.set(args['text'])
127 if args.has_key('info'):
128 self.text2.set(args['info'])
129 if args.has_key('titre'):
130 self.title(args['titre'])
131 if args.has_key('barre'):
133 self.barre = args['barre']
134 if self.barre == 'oui' and old == 'non':
135 self.progress.frame.pack(in_=self.frame,side='top')
136 elif self.barre == 'non' and old == 'oui':
137 self.progress.frame.pack_forget()
138 if args.has_key('ratio'):
139 self.ratio = args['ratio']
140 self.configure_barre()
148 self.main.deiconify()
149 centerwindow(self.main,parent='sans')