]> SALOME platform Git repositories - modules/eficas.git/commitdiff
Salome HOME
*** empty log message ***
authorPascale Noyret <pascale.noyret@edf.fr>
Tue, 10 Nov 2009 10:41:46 +0000 (10:41 +0000)
committerPascale Noyret <pascale.noyret@edf.fr>
Tue, 10 Nov 2009 10:41:46 +0000 (10:41 +0000)
InterfaceQT4/monOptions_CUVE2DG.py [new file with mode: 0644]
InterfaceQT4/qtEficas.py

diff --git a/InterfaceQT4/monOptions_CUVE2DG.py b/InterfaceQT4/monOptions_CUVE2DG.py
new file mode 100644 (file)
index 0000000..9cd8525
--- /dev/null
@@ -0,0 +1,199 @@
+# -*- coding: utf-8 -*-
+
+import os, re, sys
+
+from PyQt4.QtGui  import *
+from PyQt4.QtCore import *
+
+from OptionsCuve import Ui_desOptions
+
+
+class desOptions(Ui_desOptions,QDialog):
+   def __init__(self,parent ,modal ) :
+       QDialog.__init__(self,parent)
+       self.setupUi(self)
+       self.setModal(modal)
+
+class Options(desOptions):
+   def __init__(self,parent = None,modal = 0,configuration=None):
+       desOptions.__init__(self,parent,modal)
+       self.configuration=configuration
+       self.viewMan=parent
+       self.dVersion={}
+       self.dRepCat={}
+       self.connecterSignaux()
+       self.initAll()
+  
+   def connecterSignaux(self) :
+       self.connect(self.CBVersions,SIGNAL("activated(int)"),self.VersionChoisie)
+       self.connect(self.Bdefaut,SIGNAL("clicked()"),self.BdefautChecked)
+       self.connect(self.LEVersionAjout,SIGNAL("returnPressed()"),self.AjoutVersion)
+       self.connect(self.PBajout,SIGNAL("clicked()"),self.AjoutVersion)
+       self.connect(self.LEVersionSup,SIGNAL("returnPressed()"),self.SupVersion)
+       self.connect(self.PBSup,SIGNAL("clicked()"),self.SupVersion)
+       self.connect(self.LERepDoc,SIGNAL("returnPressed()"),self.ChangePathDoc)
+       self.connect(self.LERepCata,SIGNAL("returnPressed()"),self.BokClicked)
+       self.connect(self.LESaveDir,SIGNAL("returnPressed()"),self.ChangeSaveDir)
+       self.connect(self.Bok,SIGNAL("clicked()"),self.BokClicked)
+       self.connect(self.PBQuit,SIGNAL("clicked()"),self.close)
+
+
+   def initAll(self):
+       self.CBVersions.clear()
+       for item in self.configuration.catalogues :
+           try :
+              (code,version,cata,format,defaut)=item
+           except :
+              (code,version,cata,format)=item
+           self.dVersion[version]=(item)
+           self.dRepCat[version]=str(cata)
+           self.CBVersions.addItem(QString(version))
+       self.LERepCata.setText(self.dRepCat[version])
+
+       if hasattr(self.configuration,"path_doc"):
+          self.LERepDoc.setText(self.configuration.path_doc)
+       if hasattr(self.configuration,"savedir"):
+          self.LESaveDir.setText(self.configuration.savedir)
+
+
+        
+   def VersionChoisie(self):
+       version=str(self.CBVersions.currentText())
+       if self.dRepCat.has_key(version):
+          self.LERepCata.setText(self.dRepCat[version])
+
+   def BokClicked(self):
+       version=str(self.CBVersions.currentText())
+       if self.LERepCata.text() == "" :
+          QMessageBox.critical( self, "Champ non rempli","Le champ Catalogue  doit etre rempli" )
+          return
+       if not os.path.isfile(self.LERepCata.text()) :
+          res = QMessageBox.warning( None,
+                 self.trUtf8("Fichier Catalogue "),
+                 self.trUtf8("Le Fichier  n existe pas. Voulez-vous supprimer cette version ?"),
+                 self.trUtf8("&Oui"),
+                 self.trUtf8("&Non"))
+          if res == 0 :
+             self.LEVersionSup.setText(version)
+             self.SupVersion()
+             return
+
+       self.dRepCat[version]=str(self.LERepCata.text())
+       if version in self.dVersion.keys():
+          item=list(self.dVersion[version])
+          item[2]=self.dRepCat[version]
+          self.dVersion[version]=tuple(item)
+       else :
+          import prefs
+          code=prefs.code
+          self.dVersion[version]=(code,version,self.dRepCat[version],code.lower())
+          
+       lItem=[]
+       for version in self.dVersion.keys() :
+          lItem.append(self.dVersion[version])
+       self.configuration.catalogues=lItem
+       self.configuration.save_params()
+
+   def AjoutVersion(self):
+       version=self.LEVersionAjout.text()
+       if str(version) == "" : return
+       self.CBVersions.addItem(version)
+       self.LERepCata.setText("")
+       self.LEVersionAjout.setText("")
+       self.CBVersions.setCurrentIndex(self.CBVersions.count()-1)
+
+   def SupVersion(self):
+       version=str(self.LEVersionSup.text())
+       if version == "" : return
+       i =0
+       while i < self.CBVersions.count() :
+           if  self.CBVersions.itemText(i) == version :
+               self.CBVersions.removeItem(i)
+               break
+           i=i+1
+       try :
+          del self.dVersion[version]
+          del self.dRepCat[version]
+       except :
+          self.LEVersionSup.setText("")
+          try :
+             self.CBVersions.setCurrentIndex(self.CBVersions.count()-1)
+             self.VersionChoisie()
+          except :
+             pass
+          return
+       codeSansPoint=re.sub("\.","",version)
+       chaine="rep_mat_"+codeSansPoint
+       if hasattr(self.configuration,chaine):
+          delattr(self.configuration,chaine)
+       self.LEVersionSup.setText("")
+
+       lItem=[]
+       for version in self.dVersion.keys() :
+           lItem.append(self.dVersion[version])
+       self.LERepCata.setText("")
+       self.configuration.catalogues=lItem
+       self.configuration.save_params()
+       self.CBVersions.setCurrentIndex(0)
+       self.VersionChoisie()
+
+
+   def BdefautChecked(self):
+       res = QMessageBox.warning( None,
+                 self.trUtf8("Restauration des parametres par defaut "),
+                 self.trUtf8("Votre fichier editeur sera ecrase."),
+                 self.trUtf8("&Ok"),
+                 self.trUtf8("&Abandonner"))
+       self.Bdefaut.setCheckState(Qt.Unchecked)
+       if res == 1 : return 
+
+       appli=self.configuration.appli
+       fic_ini_util=self.configuration.fic_ini_utilisateur
+       old_fic_ini_util=fic_ini_util+"_old"
+       commande="mv "+fic_ini_util+" "+old_fic_ini_util
+       os.system(commande)
+       import prefs
+       name='prefs_'+prefs.code
+       prefsCode=__import__(name)
+       repIni=prefsCode.REPINI
+       nameConf='configuration_'+prefs.code
+       configuration=__import__(nameConf)
+
+       configNew=configuration.CONFIG(appli,repIni)
+       self.configuration=configNew
+       appli.CONFIGURATION=configNew
+       self.configuration.save_params()
+       self.dVersion={}
+       self.dRepCat={}
+       self.initAll()
+
+   def ChangePathDoc(self):
+       if self.LERepDoc.text()=="" : return
+       if not os.path.isdir(self.LERepDoc.text()) :
+          res = QMessageBox.warning( None,
+                 self.trUtf8("Repertoire de Documentation "),
+                 self.trUtf8("Le Repertoire  n existe pas."),
+                 self.trUtf8("&Ok"),
+                 self.trUtf8("&Abandonner"))
+          if res == 1 :
+             if hasattr(self.configuration,"path_doc"):
+                self.LERepDoc.setText(self.configuration.path_doc)
+             return
+
+       self.configuration.path_doc=str(self.LERepDoc.text())
+       self.configuration.save_params()
+
+
+   def ChangeSaveDir(self):
+       if not os.path.isdir(self.LESaveDir.text()) :
+          res = QMessageBox.warning( None,
+                 self.trUtf8("Repertoire De Sauvegarde "),
+                 self.trUtf8("Le Repertoire " + self.LESaveDir.text() +" n existe pas."),
+                 self.trUtf8("&Ok"),
+                 self.trUtf8("&Abandonner"))
+          if res == 1 :
+             if hasattr(self.configuration,"savedir"):
+                self.LESaveDir.setText(self.configuration.savedir)
+       self.configuration.savedir=str(self.LESaveDir.text())
+       self.configuration.save_params()
+
index 79941b2bc0d24f76bd61fd7a3ff0096e74927c71..ecc401eb40e79843b22e20985182e7c67fff904c 100644 (file)
@@ -28,6 +28,8 @@ class Appli(Ui_Eficas,QMainWindow):
         self.QWParent=None #(Pour lancement sans IHM)
         self.indice=0
         self.dict_reels={}
+        self.OTunite=700
+        print "appliiiiiiiiiiiiiiiiii" , self
 
         import prefs
         if salome :