Salome HOME
numero de version
[tools/eficas.git] / InterfaceQT4 / compocomm.py
index 671bc67ec98c2bbb198c96f1f123fdd4c2623fe2..118d13c664b903c86bf25ece014cc1328c4c4a04 100644 (file)
@@ -1,45 +1,52 @@
 # -*- coding: utf-8 -*-
-#            CONFIGURATION MANAGEMENT OF EDF VERSION
-# ======================================================================
-# COPYRIGHT (C) 1991 - 2002  EDF R&D                  WWW.CODE-ASTER.ORG
-# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY
-# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY
-# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR
-# (AT YOUR OPTION) ANY LATER VERSION.
+# Copyright (C) 2007-2013   EDF R&D
 #
-# THIS PROGRAM 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
-# GENERAL PUBLIC LICENSE FOR MORE DETAILS.
+# 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.
 #
-# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE
-# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER,
-#    1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE.
+# 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 PyQt4.QtGui import *
-from PyQt4.QtCore import *
 import string
 
+from determine import monEnvQT5
+if monEnvQT5 :
+  from PyQt5.QtWidgets import QAction
+else :
+  from PyQt4.QtGui import *
+  from PyQt4.QtCore import *
+
 from Editeur     import Objecttreeitem
 import browser
 import typeNode
+from Extensions.i18n import tr
+from Extensions.eficas_exception import EficasException
 
 
 class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
     def getPanel( self ):
         """
         """
-        from monCommentairePanel import MonCommentairePanel
-        return MonCommentairePanel(self,parent=self.editor)
+        from monWidgetCommentaire import MonWidgetCommentaire
+        return MonWidgetCommentaire(self,self.editor,self.item.object)
 
     def createPopUpMenu(self):
         typeNode.PopUpMenuNodePartiel.createPopUpMenu(self)
-        self.Decommente = QAction('Decommenter',self.tree)
-        self.tree.connect(self.Decommente,SIGNAL("activated()"),self.Decommenter)
-        self.Decommente.setStatusTip("Decommente la commande ")
+        self.Decommente = QAction(tr("Decommenter"),self.tree)
+        if monEnvQT5 : self.Decommente.triggered(self.Decommenter)
+        else         : self.tree.connect(self.Decommente,SIGNAL("triggered()"),self.Decommenter)
+        self.Decommente.setStatusTip(tr("Decommente la commande "))
 
         if hasattr(self.item,'uncomment'):
            self.menu.addAction(self.Decommente)
@@ -54,6 +61,7 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
         debComm=self.item.GetText()
         self.setText(1,debComm)
 
+
     
 class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
     itemNode=Node    
@@ -75,7 +83,7 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
         - la fonte dans laquelle afficher ce texte
         - la couleur du texte
         """
-        return 'commentaire'   #CS_pbruno,Fonte_Commentaire,None
+        return tr('Commentaire'),None,None
 
     def get_valeur(self):
       """
@@ -110,7 +118,7 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
            surcharge la méthode get_objet_commentarise de la classe Objecttreeitem.ObjectTreeItem
            elle a pour but d'empecher l'utilisateur final de commentariser un commentaire.
        """
-       raise Exception( 'Impossible de commentariser un commentaire' )
+       raise EficasException( 'Impossible de commentariser un commentaire' )
   
 import Extensions
 treeitem =COMMTreeItem