/usr/share/pyshared/InterfaceTK/splash.py is in eficas 2.0.3-1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | # -*- coding: utf-8 -*-
# CONFIGURATION MANAGEMENT OF EDF VERSION
# ======================================================================
# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG
# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
# (AT YOUR OPTION) ANY LATER VERSION.
#
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT
# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF
# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU
# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
#
# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
#
#
# ======================================================================
"""
Ce module permet de créer, mettre à jour et détruire
un écran Splash
"""
from Tkinter import *
from centerwindow import centerwindow
from Tools.foztools.foztools import Slider
import fontes
import images
_splash=None
def init_splash(*pos,**args):
global _splash
_splash=SplashScreen(*pos,**args)
def fini_splash():
global _splash
_splash.quit()
_splash=None
class SplashScreen(Toplevel):
"""
Provides a splash screen. Usage:
Subclass and override 'CreateWidgets()'
In constructor of main window/application call
- S = SplashScreen(main=self) (if caller is Toplevel)
- S = SplashScreen(main=self.master) (if caller is Frame)
- S.quit() after you are done creating your widgets etc.
"""
def __init__(self, master=None,**args):
Toplevel.__init__(self, master, relief='groove',
borderwidth=5)
self.main = master
if self.main != None :
self.main.iconify()
self.withdraw()
self.frame = Frame(self)
self.frame.pack(expand=1,fill='both')
self.init(args)
self.geometry("300x200")
self.resizable(0,0)
centerwindow(self)
self.CreateWidgets()
self.deiconify()
def init(self,args={}):
self.text = StringVar()
self.text.set('')
self.text2 = StringVar()
self.text2.set('')
self.icone = 'logo_edf.gif'
self.barre = 'non'
if args == {} : return
if args.has_key('text'):
self.text.set(args['text'])
if args.has_key('info'):
self.text2.set(args['info'])
if args.has_key('titre'):
self.title(args['titre'])
if args.has_key('code'):
self.code = args['code']
else:
self.code = 'inconnu'
if args.has_key('icone'):
self.icone = args['icone']
if self.code == 'ASTER' :
self.icone = 'code_aster.gif'
elif self.code == 'SATURNE':
self.icone = 'code_saturne.gif'
elif self.code == 'DESCARTES':
self.icone = 'code_descartes.gif'
def CreateWidgets(self):
self.catIcon = images.get_image(self.icone)
self.label = Label(self.frame, image=self.catIcon)
self.label.pack(side=TOP)
self.label = Label(self.frame, textvariable=self.text,font = fontes.standard_gras)
self.label.pack(side=TOP,expand=1,fill='both')
self.label2 = Label(self.frame, textvariable=self.text2,font = fontes.standard_italique)
self.label2.pack(side=TOP,expand=1,fill='both')
self.progress = Slider(self.frame,value=0,max=100,orientation='horizontal',
fillColor='#00008b',width=200,height=30,
background='white',labelColor='red')
centerwindow(self)
def update_barre(self,event=None):
""" Permet de faire avancer la barre de progression """
try:
self.progress.value = self.progress.value+self.increment
self.progress.update()
except:
pass
def configure_barre(self):
"""
Calcule l'incrément de progression de la barre en fonction
du nombre d'opérations à effectuer afin que le compteur
soit à 100% à la fin des opérations
"""
self.increment = 100./self.ratio
self.progress.update()
def configure(self,**args):
if args.has_key('text'):
self.text.set(args['text'])
if args.has_key('info'):
self.text2.set(args['info'])
if args.has_key('titre'):
self.title(args['titre'])
if args.has_key('barre'):
old = self.barre
self.barre = args['barre']
if self.barre == 'oui' and old == 'non':
self.progress.frame.pack(in_=self.frame,side='top')
elif self.barre == 'non' and old == 'oui':
self.progress.frame.pack_forget()
if args.has_key('ratio'):
self.ratio = args['ratio']
self.configure_barre()
self.update()
def quit(self):
self.progress = None
self.destroy()
if self.main:
centerwindow(self.main,parent='sans')
self.main.deiconify()
|