Salome HOME
Select Valeur dans un fichier
authorpascale.noyret <pascale.noyret@edf.fr>
Thu, 1 Oct 2015 09:23:49 +0000 (11:23 +0200)
committerpascale.noyret <pascale.noyret@edf.fr>
Thu, 1 Oct 2015 09:23:49 +0000 (11:23 +0200)
InterfaceQT4/browser.py
InterfaceQT4/compojdc.py
InterfaceQT4/gereListe.py
InterfaceQT4/monWidgetPlusieursTuple.py
UiQT4/desSelectVal.ui

index 302719f23a2a4230692e5d67a3d4a61d13c5cb0c..595a45c45c61c64c35a66c8be49083e09922f60d 100644 (file)
@@ -232,6 +232,7 @@ class JDCNode(QTreeWidgetItem,GereRegles):
         self.item.connect("valid",self.onValid,())
         self.item.connect("supp" ,self.onSupp,())
         self.item.connect("add"  ,self.onAdd,())
+
         self.state=""
         self.fenetre=None
         try :
@@ -518,7 +519,11 @@ class JDCNode(QTreeWidgetItem,GereRegles):
         if self.item.nom == "VARIABLE" :
            recalcule=1
            jdc=self.item.jdc
-        ret=self.vraiParent.item.suppitem(self.item)
+        ret,commentaire=self.vraiParent.item.suppitem(self.item)
+        if ret==0 :
+          self.editor.affiche_infos(commentaire,Qt.red)
+        else :
+          self.editor.affiche_infos(commentaire)
         self.treeParent.build_children()
         if self.treeParent.childrenComplete : toselect=self.treeParent.childrenComplete[index]
         else: toselect=self.treeParent
index 3791bc78f7bffb43ae051d34b28d750758574c27..26a0570bd36278ccae58bbbb4b5893c38e2e02d0 100644 (file)
@@ -94,11 +94,10 @@ class JDCTreeItem(Objecttreeitem.ObjectTreeItem):
           message = tr("Commentaire supprime")
        else :
           message = tr("Commande %s supprimee",itemobject.nom)
-       self.editor.affiche_commentaire(message)
-       return 1
+       return 1,message
     else:
-       self.editor.affiche_infos(tr("Pb interne : impossible de supprimer cet objet"),Qt.red)
-       return 0
+       message=tr("Pb interne : impossible de supprimer cet objet")
+       return 0,message
 
   def GetSubList(self):
     """
index b86bf1b999627d3cb8cb8c486e6de57f7ac92c10..518b24e6d8368d936f143fe360c6560afdb6079f 100644 (file)
@@ -144,11 +144,15 @@ class GereListe:
          for i in range (self.NumLineEditEnCours, self.indexDernierLabel):
              aRemonter=i+1
              nomLineEdit=self.nomLine+str(aRemonter)
+             print nomLineEdit
              courant=getattr(self,nomLineEdit)
              valeurARemonter=courant.getValeur()
+             print valeurARemonter
              nomLineEdit=self.nomLine+str(i)
+             print nomLineEdit
              courant=getattr(self,nomLineEdit)
-             courant.setValeur(valeurARemonter)
+             if valeurARemonter != None : courant.setValeur(valeurARemonter)
+             else : courant.clean()
          nomLineEdit=self.nomLine+str(self.indexDernierLabel)
          courant=getattr(self,nomLineEdit)
          courant.clean()
index 64af770a6df33fe42815147263b9aee7c18c0c78..a928d7579f5730a6ead5e350dd35ecd02e9376f2 100644 (file)
@@ -126,7 +126,6 @@ class MonWidgetPlusieursTuple(Feuille,GereListe):
 
   def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
         self.indexDernierLabel=0
-        self.NumLineEditEnCours=0
         self.nomLine="TupleVal"
         self.listeAffichageWidget=[]
         Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
@@ -146,6 +145,7 @@ class MonWidgetPlusieursTuple(Feuille,GereListe):
           icon3 = QIcon(fichier3)
           self.BSelectFichier.setIcon(icon3)
           self.BSelectFichier.setIconSize(QSize(32, 32))
+        self.connect(self.BSelectFichier,SIGNAL("clicked()"), self.selectInFile)
           
         
 
@@ -240,7 +240,37 @@ class MonWidgetPlusieursTuple(Feuille,GereListe):
          except :
            pass
           
+  def AjoutNValeur(self,liste):
+        if len(liste)%self.nbValeurs != 0 :
+           texte="Nombre de valeur incorrecte"
+           #self.Commentaire.setText(texte)
+           self.editor.affiche_infos(texte,Qt.red)
+           return
+        i=0
+        while ( i < len(liste) ) :
+            if self.objSimp.valeur != None : indexDernierRempli=len(self.objSimp.valeur)
+            else : indexDernierRempli=0
+            try :
+              t=tuple(liste[i:i+self.nbValeurs])
+              i=i+self.nbValeurs
+            except:
+              t=tuple(liste[i:len(liste)])
+            if indexDernierRempli < self.indexDernierLabel:
+               nomLineEdit=self.nomLine+str(indexDernierRempli+1)
+               LEARemplir=getattr(self,nomLineEdit) 
+               LEARemplir.lineEditVal_1.setText(str(t[0]))
+               LEARemplir.lineEditVal_2.setText(str(t[1]))
+               if self.nbValeurs== 3 : LEARemplir.lineEditVal_3.setText(str(t[2]))
+               LEARemplir.valueChange()
+            else : 
+               self.ajoutLineEdit(t,False)
+               nomLineEdit=self.nomLine+str(self.indexDernierLabel)
+               LEARemplir=getattr(self,nomLineEdit) 
+               LEARemplir.valueChange()
+
+
   def RBListePush(self):
+  # PN a rendre generique avec un truc tel prerempli
       if self.objSimp.valeur != None and self.objSimp.valeur != [] : return
       if self.objSimp.definition.validators.typeDesTuples[0]==self.editor.readercata.cata[0].sd_ligne :
          val=[]
@@ -278,3 +308,4 @@ class MonWidgetPlusieursTuple(Feuille,GereListe):
               except :
                pass
          self.node.item.set_valeur(val)
+
index d8841e108fcf68960cdc44ffa11de91a8bec15a6..34baf93adcfdfb5aa7003d5dd6b2de48c78ffe44 100644 (file)
@@ -6,13 +6,22 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>458</width>
-    <height>561</height>
+    <width>633</width>
+    <height>705</height>
    </rect>
   </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
   <property name="windowTitle">
    <string>Sélection de valeurs</string>
   </property>
+  <property name="styleSheet">
+   <string notr="true">background:rgb(235,235,235)</string>
+  </property>
   <layout class="QVBoxLayout" name="verticalLayout_3">
    <item>
     <widget class="QTextEdit" name="TBtext">
@@ -22,6 +31,9 @@
        <height>400</height>
       </size>
      </property>
+     <property name="styleSheet">
+      <string notr="true">background:rgb(250,250,250)</string>
+     </property>
     </widget>
    </item>
    <item>
@@ -29,6 +41,9 @@
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::Fixed</enum>
+     </property>
      <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
       <widget class="QGroupBox" name="BGSeparateur">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="minimumSize">
+        <size>
+         <width>280</width>
+         <height>150</height>
+        </size>
+       </property>
        <property name="title">
         <string>Separateur</string>
        </property>
-       <layout class="QVBoxLayout" name="verticalLayout">
-        <property name="spacing">
+       <layout class="QVBoxLayout" name="verticalLayout_4">
+        <property name="topMargin">
+         <number>15</number>
+        </property>
+        <property name="bottomMargin">
          <number>0</number>
         </property>
         <item>
-         <widget class="QRadioButton" name="Bespace">
-          <property name="text">
-           <string>espace</string>
+         <spacer name="verticalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Vertical</enum>
           </property>
-          <property name="checked">
-           <bool>true</bool>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
           </property>
-         </widget>
-        </item>
-        <item>
-         <widget class="QRadioButton" name="Bvirgule">
-          <property name="text">
-           <string>virgule</string>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>20</width>
+            <height>7</height>
+           </size>
           </property>
-         </widget>
+         </spacer>
         </item>
         <item>
-         <widget class="QRadioButton" name="BpointVirgule">
-          <property name="text">
-           <string>point-virgule</string>
+         <layout class="QVBoxLayout" name="verticalLayout">
+          <property name="spacing">
+           <number>0</number>
           </property>
-         </widget>
+          <property name="sizeConstraint">
+           <enum>QLayout::SetFixedSize</enum>
+          </property>
+          <item>
+           <widget class="QRadioButton" name="Bespace">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="text">
+             <string>espace</string>
+            </property>
+            <property name="checked">
+             <bool>true</bool>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="Bvirgule">
+            <property name="text">
+             <string>virgule</string>
+            </property>
+           </widget>
+          </item>
+          <item>
+           <widget class="QRadioButton" name="BpointVirgule">
+            <property name="text">
+             <string>point-virgule</string>
+            </property>
+           </widget>
+          </item>
+         </layout>
         </item>
        </layout>
       </widget>
      </item>
      <item>
       <layout class="QVBoxLayout" name="verticalLayout_2">
+       <property name="spacing">
+        <number>0</number>
+       </property>
        <item>
-        <widget class="QPushButton" name="BImportSel">
+        <spacer name="verticalSpacer">
          <property name="minimumSize">
           <size>
-           <width>0</width>
+           <width>23</width>
+           <height>43</height>
+          </size>
+         </property>
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>40</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="QPushButton" name="BImportTout">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
+         <property name="minimumSize">
+          <size>
+           <width>200</width>
+           <height>40</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>200</width>
            <height>40</height>
           </size>
          </property>
@@ -105,15 +204,27 @@ border-radius : 12px
 </string>
          </property>
          <property name="text">
-          <string>Ajouter Selection</string>
+          <string>Importer Tout</string>
          </property>
         </widget>
        </item>
        <item>
-        <widget class="QPushButton" name="BImportTout">
+        <widget class="QPushButton" name="BImportSel">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
+         </property>
          <property name="minimumSize">
           <size>
-           <width>0</width>
+           <width>200</width>
+           <height>40</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>200</width>
            <height>40</height>
           </size>
          </property>
@@ -124,7 +235,7 @@ border-radius : 12px
 </string>
          </property>
          <property name="text">
-          <string>Importer Tout</string>
+          <string>Ajouter Selection</string>
          </property>
         </widget>
        </item>