Salome HOME
travail sur monPlusieurs
[tools/eficas.git] / Noyau / context.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 _root=None
21 _cata=None
22 debug=0
23 from Noyau.N_info import message, SUPERV
24
25 # Le "current step" est l'étape courante.
26 # Une macro se déclare étape courante dans sa méthode Build avant de construire
27 # ses étapes filles ou dans BuildExec avant de les exécuter.
28 # Les étapes simples le font aussi : dans Execute et BuildExec.
29 # (Build ne fait rien pour une étape)
30
31 def set_current_step(step):
32    """
33       Fonction qui permet de changer la valeur de l'étape courante
34    """
35    global _root
36    if _root : raise Exception("Impossible d'affecter _root. Il devrait valoir None")
37    _root=step
38    #message.debug(SUPERV, "current_step = %s", step and step.nom, stack_id=-1)
39
40 def get_current_step():
41    """
42       Fonction qui permet d'obtenir la valeur de l'étape courante
43    """
44    return _root
45
46 def unset_current_step():
47    """
48       Fonction qui permet de remettre à None l'étape courante
49    """
50    global _root
51    _root=None
52
53 def set_current_cata(cata):
54    """
55       Fonction qui permet de changer l'objet catalogue courant
56    """
57    global _cata
58    if _cata : raise Exception("Impossible d'affecter _cata. Il devrait valoir None")
59    _cata=cata
60
61 def get_current_cata():
62    """
63       Fonction qui retourne l'objet catalogue courant
64    """
65    return _cata
66
67 def unset_current_cata():
68    """
69       Fonction qui permet de remettre à None le catalogue courant
70    """
71    global _cata
72    _cata=None
73