Salome HOME
Merge remote branch 'origin/nouvelEficas' into nouvelEficas
[tools/eficas.git] / InterfaceQT4 / compomclist.py
index b1104d4e673c761869d0a3c950918c5f60acd7c0..55666f9b473a1f9e5f876c437fdc27a440a2ff0a 100644 (file)
@@ -1,4 +1,22 @@
 # -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
 
 import types
 import traceback
@@ -6,10 +24,10 @@ import traceback
 import compofact
 import browser
 import typeNode
+from Extensions.i18n import tr
 
 from Editeur     import Objecttreeitem
 from Noyau.N_OBJECT import ErrorObj
-#import compoerror
 
 
 class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
@@ -31,37 +49,55 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
     def createPopUpMenu(self):
         typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
 
+    def getPanelGroupe(self,parentQt,commande):
+        maDefinition=self.item.get_definition()
+        monObjet=self.item.object
+        monNom=self.item.nom
+        maCommande=commande
+        #print parentQt
+        if hasattr(parentQt,'niveau'): self.niveau=parentQt.niveau+1
+        else : self.niveau=1
+        if not (monObjet.isMCList()) :
+           if  hasattr(self,'plie') and self.plie==True : 
+               from monWidgetFactPlie import MonWidgetFactPlie
+               widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+           else:
+               from monWidgetFact import MonWidgetFact
+               widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+        else :
+           from monWidgetBloc import MonWidgetBloc
+           widget=MonWidgetBloc(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+        return widget
+
 
-    def doPaste(self,node_selected):
-        objet_a_copier = self.item.get_copie_objet()
-        child=node_selected.doPasteMCF(objet_a_copier)
+    #def doPaste(self,node_selected):
+    #    objet_a_copier = self.item.get_copie_objet()
+    #    child=node_selected.doPasteMCF(objet_a_copier)
         #print "doPaste",child
-        return child
+    #    return child
 
-    def doPasteMCF(self,objet_a_copier):
-        child=None
+    #def doPasteMCF(self,objet_a_copier):
+    #    child=None
         # le noeud courant est une MCList
-        if self.item.isMCList() :
-          child = self.append_child(objet_a_copier,pos='first',retour='oui')
+    #    if self.item.isMCList() :
+    #      child = self.append_child(objet_a_copier,pos='first',retour='oui')
 
         # le noeud courant est un MCFACT
-        elif self.item.isMCFact() :
+    #    elif self.item.isMCFact() :
           # le noeud selectionne est un MCFACT dans une MCList
-          if self.parent.item.isMCList():
-             child = self.parent.append_child(objet_a_copier,
-                                              pos=self.item,
-                                              retour='oui')
+    #      if self.parent.item.isMCList():
+    #         child = self.parent.append_child(objet_a_copier, pos=self.item, retour='oui')
 
           # le noeud MCFACT selectionne n'est pas dans une MCList
-          else:
-             child = self.parent.append_child(objet_a_copier,retour='oui')
+    #      else:
+    #         child = self.parent.append_child(objet_a_copier,retour='oui')
 
-        else:
-          QMessageBox.information( self, "Copie impossible",
-                   "Vous ne pouvez coller le mot-clé facteur copié à ce niveau de l'arborescence !")          
-          self.editor.affiche_infos("Copie refusée")
+    #    else:
+    #      QMessageBox.information( self, "Copie impossible",
+    #               "Vous ne pouvez coller le mot-clé facteur copié à ce niveau de l'arborescence !")          
+    #      self.editor.affiche_infos("Copie refusée")
 
-        return child
+    #    return child
 
 class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem):
     """ La classe MCListTreeItem joue le role d'un adaptateur pour les objets
@@ -191,11 +227,11 @@ class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem):
 
         if self.object.suppentite(obj):
            if len(self._object) == 1: self.updateDelegate()     
-           message = "Mot-clef " + obj.nom + " supprimé"
+           message = "Mot-clef " + obj.nom + " supprime"
            self.appli.affiche_infos(message)
            return 1
         else:
-           self.appli.affiche_infos('Impossible de supprimer ce mot-clef')
+           self.appli.affiche_infos(tr('Impossible de supprimer ce mot-clef'),Qt.red)
            return 0