Salome HOME
suite chgt copyright et menage
[tools/eficas.git] / InterfaceQT4 / compomclist.py
index cc02fe715968b07b7f2c52806ba804c17528fe0c..6b8a7d4d45e2996fd6c31e582cee3cee525c4281 100644 (file)
@@ -1,5 +1,5 @@
 # -*- coding: utf-8 -*-
-# Copyright (C) 2007-2013   EDF R&D
+# Copyright (C) 2007-2017   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
@@ -36,58 +36,38 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
     def createPopUpMenu(self):
         typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self)
 
-    def getPanelGroupe(self,parentQt,commande):
+    def getPanelGroupe(self,parentQt,commande,insertIn=-1):
         maDefinition=self.item.get_definition()
         monObjet=self.item.object
         monNom=self.item.nom
         maCommande=commande
         #print "ds getPanelGroupe" , self.item.nom
-        #if hasattr(self,'plie'): print "self.plie", self.plie
-       # if self.item.nom == "BackgroundError" and not(self.plie): print i
-        #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)
+               widget=MonWidgetFactPlie(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
            else:
                from .monWidgetFact import MonWidgetFact
-               widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande)
+               widget=MonWidgetFact(self,self.editor,parentQt,maDefinition,monObjet,self.niveau,maCommande,insertIn)
         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)
-        #print "doPaste",child
-    #    return child
 
-    #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')
+    def doPaste(self,node_selected,pos):
+        objet_a_copier = self.item.get_copie_objet()
+        # before est un effet de bord heureux sur l index
+        child=self.appendBrother(objet_a_copier,'before')
+        if self.editor.fenetreCentraleAffichee : self.editor.fenetreCentraleAffichee.node.affichePanneau()
+        self.update_node_label_in_black()
+        self.parent().build_children()
+        return child
 
-        # le noeud courant est un MCFACT
-    #    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')
 
-          # le noeud MCFACT selectionne n'est pas dans une MCList
-    #      else:
-    #         child = self.parent.append_child(objet_a_copier,retour='oui')
-
-    #    else:
-    #      QMessageBox.information( self, "Copie impossible",
-    #               "Vous ne pouvez coller le mot-cle facteur copie a ce niveau de l'arborescence !")          
-    #      self.editor.affiche_infos("Copie refusee")
-
-    #    return child
 
 class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem):
     """ La classe MCListTreeItem joue le role d'un adaptateur pour les objets