Salome HOME
optim eciture
[tools/eficas.git] / InterfaceQT4 / compocomm.py
index 671bc67ec98c2bbb198c96f1f123fdd4c2623fe2..b7e4c800b27226a3a042d7b540f24658d9d94efa 100644 (file)
@@ -1,45 +1,46 @@
 # -*- 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 __future__ import absolute_import
 
-from PyQt4.QtGui import *
-from PyQt4.QtCore import *
-import string
+from PyQt5.QtWidgets import QAction
 
 from Editeur     import Objecttreeitem
-import browser
-import typeNode
+from . import browser
+from . 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)
+        self.Decommente.triggered.connect(self.Decommenter)
+        self.Decommente.setStatusTip(tr("Decommente la commande "))
 
         if hasattr(self.item,'uncomment'):
            self.menu.addAction(self.Decommente)
@@ -54,6 +55,7 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodePartiel):
         debComm=self.item.GetText()
         self.setText(1,debComm)
 
+
     
 class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
     itemNode=Node    
@@ -63,19 +65,19 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
 
     def GetIconName(self):
       """
-      Retourne le nom de l'icône associée au noeud qui porte self,
-      dépendant de la validité de l'objet
+      Retourne le nom de l'icone associee au noeud qui porte self,
+      dependant de la validite de l'objet
       NB : un commentaire est toujours valide ...
       """
       return "ast-white-percent"
 
     def GetLabelText(self):
         """ Retourne 3 valeurs :
-        - le texte à afficher dans le noeud représentant l'item
+        - le texte a afficher dans le noeud representant l'item
         - 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):
       """
@@ -85,7 +87,7 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
     
     def GetText(self):
         texte = self.object.valeur
-        texte = string.split(texte,'\n')[0]
+        texte = texte.split('\n')[0]
         if len(texte) < 25 :
             return texte
         else :
@@ -93,7 +95,7 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
 
     def set_valeur(self,valeur):
       """
-      Afecte valeur à l'objet COMMENTAIRE
+      Affecte valeur a l'objet COMMENTAIRE
       """
       self.object.set_valeur(valeur)
       
@@ -106,11 +108,11 @@ class COMMTreeItem(Objecttreeitem.ObjectTreeItem):
 
     def get_objet_commentarise(self):
        """
-           La méthode get_objet_commentarise() de la classe compocomm.COMMTreeItem
-           surcharge la méthode get_objet_commentarise de la classe Objecttreeitem.ObjectTreeItem
+           La methode get_objet_commentarise() de la classe compocomm.COMMTreeItem
+           surcharge la methode 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