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 # ======================================================================
28 from Extensions import commentaire
30 Fonte_Niveau = fontes.canvas_gras_italique
31 Fonte_Niveau_inactif = fontes.canvas_italique
33 class NIVEAUPanel(panels.OngletPanel):
35 """ Initialise les frame des panneaux contextuels relatifs à un JDC """
36 panneau=Pmw.PanedWidget(self,orient='horizontal')
37 panneau.add('left',min=0.4,max=0.6,size=0.5)
38 panneau.add('right',min=0.4,max=0.6,size=0.5)
39 panneau.pack(expand=1,fill='both')
40 self.bouton_com.pack_forget()
41 self.makeJDCPage(panneau.pane('left'))
44 class Node(treewidget.Node):
45 def verif_condition_BAK(self):
47 on lance la vérification des conditions de chaque bloc de self
48 on crée ou supprime les noeuds concernés
49 (self est d'un niveau inférieur ou égal à l'ETAPE)
54 def replace_enfant_BAK(self,item):
55 """ Retourne le noeud fils à éventuellement remplacer """
60 class NIVEAUTreeItem(Objecttreeitem.ObjectTreeItem):
65 return self.object.isactif()
67 def IsExpandable(self):
70 def GetLabelText(self):
71 """ Retourne 3 valeurs :
72 - le texte à afficher dans le noeud représentant l'item
73 - la fonte dans laquelle afficher ce texte
79 fonte = Fonte_Niveau_inactif
80 return self.labeltext,fonte,'#00008b'
82 def GetIconName(self):
84 if self.object.isvalid():
85 return "ast-green-text"
89 return "ast-white-text"
92 if self.object.etapes_niveaux != []:
93 return range(len(self.object.etapes_niveaux))
95 return range(len(self.object.etapes))
99 for key in self.keys():
100 if self.object.etapes_niveaux != []:
101 liste = self.object.etapes_niveaux
103 liste = self.object.etapes
108 def setfunction(value, key=key, object=liste):
110 item =self.make_objecttreeitem(self.appli,value.ident() + " : ", value, setfunction)
114 def additem(self,name,pos):
115 if isinstance(name,Objecttreeitem.TreeItem) :
116 cmd=self.object.addentite(name.getObject(),pos)
118 cmd = self.object.addentite(name,pos)
119 item = self.make_objecttreeitem(self.appli,cmd.nom + " : ", cmd)
122 def suppitem(self,item) :
123 # item = item de l'ETAPE à supprimer du JDC
124 # item.getObject() = ETAPE ou COMMENTAIRE
126 itemobject=item.getObject()
127 if self.object.suppentite(itemobject):
128 if isinstance(item.object,commentaire.COMMENTAIRE):
129 message = "Commentaire supprimé"
131 message = "Commande " + itemobject.nom + " supprimée"
132 self.appli.affiche_infos(message)
135 self.appli.affiche_infos("Pb interne : impossible de supprimer cet objet")
143 treeitem = NIVEAUTreeItem
144 objet = Accas.ETAPE_NIVEAU