1 # -*- coding: utf-8 -*-
2 # CONFIGURATION MANAGEMENT OF EDF VERSION
3 # ======================================================================
4 # COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
5 # THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
6 # IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
7 # THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
8 # (AT YOUR OPTION) ANY LATER VERSION.
10 # THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
11 # WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
12 # MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
13 # GENERAL PUBLIC LICENSE FOR MORE DETAILS.
15 # YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
16 # ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
17 # 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
20 # ======================================================================
22 Ce module permet de créer, mettre à jour et détruire
27 from centerwindow import centerwindow
28 from Tools.foztools.foztools import Slider
34 def init_splash(*pos,**args):
36 _splash=SplashScreen(*pos,**args)
43 class SplashScreen(Toplevel):
45 Provides a splash screen. Usage:
46 Subclass and override 'CreateWidgets()'
47 In constructor of main window/application call
48 - S = SplashScreen(main=self) (if caller is Toplevel)
49 - S = SplashScreen(main=self.master) (if caller is Frame)
50 - S.quit() after you are done creating your widgets etc.
52 def __init__(self, master=None,**args):
53 Toplevel.__init__(self, master, relief='groove',
56 if self.main != None :
59 self.frame = Frame(self)
60 self.frame.pack(expand=1,fill='both')
62 self.geometry("300x200")
68 def init(self,args={}):
69 self.text = StringVar()
71 self.text2 = StringVar()
73 self.icone = 'logo_edf.gif'
75 if args == {} : return
76 if args.has_key('text'):
77 self.text.set(args['text'])
78 if args.has_key('info'):
79 self.text2.set(args['info'])
80 if args.has_key('titre'):
81 self.title(args['titre'])
82 if args.has_key('code'):
83 self.code = args['code']
86 if args.has_key('icone'):
87 self.icone = args['icone']
88 if self.code == 'ASTER' :
89 self.icone = 'code_aster.gif'
90 elif self.code == 'SATURNE':
91 self.icone = 'code_saturne.gif'
92 elif self.code == 'DESCARTES':
93 self.icone = 'code_descartes.gif'
95 def CreateWidgets(self):
96 self.catIcon = images.get_image(self.icone)
97 self.label = Label(self.frame, image=self.catIcon)
98 self.label.pack(side=TOP)
99 self.label = Label(self.frame, textvariable=self.text,font = fontes.standard_gras)
100 self.label.pack(side=TOP,expand=1,fill='both')
101 self.label2 = Label(self.frame, textvariable=self.text2,font = fontes.standard_italique)
102 self.label2.pack(side=TOP,expand=1,fill='both')
103 self.progress = Slider(self.frame,value=0,max=100,orientation='horizontal',
104 fillColor='#00008b',width=200,height=30,
105 background='white',labelColor='red')
108 def update_barre(self,event=None):
109 """ Permet de faire avancer la barre de progression """
111 self.progress.value = self.progress.value+self.increment
112 self.progress.update()
116 def configure_barre(self):
118 Calcule l'incrément de progression de la barre en fonction
119 du nombre d'opérations à effectuer afin que le compteur
120 soit à 100% à la fin des opérations
122 self.increment = 100./self.ratio
123 self.progress.update()
125 def configure(self,**args):
126 if args.has_key('text'):
127 self.text.set(args['text'])
128 if args.has_key('info'):
129 self.text2.set(args['info'])
130 if args.has_key('titre'):
131 self.title(args['titre'])
132 if args.has_key('barre'):
134 self.barre = args['barre']
135 if self.barre == 'oui' and old == 'non':
136 self.progress.frame.pack(in_=self.frame,side='top')
137 elif self.barre == 'non' and old == 'oui':
138 self.progress.frame.pack_forget()
139 if args.has_key('ratio'):
140 self.ratio = args['ratio']
141 self.configure_barre()
149 self.main.deiconify()
150 centerwindow(self.main,parent='sans')