Salome HOME
Merge remote branch 'origin/nouvelEficas' into nouvelEficas
[tools/eficas.git] / InterfaceQT4 / compomacro.py
index aec67efe30042886c05712f3e8bbf549de3024ca..ef78cf4e8525d6ec31ddef475af87f8211455004 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
+#
 
 # Modules Python
 import os,sys,string
@@ -7,9 +25,12 @@ import traceback
 
 # Modules Eficas
 from Editeur import Objecttreeitem
+from Extensions.i18n import tr
 import compooper
 import browser
 import typeNode
+from PyQt4.QtGui import QAction
+from PyQt4.QtCore import Qt, SIGNAL, QVariant
 
 
 class MACRONode(browser.JDCNode,typeNode.PopUpMenuNode):         
@@ -17,8 +38,28 @@ class MACRONode(browser.JDCNode,typeNode.PopUpMenuNode):
       from   monMacroPanel import MonMacroPanel
       return MonMacroPanel (self,parent=self.editor )
     
+    def getPanel2(self):
+      from   monWidgetCommande import MonWidgetCommande
+      return MonWidgetCommande (self,self.editor ,self.item.object)
+
+
     def createPopUpMenu(self):
       typeNode.PopUpMenuNode.createPopUpMenu(self)
+      if ("AFFE_CARA_ELEM" in self.item.get_genealogie()) and self.editor.salome:
+           self.ViewElt = QAction(tr('View3D'),self.tree)
+           self.tree.connect(self.ViewElt,SIGNAL("activated()"),self.view3D)
+           self.ViewElt.setStatusTip(tr("affiche dans Geom les elements de structure"))
+           self.menu.addAction(self.ViewElt)
+           if self.item.isvalid() :
+              self.ViewElt.setEnabled(1)
+           else:
+              self.ViewElt.setEnabled(0)
+
+    def view3D(self) :
+        from Editeur import TroisDPal
+        troisD=TroisDPal.TroisDPilote(self.item,self.editor.appliEficas)
+        troisD.envoievisu()
+
         
     #def doPaste(self,node_selected):
     #    print 'je suis la'
@@ -34,7 +75,7 @@ class MACROTreeItem(compooper.EtapeTreeItem):
     itemNode=MACRONode
 
 # ------------------------------------
-#  Classes necessaires à INCLUDE
+#  Classes necessaires a INCLUDE
 # ------------------------------------
 
 class INCLUDETreeItemBase(MACROTreeItem):
@@ -57,7 +98,7 @@ class INCLUDENode(browser.JDCNode,typeNode.PopUpMenuNode):
     def makeEdit(self):    #,appli,node
         if self.item.object.text_converted == 0:
                 # Le texte du fichier inclus n'a pas pu etre converti par le module convert
-                msg="Le fichier de commande n'a pas pu etre converti pour etre editable par Eficas\n\n"
+                msg=tr("Le fichier de commande n'a pas pu etre converti pour etre editable par Eficas\n\n")
                 msg=msg+self.item.object.text_error
                 return
     
@@ -87,7 +128,7 @@ class POURSUITENode(browser.JDCNode, typeNode.PopUpMenuNode):
 
     def makeEdit(self):    #,appli,node
         if self.item.object.text_converted == 0:
-                msg="Le fichier de commande n'a pas pu etre converti pour etre editable par Eficas\n\n"
+                msg=tr("Le fichier de commande n'a pas pu etre converti pour etre editable par Eficas\n\n")
                 msg=msg+self.item.object.text_error
                 return
     
@@ -104,7 +145,7 @@ class POURSUITETreeItem(INCLUDETreeItemBase):
 
 
 # ----------------------------------------
-#  Classes necessaires à INCLUDE MATERIAU
+#  Classes necessaires a INCLUDE MATERIAU
 # ----------------------------------------
     
 
@@ -119,7 +160,7 @@ class MATERIAUNode(MACRONode):
 
     def makeView(self) :
       if hasattr(self.item.object,'fichier_ini') and self.item.object.fichier_ini==None:
-         QMessageBox.information( self, "Include vide","L'include doit etre correctement initialisé pour etre visualisé")
+         QMessageBox.information( self,tr("Include vide"),tr("L'include doit etre correctement initialise pour etre visualise"))
          return
       f = open(self.item.object.fichier_ini, "rb")
       texte = f.read()
@@ -144,7 +185,7 @@ def treeitem(appli, labeltext, object, setfunction=None):
    """
    if object.nom == "INCLUDE_MATERIAU":
       return INCLUDE_MATERIAUTreeItem(appli, labeltext, object, setfunction)
-   elif object.nom == "INCLUDE":
+   elif object.nom == "INCLUDE" or object.nom== "DICTDATA":
       return INCLUDETreeItem(appli, labeltext, object, setfunction)
    elif object.nom == "POURSUITE":
       return POURSUITETreeItem(appli, labeltext, object, setfunction)