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(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)
53 def replace_enfant(self,item):
54 """ Retourne le noeud fils à éventuellement remplacer """
58 class NIVEAUTreeItem(Objecttreeitem.ObjectTreeItem):
63 return self.object.isactif()
65 def IsExpandable_old(self):
66 return self.object.isactif()
68 def IsExpandable(self):
71 def GetLabelText(self):
72 """ Retourne 3 valeurs :
73 - le texte à afficher dans le noeud représentant l'item
74 - la fonte dans laquelle afficher ce texte
80 fonte = Fonte_Niveau_inactif
81 return self.labeltext,fonte,'#00008b'
83 def GetIconName(self):
85 if self.object.isvalid():
86 return "ast-green-text"
90 return "ast-white-text"
93 if self.object.etapes_niveaux != []:
94 return range(len(self.object.etapes_niveaux))
96 return range(len(self.object.etapes))
100 for key in self.keys():
101 if self.object.etapes_niveaux != []:
102 liste = self.object.etapes_niveaux
104 liste = self.object.etapes
109 def setfunction(value, key=key, object=liste):
111 item =self.make_objecttreeitem(self.appli,value.ident() + " : ", value, setfunction)
115 def additem(self,name,pos):
116 if isinstance(name,Objecttreeitem.TreeItem) :
117 cmd=self.object.addentite(name.getObject(),pos)
119 cmd = self.object.addentite(name,pos)
120 item = self.make_objecttreeitem(self.appli,cmd.nom + " : ", cmd)
123 def suppitem(self,item) :
124 # item = item de l'ETAPE à supprimer du JDC
125 # item.getObject() = ETAPE ou COMMENTAIRE
127 itemobject=item.getObject()
128 if self.object.suppentite(itemobject):
129 if isinstance(item.object,commentaire.COMMENTAIRE):
130 message = "Commentaire supprimé"
132 message = "Commande " + itemobject.nom + " supprimée"
133 self.appli.affiche_infos(message)
136 self.appli.affiche_infos("Pb interne : impossible de supprimer cet objet")
144 treeitem = NIVEAUTreeItem
145 objet = Accas.ETAPE_NIVEAU