]> SALOME platform Git repositories - tools/eficas.git/blobdiff - InterfaceQT4/gereIcones.py
Salome HOME
onItem=Deplie
[tools/eficas.git] / InterfaceQT4 / gereIcones.py
index 718626b3fd772f38476d5ca50385c9c12c18ed01..8a5f69abbd8277afa217bd0c6847f48442686ccd 100644 (file)
@@ -18,7 +18,7 @@
 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 #
 # Modules Python
-import string,types,os,re
+import string,types,os,re,sys
 import traceback
 
 from PyQt4 import *
@@ -31,15 +31,18 @@ listeSuffixe=('bmp','png','jpg' ,'txt','med')
 class FacultatifOuOptionnel:
 
   def setReglesEtAide(self):
-      from monWidgetCommande import MonWidgetCommande
       listeRegles=()
       try :
          listeRegles     = self.node.item.get_regles()
       except :
          pass
-      if listeRegles==() and hasattr(self,"RBRegle"): self.RBRegle.close() 
+      if hasattr(self,"RBRegle"):
+        if listeRegles==() : self.RBRegle.close() 
+        else : self.connect( self.RBRegle,SIGNAL("clicked()"),self.viewRegles)
+
       cle_doc=None
       if not hasattr(self,"RBInfo"):return
+      from monWidgetCommande import MonWidgetCommande
       if isinstance(self,MonWidgetCommande) and self.editor.code =="MAP":
          self.cle_doc = self.chercheDocMAP()
       else :
@@ -63,11 +66,15 @@ class FacultatifOuOptionnel:
  
   def viewDoc(self):
       try :
-          cmd="xdg-open "+self.cle_doc
+          if sys.platform[0:5]=="linux" : cmd="xdg-open "+self.cle_doc
+          else                                 : cmd="start "+self.cle_doc
           os.system(cmd)
       except:
           QMessageBox.warning( self,tr( "Aide Indisponible"),tr( "l'aide n est pas installee "))
 
+  def viewRegles(self):
+      self.node.AppelleBuildLBRegles()
+
 
   def setIconePoubelle(self):
       if not(hasattr(self,"RBPoubelle")):return
@@ -129,22 +136,23 @@ class FacultatifOuOptionnel:
       #print " c est le moment de gerer le passage au suivant"
       if not(hasattr (self,'RBValide')) : return
       icon = QIcon()
+      repIcon=os.path.join(os.path.abspath(os.path.dirname(__file__)),'../Editeur/icons')
       if self.node.item.object.isvalid() : 
-         icon=QIcon(self.repIcon+"/ast-green-ball.png")
+         icon=QIcon(repIcon+"/ast-green-ball.png")
       else :
-         icon=QIcon(self.repIcon+"/ast-red-ball.png")
+         icon=QIcon(repIcon+"/ast-red-ball.png")
       self.RBValide.setIcon(icon)
 
   # il faut chercher la bonne fenetre
   def rendVisible(self):
-      print "je passe par rendVisible de FacultatifOuOptionnel"
-      print self
-      print self.node.fenetre
-      print "return pour etre sure"
+      #print "je passe par rendVisible de FacultatifOuOptionnel"
+      #print self
+      #print self.node.fenetre
+      #print "return pour etre sure"
       return
       #PNPN
       newNode=self.node.treeParent.chercheNoeudCorrespondant(self.node.item.object)
-      print newNode
+      #print newNode
       self.editor.fenetreCentraleAffichee.scrollAreaCommandes.ensureWidgetVisible(newNode.fenetre)
       #newNode.fenetre.setFocus()
 
@@ -154,10 +162,13 @@ class ContientIcones:
   def BFichierVisu(self):
        fichier=self.lineEditVal.text()
        if fichier == None or str(fichier)=="" : return
-       from qtCommun import ViewText
+       from monViewTexte import ViewText
        try :
-         cmd="xdg-open "+str(fichier)
-         os.system(cmd)
+         if sys.platform[0:5]=="linux" :
+           cmd="xdg-open "+ str(fichier)
+           os.system(cmd)
+         else                         :
+           os.startfile(str(fichier)) 
        except:
          try :
             fp=open(fichier)
@@ -195,7 +206,7 @@ class ContientIcones:
          ulfile = os.path.abspath(unicode(fichier))
          self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
          self.lineEditVal.setText(fichier)
-         self.editor.affiche_infos(tr("Fichier selectionne"))
+         self.editor.affiche_commentaire(tr("Fichier selectionne"))
          self.LEValeurPressed()
          if (QFileInfo(fichier).suffix() in listeSuffixe ):
              self.image=fichier
@@ -229,7 +240,7 @@ class ContientIcones:
           
 
   def BSalomePressed(self):
-        self.editor.affiche_infos(QString(""))
+        self.editor.affiche_commentaire(QString(""))
         selection=[]
         commentaire=""
         genea=self.node.item.get_genealogie()
@@ -278,7 +289,7 @@ class ContientIcones:
         if valeur :
            ok, msgError = self.appliEficas.displayShape(valeur)
            if not ok:
-              self.appliEficas.affiche_infos(msgError,Qt.red)
+              self.editor.affiche_infos(msgError,Qt.red)
 
   def BParametresPressed(self):
         liste=self.node.item.get_liste_param_possible()