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)
53 def replace_enfant_BAK(self,item):
54 """ Retourne le noeud fils à éventuellement remplacer """
58 class NIVEAUTreeItem(Objecttreeitem.ObjectTreeItem):
63 return self.object.isactif()
65 def IsExpandable(self):
68 def GetLabelText(self):
69 """ Retourne 3 valeurs :
70 - le texte à afficher dans le noeud représentant l'item
71 - la fonte dans laquelle afficher ce texte
77 fonte = Fonte_Niveau_inactif
78 return self.labeltext,fonte,'#00008b'
80 def GetIconName(self):
82 if self.object.isvalid():
83 return "ast-green-text"
87 return "ast-white-text"
90 if self.object.etapes_niveaux != []:
91 return range(len(self.object.etapes_niveaux))
93 return range(len(self.object.etapes))
97 for key in self.keys():
98 if self.object.etapes_niveaux != []:
99 liste = self.object.etapes_niveaux
101 liste = self.object.etapes
106 def setfunction(value, key=key, object=liste):
108 item =self.make_objecttreeitem(self.appli,value.ident() + " : ", value, setfunction)
112 def additem(self,name,pos):
113 if isinstance(name,Objecttreeitem.TreeItem) :
114 cmd=self.object.addentite(name.getObject(),pos)
116 cmd = self.object.addentite(name,pos)
117 item = self.make_objecttreeitem(self.appli,cmd.nom + " : ", cmd)
120 def suppitem(self,item) :
121 # item = item de l'ETAPE à supprimer du JDC
122 # item.getObject() = ETAPE ou COMMENTAIRE
124 itemobject=item.getObject()
125 if self.object.suppentite(itemobject):
126 if isinstance(item.object,commentaire.COMMENTAIRE):
127 message = "Commentaire supprimé"
129 message = "Commande " + itemobject.nom + " supprimée"
130 self.appli.affiche_infos(message)
133 self.appli.affiche_infos("Pb interne : impossible de supprimer cet objet")
141 treeitem = NIVEAUTreeItem
142 objet = Accas.ETAPE_NIVEAU