X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=InterfaceQT4%2Fcompomclist.py;h=c7179c9ee7d11f460ddf46dbcbb2868f94d6c5e5;hb=96176d0080e0d4efbd29d98c0df700a64a82acdc;hp=04a79132cb8354db4233c5dc804caa09b9e21007;hpb=69ed0ccae7884aee37bbe54cb1af2983cb51492d;p=tools%2Feficas.git diff --git a/InterfaceQT4/compomclist.py b/InterfaceQT4/compomclist.py index 04a79132..c7179c9e 100644 --- a/InterfaceQT4/compomclist.py +++ b/InterfaceQT4/compomclist.py @@ -1,69 +1,80 @@ # -*- 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 +# + +from __future__ import absolute_import import types import traceback -import compofact -import browser +from . import compofact +from . import browser +from . import typeNode +from Extensions.i18n import tr + from Editeur import Objecttreeitem from Noyau.N_OBJECT import ErrorObj -#import compoerror - - -class Node(browser.JDCNode): - def getPanel(self): - """ - """ - if self.item.isMCList() : - if self.item.ajout_possible(): - from monMCListAjoutPanel import MonMCListAjoutPanel - return MonMCListAjoutPanel(self,parent=self.editor) - else : - print "MCList" - elif self.item.isMCFact() : - from monMCFactPanel import MonMCFactPanel - return MonMCFactPanel(self,parent=self.editor) - else : - print "MCList" - 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') +class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal): + + def createPopUpMenu(self): + typeNode.PopUpMenuNodeMinimal.createPopUpMenu(self) - # 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') + def getPanelGroupe(self,parentQt,commande): + maDefinition=self.item.get_definition() + monObjet=self.item.object + monNom=self.item.nom + maCommande=commande + #print "ds getPanelGroupe" , self.item.nom + 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 - # 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-clé facteur copié à ce niveau de l'arborescence !") - self.editor.affiche_infos("Copie refusée") + 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.append_brother(objet_a_copier,'before') + if self.editor.fenetreCentraleAffichee : self.editor.fenetreCentraleAffichee.node.affichePanneau() + self.update_node_label_in_black() return child + + class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem): """ La classe MCListTreeItem joue le role d'un adaptateur pour les objets du noyau Accas instances de la classe MCLIST. - Elle adapte ces objets pour leur permettre d'etre intégrés en tant que + Elle adapte ces objets pour leur permettre d'etre integres en tant que noeuds dans un arbre graphique (voir treewidget.py et ObjectTreeItem.py). - Cette classe délègue les appels de méthode et les accès - aux attributs à l'objet du noyau soit manuellement soit + Cette classe delegue les appels de methode et les acces + aux attributs a l'objet du noyau soit manuellement soit automatiquement (voir classe Delegate et attribut object). """ itemNode=Node @@ -81,7 +92,7 @@ class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem): def panel(self,jdcdisplay,pane,node): """ Retourne une instance de l'objet panneau associe a l'item (self) - Si la liste ne contient qu'un mot clé facteur, on utilise le panneau + Si la liste ne contient qu'un mot cle facteur, on utilise le panneau FACTPanel. Si la liste est plus longue on utilise le panneau MCLISTPanel. """ @@ -142,7 +153,7 @@ class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem): return "ast-yel-los" def get_docu(self): - """ Retourne la clef de doc de l'objet pointé par self """ + """ Retourne la clef de doc de l'objet pointe par self """ return self.object.get_docu() def iscopiable(self): @@ -153,13 +164,13 @@ class MCListTreeItem(Objecttreeitem.SequenceTreeItem,compofact.FACTTreeItem): def isMCFact(self): """ - Retourne 1 si l'objet pointé par self est un MCFact, 0 sinon + Retourne 1 si l'objet pointe par self est un MCFact, 0 sinon """ return len(self._object) <= 1 def isMCList(self): """ - Retourne 1 si l'objet pointé par self est une MCList, 0 sinon + Retourne 1 si l'objet pointe par self est une MCList, 0 sinon """ return len(self._object) > 1 @@ -185,12 +196,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é" - self.appli.affiche_infos(message) - return 1 + message = "Mot-clef " + obj.nom + " supprime" + #self.editor.affiche_commentaire(message) + return (1,message) else: - self.appli.affiche_infos('Impossible de supprimer ce mot-clef') - return 0 + return (0,tr('Impossible de supprimer ce mot-clef')) import Accas