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'),
46 def __init__(self,appli,parent):
50 def affichage_grp(self):
51 global affichage_commandes
52 affichage_commandes="groupes"
53 if hasattr(panels,'panneauCommande'):
54 panel=panels.panneauCommande
57 parent.create_panel(parent.node_selected)
58 # si on a un panel avec plusieurs onglets
61 parent.panel_courant.nb.selectpage("Commande")
65 def affichage_alpha(self):
67 global affichage_commandes
68 affichage_commandes="alphabetic"
69 if hasattr(panels,'panneauCommande'):
70 panel=panels.panneauCommande
73 parent.create_panel(parent.node_selected)
74 # si on a un panel avec plusieurs onglets
77 parent.panel_courant.nb.selectpage("Commande")
81 def change_fond(self):
82 from tkColorChooser import askcolor
83 #nouvelle=askcolor(self.appli.background)
84 nouvelle=askcolor('grey')
86 def change_barre(self):
89 def choix_cata_developpeur(self):
91 Cette méthode demande à l'utilisateur-développeur d'indiquer quel catalogue
92 il veut utiliser en remplacement du catalogue standard du code
93 NB : il faut que le développeur ait les droits d'écriture dans le répertoire où
94 se trouve le catalogue
96 file = askopenfilename(title="Choix d'un catalogue personnel",
97 defaultextension=".py",
98 filetypes = ( ("Catalogue", "cata*.py"),))
100 self.parent.update_idletasks()
101 self.appli.reset_affichage_infos()
102 rep_fic = os.path.dirname(file)
103 nom_fic = string.split(os.path.basename(file),'.')[0]
104 rep_courant = os.getcwd()
106 self.cata = __import__(nom_fic)
107 self.code = self.cata.CODE
108 os.chdir(rep_courant)
110 fic_cata_p = nom_fic+'_pickled.py'
111 self.fic_cata_p = os.path.join(rep_fic,fic_cata_p)
112 pile_erreurs = self.cata.erreurs_cata
113 if pile_erreurs.existe_message() :
114 messages = pile_erreurs.retourne_messages()
117 # XXX ne doit pas fonctionner
118 self.catalo = catabrowser.CataItem(cata=self.cata)
119 self.Retrouve_Ordre_Cata('personnel')
120 pile_erreurs.efface()