]> SALOME platform Git repositories - tools/eficas.git/blob - Editeur/options.py
Salome HOME
CCAR: creation V1_13a1 a partir de la branche Liv-V1_12
[tools/eficas.git] / Editeur / options.py
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.
9 #
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.
14 #
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.
18 #
19 #
20 # ======================================================================
21 """
22 """
23 # Modules Python
24 import os,string
25
26 # Modules Eficas
27 from widgets import askopenfilename
28 import panels
29
30 # l'option affichage_commandes peut prendre les valeurs "groupes" ou "alphabetic"
31 affichage_commandes="alphabetic"
32
33 class OPTIONS:
34
35    menu_defs=[
36         ('Options',[
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'),
41                    ('Paramètres Affichage','affichage_style_ini'),
42                       
43                    ]
44         )
45              ]
46
47    button_defs=[]
48
49    def __init__(self,appli,parent):
50       self.appli=appli
51       self.parent=parent
52
53
54    def affichage_grp(self):
55       global affichage_commandes
56       affichage_commandes="groupes"
57       if hasattr(panels,'panneauCommande'):
58          panel=panels.panneauCommande
59          parent=panel.parent
60          if parent != None :
61             parent.create_panel(parent.node_selected)
62             # si on a un panel avec plusieurs onglets
63             # on affiche Commande
64             try :
65               parent.panel_courant.nb.selectpage("Commande")
66             except :
67               pass
68
69    def affichage_alpha(self):
70
71       global affichage_commandes
72       affichage_commandes="alphabetic"
73       if hasattr(panels,'panneauCommande'):
74          panel=panels.panneauCommande
75          parent=panel.parent
76          if parent != None :
77             parent.create_panel(parent.node_selected)
78             # si on a un panel avec plusieurs onglets
79             # on affiche Commande
80             try :
81               parent.panel_courant.nb.selectpage("Commande")
82             except :
83               pass
84
85    def change_fond(self):
86       from tkColorChooser import askcolor
87       #nouvelle=askcolor(self.appli.background)
88       nouvelle=askcolor('grey')
89
90    def change_barre(self):
91        pass
92
93    def choix_cata_developpeur(self):
94       """ 
95           Cette méthode demande à l'utilisateur-développeur d'indiquer quel catalogue
96           il veut utiliser en remplacement du catalogue standard du code
97           NB : il faut que le développeur ait les droits d'écriture dans le répertoire où
98           se trouve le catalogue 
99       """
100       file = askopenfilename(title="Choix d'un catalogue personnel",
101                              defaultextension=".py",
102                              filetypes = ( ("Catalogue", "cata*.py"),))
103       if file :
104           self.parent.update_idletasks()
105           self.appli.reset_affichage_infos()
106           rep_fic = os.path.dirname(file)
107           nom_fic = string.split(os.path.basename(file),'.')[0]
108           rep_courant = os.getcwd()
109           os.chdir(rep_fic)
110           self.cata = __import__(nom_fic)
111           self.code = self.cata.CODE
112           os.chdir(rep_courant)
113           self.fic_cata = file
114           fic_cata_p = nom_fic+'_pickled.py'
115           self.fic_cata_p = os.path.join(rep_fic,fic_cata_p)
116           pile_erreurs = self.cata.erreurs_cata
117           if pile_erreurs.existe_message() :
118               messages = pile_erreurs.retourne_messages()
119               print messages
120           else :
121               # XXX ne doit pas fonctionner
122               self.catalo = catabrowser.CataItem(cata=self.cata)
123               self.Retrouve_Ordre_Cata('personnel')
124           pile_erreurs.efface()
125
126
127    def affichage_fichier_ini(self):
128        self.appli.CONFIGURATION.affichage_fichier_ini()
129
130
131    def affichage_style_ini(self):
132        self.appli.CONFIGStyle.affichage_style_ini()