]> SALOME platform Git repositories - modules/eficas.git/commitdiff
Salome HOME
Added parameter to type "Fichier" to allow files to save (unexisting files)
authorRenaud Barate <renaud.barate@edf.fr>
Mon, 10 May 2010 12:57:44 +0000 (12:57 +0000)
committerRenaud Barate <renaud.barate@edf.fr>
Mon, 10 May 2010 12:57:44 +0000 (12:57 +0000)
InterfaceQT4/monUniqueBasePanel.py
Noyau/N_VALIDATOR.py

index 39d226c39f7f18ba987b926c319851b4a946d57b..8906e1b298b61a0afaedd3f1ba43bc4a191c0130 100644 (file)
@@ -127,10 +127,17 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
             filters = type[1]
         else:
             filters = QString()
-        fichier = QFileDialog.getOpenFileName(self.appliEficas,
-                          self.appliEficas.trUtf8('Ouvrir Fichier'),
-                          self.appliEficas.CONFIGURATION.savedir,
-                          filters)
+        if len(type) > 2 and type[2] == "Sauvegarde":
+            fichier = QFileDialog.getSaveFileName(self.appliEficas,
+                              self.appliEficas.trUtf8('Sauvegarder Fichier'),
+                              self.appliEficas.CONFIGURATION.savedir,
+                              filters)
+        else:
+            fichier = QFileDialog.getOpenFileName(self.appliEficas,
+                              self.appliEficas.trUtf8('Ouvrir Fichier'),
+                              self.appliEficas.CONFIGURATION.savedir,
+                              filters)
+
         if not(fichier.isNull()):
            self.lineEditVal.setText(fichier)
          
index 57b0de9dec5c812485b9a19d65432b220a8a00c1..c7e65b94af7f328930e24b70247899d252e8fb49 100644 (file)
@@ -128,8 +128,15 @@ class TypeProtocol(PProtocol):
                 if self.is_object_from(obj,type_permis):return obj
             elif type_permis == 'Fichier' :
                  import os
-                 if os.path.isfile(obj):return obj
-                 else : raise ValError("%s n'est pas un fichier valide" % repr(obj))
+                 if len(typ) > 2 and typ[2] == "Sauvegarde":
+                     if os.path.isdir(os.path.dirname(obj)):
+                         return obj
+                     else:
+                         raise ValError("%s n'est pas un répertoire valide" %
+                                        os.path.dirname(obj))
+                 else:
+                     if os.path.isfile(obj):return obj
+                     else : raise ValError("%s n'est pas un fichier valide" % repr(obj))
             elif type(type_permis) == types.InstanceType or isinstance(type_permis,object):
                 try:
                     if type_permis.__convert__(obj) : return obj