]> SALOME platform Git repositories - tools/eficas.git/commitdiff
Salome HOME
Add possibility to create new specialized file types
authorRenaud Barate <renaud.barate@edf.fr>
Tue, 24 Jan 2012 10:30:56 +0000 (10:30 +0000)
committerRenaud Barate <renaud.barate@edf.fr>
Tue, 24 Jan 2012 10:30:56 +0000 (10:30 +0000)
InterfaceQT4/monUniqueBasePanel.py
UiQT4/desUniqueBase.ui

index 3f2e60dfd5f371a1eb0ca823afef48b3ac159db7..5268ea9eaf1ccb0497056a2b6a12619592903ace 100644 (file)
@@ -86,24 +86,24 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
         icon = QIcon(self.RepIcon+"/image240.png")
         self.BSalome.setIcon(icon)
         mc = self.node.item.get_definition()
-        #if ( (self.node.item.get_nom() != "FileName" ) and ( mc.type[0]!="Fichier")) :
-        if mc.type[0] == "Fichier" or mc.type[0] == "FichierNoAbs":
+        mctype = mc.type[0]
+        if mctype == "Fichier" or mctype == "FichierNoAbs" or \
+            (hasattr(mctype, "enable_file_selection") and mctype.enable_file_selection):
            self.bParametres.close()
            self.BRepertoire.close()
-        elif mc.type[0] == "Repertoire":
+        elif mctype == "Repertoire":
            self.bParametres.close()
            self.BFichier.close()
         else :
            self.BFichier.close()
            self.BRepertoire.close()
-        type = mc.type[0]
         # TODO: Use type properties instead of hard-coded "grno" and "grma" type check
         enable_salome_selection = self.editor.salome and \
-            (('grma' in repr(type)) or ('grno' in repr(type)) or
-             (hasattr(type, "enable_salome_selection") and type.enable_salome_selection))
+            (('grma' in repr(mctype)) or ('grno' in repr(mctype)) or
+             (hasattr(mctype, "enable_salome_selection") and mctype.enable_salome_selection))
         if not enable_salome_selection:
            self.BSalome.close()
-        if not(('grma' in repr(type)) or ('grno' in repr(type))) or not(self.editor.salome) :
+        if not(('grma' in repr(mctype)) or ('grno' in repr(mctype))) or not(self.editor.salome):
            self.BView2D.close()
 
   def InitLineEditVal(self):
@@ -153,12 +153,14 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
         SaisieValeur.BOk2Pressed(self)
 
   def BFichierPressed(self):
-      type = self.node.item.get_definition().type
-      if len(type) > 1:
-          filters = type[1]
+      mctype = self.node.item.get_definition().type
+      if len(mctype) > 1:
+          filters = mctype[1]
+      elif hasattr(mctype[0], "filters"):
+          filters = mctype[0].filters
       else:
           filters = QString()
-      if len(type) > 2 and type[2] == "Sauvegarde":
+      if len(mctype) > 2 and mctype[2] == "Sauvegarde":
           fichier = QFileDialog.getSaveFileName(self.appliEficas,
                               self.appliEficas.trUtf8('Sauvegarder Fichier'),
                               self.appliEficas.CONFIGURATION.savedir,
@@ -173,6 +175,7 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
          ulfile = os.path.abspath(unicode(fichier))
          self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
          self.lineEditVal.setText(fichier)
+         self.Commentaire.setText(u"Fichier sélectionné")
          if (QFileInfo(fichier).suffix() in listeSuffixe ):
              self.image=fichier
              if (not hasattr(self,"BSelectInFile")):
@@ -218,7 +221,7 @@ class MonUniqueBasePanel(DUnBase,QTPanel,SaisieValeur):
   def BSalomePressed(self):
         self.Commentaire.setText(QString(""))
         genea=self.node.item.get_genealogie()
-        kwType = None
+        kwType = self.node.item.get_definition().type[0]
         for e in genea:
             if "GROUP_NO" in e: kwType = "GROUP_NO"
             if "GROUP_MA" in e: kwType = "GROUP_MA"
index f00fb15c1a8415a0aad8c510628aba37cacfa6f4..52468231e53074a218b5ac2725ce5e6613bedd0a 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>482</width>
-    <height>480</height>
+    <width>782</width>
+    <height>534</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -46,8 +46,8 @@
         </layout>
        </item>
        <item row="1" column="0">
-        <layout class="QGridLayout" name="gridLayout">
-         <item row="0" column="0">
+        <layout class="QHBoxLayout" name="horizontalLayout_3">
+         <item>
           <spacer name="horizontalSpacer_3">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
@@ -60,7 +60,7 @@
            </property>
           </spacer>
          </item>
-         <item row="0" column="1">
+         <item>
           <widget class="QPushButton" name="BSalome">
            <property name="minimumSize">
             <size>
@@ -77,8 +77,8 @@
            </property>
           </widget>
          </item>
-         <item row="0" column="2">
-          <widget class="QPushButton" name="bParametres">
+         <item>
+          <widget class="QPushButton" name="BView2D">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
              <horstretch>0</horstretch>
            <property name="minimumSize">
             <size>
              <width>140</width>
-             <height>45</height>
+             <height>40</height>
             </size>
            </property>
            <property name="text">
-            <string>Paramètres</string>
+            <string>Visualiser</string>
            </property>
           </widget>
          </item>
-         <item row="1" column="0">
-          <spacer name="horizontalSpacer_5">
-           <property name="orientation">
-            <enum>Qt::Horizontal</enum>
-           </property>
-           <property name="sizeHint" stdset="0">
-            <size>
-             <width>138</width>
-             <height>20</height>
-            </size>
-           </property>
-          </spacer>
-         </item>
-         <item row="1" column="1">
-          <widget class="QPushButton" name="BView2D">
-           <property name="sizePolicy">
-            <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
-             <horstretch>0</horstretch>
-             <verstretch>0</verstretch>
-            </sizepolicy>
-           </property>
+         <item>
+          <widget class="QPushButton" name="bParametres">
            <property name="minimumSize">
             <size>
              <width>140</width>
             </size>
            </property>
            <property name="text">
-            <string>Visualiser</string>
+            <string>Paramètres</string>
            </property>
           </widget>
          </item>
-         <item row="1" column="2">
+         <item>
           <widget class="QPushButton" name="BFichier">
            <property name="sizePolicy">
             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
            </property>
           </widget>
          </item>
-         <item row="2" column="2">
+         <item>
           <widget class="QPushButton" name="BRepertoire">
+           <property name="minimumSize">
+            <size>
+             <width>140</width>
+             <height>40</height>
+            </size>
+           </property>
            <property name="text">
             <string>Répertoire</string>
            </property>