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 # ======================================================================
27 from widgets import askopenfilename
30 # l'option affichage_commandes peut prendre les valeurs "groupes" ou "alphabetic"
31 affichage_commandes="alphabetic"
37 ("Affichage commandes",(("alphabétique",'&affichage_alpha'),("groupes",'&affichage_grp'))),
38 #("Couleur",(("fond",'change_fond'),("barre",'change_barre'))),
39 # ("Catalogue développeur",'choix_cata_developpeur'),
40 ('Paramètres Eficas','affichage_fichier_ini'),
48 def __init__(self,appli,parent):
53 def affichage_grp(self):
54 global affichage_commandes
55 affichage_commandes="groupes"
56 if hasattr(panels,'panneauCommande'):
57 panel=panels.panneauCommande
60 parent.create_panel(parent.node_selected)
61 # si on a un panel avec plusieurs onglets
64 parent.panel_courant.nb.selectpage("Commande")
68 def affichage_alpha(self):
70 global affichage_commandes
71 affichage_commandes="alphabetic"
72 if hasattr(panels,'panneauCommande'):
73 panel=panels.panneauCommande
76 parent.create_panel(parent.node_selected)
77 # si on a un panel avec plusieurs onglets
80 parent.panel_courant.nb.selectpage("Commande")
84 def change_fond(self):
85 from tkColorChooser import askcolor
86 #nouvelle=askcolor(self.appli.background)
87 nouvelle=askcolor('grey')
89 def change_barre(self):
92 def choix_cata_developpeur(self):
94 Cette méthode demande à l'utilisateur-développeur d'indiquer quel catalogue
95 il veut utiliser en remplacement du catalogue standard du code
96 NB : il faut que le développeur ait les droits d'écriture dans le répertoire où
97 se trouve le catalogue
99 file = askopenfilename(title="Choix d'un catalogue personnel",
100 defaultextension=".py",
101 filetypes = ( ("Catalogue", "cata*.py"),))
103 self.parent.update_idletasks()
104 self.appli.reset_affichage_infos()
105 rep_fic = os.path.dirname(file)
106 nom_fic = string.split(os.path.basename(file),'.')[0]
107 rep_courant = os.getcwd()
109 self.cata = __import__(nom_fic)
110 self.code = self.cata.CODE
111 os.chdir(rep_courant)
113 fic_cata_p = nom_fic+'_pickled.py'
114 self.fic_cata_p = os.path.join(rep_fic,fic_cata_p)
115 pile_erreurs = self.cata.erreurs_cata
116 if pile_erreurs.existe_message() :
117 messages = pile_erreurs.retourne_messages()
120 # XXX ne doit pas fonctionner
121 self.catalo = catabrowser.CataItem(cata=self.cata)
122 self.Retrouve_Ordre_Cata('personnel')
123 pile_erreurs.efface()
126 def affichage_fichier_ini(self):
127 self.appli.bureau.affichage_fichier_ini()