]> SALOME platform Git repositories - modules/eficas.git/commitdiff
Salome HOME
ajout Matrice
authorpascale.noyret <pascale.noyret@edf.fr>
Tue, 26 May 2015 14:22:15 +0000 (16:22 +0200)
committerpascale.noyret <pascale.noyret@edf.fr>
Tue, 26 May 2015 14:22:15 +0000 (16:22 +0200)
InterfaceQT4/composimp.py
InterfaceQT4/monWidgetMatrice.py [new file with mode: 0644]
UiQT4/CMakeLists.txt
UiQT4/desWidgetMatrice.ui [new file with mode: 0644]
UiQT4/desWidgetUniqueSDCO.ui [new file with mode: 0644]
UiQT4/makefile

index f97c0a95c7d2c0bdbe5f27fc111f81333861b1f2..d0c1641de62a653bb72f6001f0c40bf43d342e1d 100644 (file)
@@ -130,7 +130,12 @@ class Node(browser.JDCNode,typeNode.PopUpMenuNodeMinimal):
       # Attention l ordre des if est important
       # Attention il faut gerer les blocs et les facteurs 
       # a gerer comme dans composimp
-      # Gerer les matrices --> Actuellement pas dans ce type de panneau
+      # Gestion des matrices
+        if self.item.wait_matrice ():
+         from monWidgetMatrice import MonWidgetMatrice
+          widget=MonWidgetMatrice(self,maDefinition,monNom,monObjet,parentQt,maCommande)
+          self.widget=widget
+          return widget
 
         #print "____________________________", monNom, self.item.wait_co() 
         #print "____________________________", monNom, self.item.wait_assd() 
diff --git a/InterfaceQT4/monWidgetMatrice.py b/InterfaceQT4/monWidgetMatrice.py
new file mode 100644 (file)
index 0000000..c74491e
--- /dev/null
@@ -0,0 +1,176 @@
+# -*- coding: utf-8 -*-
+# Copyright (C) 2007-2013   EDF R&D
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+#
+# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+#
+# Modules Python
+import string,types,os
+
+# Modules Eficas
+from PyQt4.QtGui     import *
+from PyQt4.QtCore    import *
+from Extensions.i18n import tr
+from feuille         import Feuille
+
+
+from desWidgetMatrice  import Ui_desWidgetMatrice 
+
+
+class MonWidgetMatrice (Ui_desWidgetMatrice,Feuille):
+# c est juste la taille des differents widgets de base qui change
+
+  def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
+        Feuille.__init__(self,node,monSimpDef,nom,objSimp,parentQt,commande)
+        self.monType= self.node.item.object.definition.type[0]
+        parentQt.commandesLayout.insertWidget(-1,self)
+        self.nbLigs=0
+        self.nbCols=0
+        self.nomVariables={}
+        self.creeColonnes()
+        self.connecterSignaux()
+        if self.node.item.get_valeur()== None:  self.initialSsValeur()
+        else :
+           try    : self.initialValeur()
+           except : self.initialSsValeur()
+
+
+  def connecterSignaux(self) :
+      self.connect(self.TBMatrice,SIGNAL("itemChanged(QTableWidgetItem *)"),self.itemChanged)
+
+  def itemChanged(self):
+      monItem=self.TBMatrice.currentItem()
+      if monItem==None : return
+      texte=monItem.text()
+      if texte=="" : return
+      val,ok=texte.toDouble() 
+      if ok == False :
+       self.editor.affiche_infos(tr("Entrer un float SVP"),Qt.red)
+        monItem.setText("")
+        return
+      if self.monType.valSup != None :
+         if val > self.monType.valSup :
+           self.editor.affiche_infos(tr("Entrer un float inferieur a ") + repr(self.monType.valSup),Qt.red)
+            monItem.setText("")
+            return
+      if self.monType.valMin != None :
+         if val < self.monType.valMin :
+           self.editor.affiche_infos(tr("Entrer un float superieur a ") + repr(self.monType.valMin),Qt.red)
+            monItem.setText("")
+            return
+      self.editor.affiche_infos("")
+      if self.monType.structure != None: apply (MonWidgetMatrice.__dict__[self.monType.structure],(self,))
+      self.acceptVal()
+
+
+  def symetrique(self):
+      monItem=self.TBMatrice.currentItem()
+      texte=monItem.text()
+      if monItem.row() != monItem.column():
+         print monItem.row(), monItem.column()
+         monItemSym=self.TBMatrice.item(monItem.column(), monItem.row())
+         monItemSym.setText(texte)
+
+  def creeColonnes(self):
+      if self.monType.methodeCalculTaille != None :
+        #try:
+         if 1 :
+           apply (MonWidgetMatrice.__dict__[self.monType.methodeCalculTaille],(self,))
+         else :
+         #except :
+           QMessageBox.critical( self, tr("Mauvaise execution "),tr( "impossible d executer la methode ") + monType.methodeCalculTaille )
+           return
+      else :
+         self.nbLigs=self.monType.nbLigs
+         self.nbCols=self.monType.nbCols
+
+
+  def  NbDeVariables(self):
+       jdc=self.node.item.object.jdc
+       etape=self.node.item.object.etape
+       self.listeVariables=jdc.get_variables(etape)
+       if self.listeVariables == [] :
+           QMessageBox.critical( self, tr("Mauvaise Commande "),tr( "Aucune variable connue"))
+           return
+       self.TBMatrice.setColumnCount(len(self.listeVariables))
+       self.TBMatrice.setRowCount(len(self.listeVariables))
+       self.nbLigs=len(self.listeVariables)
+       self.nbCols=len(self.listeVariables)
+
+  def  NbDeDistributions(self):
+       jdc=self.node.item.object.jdc
+       etape=self.node.item.object.etape
+       self.listeVariables=jdc.get_distributions(etape)
+       if self.listeVariables == [] :
+           QMessageBox.critical( self, tr("Mauvaise Commande "),tr( "Aucune variable connue"))
+           return
+       self.TBMatrice.setColumnCount(len(self.listeVariables))
+       self.TBMatrice.setRowCount(len(self.listeVariables))
+       self.nbLigs=len(self.listeVariables)
+       self.nbCols=len(self.listeVariables)
+
+  def  initialSsValeur(self):
+       for row in range(self.nbLigs):
+          for column in range(self.nbCols):
+              if row == column :
+                 initialFloat=1
+               else :
+                 initialFloat=0
+               self.TBMatrice.setItem(row,column,QTableWidgetItem(str(initialFloat)))
+       header=QStringList()
+       for var in self.listeVariables :
+          header << var
+       self.TBMatrice.setVerticalHeaderLabels(header)
+       self.TBMatrice.setHorizontalHeaderLabels(header)
+
+  def  initialValeur(self):
+      liste=self.node.item.get_valeur()
+      dejaAffiche=0
+      if (len(liste)) != self.nbLigs +1  :
+         QMessageBox.critical( self,tr( "Mauvaise dimension de matrice"),tr( "le nombre de ligne n est pas egal a ") + str(self.nbLigs))
+         dejaAffiche=1
+      for i in range(self.nbLigs):
+          inter=liste[i+1]
+          if (len(inter)) != self.nbCols and (dejaAffiche == 0 ) :
+             QMessageBox.critical( self, tr("Mauvaise dimension de matrice"), tr("le nombre de colonne n est pas egal a ") + str(self.nbCols))
+             dejaAffiche=1
+          for j in range(self.nbCols):
+              self.TBMatrice.setItem(i,j,QTableWidgetItem(str(liste[i+1][j])))
+      header=QStringList()
+      for var in liste[0]:
+          header << var
+      self.TBMatrice.setVerticalHeaderLabels(header)
+      self.TBMatrice.setHorizontalHeaderLabels(header)
+              
+  def acceptVal(self):
+      liste=[]
+      liste.append(self.listeVariables)
+      if self.TBMatrice.rowCount() != self.nbLigs :
+         QMessageBox.critical( self, tr("Mauvaise dimension de matrice"),tr( "le nombre de ligne n est pas egal a ") + str(self.nbLigs))
+      if self.TBMatrice.columnCount() != self.nbCols :
+         QMessageBox.critical( self, tr("Mauvaise dimension de matrice"), tr("le nombre de colonne n est pas egal a ") + str(self.nbCols))
+      for i in range(self.nbLigs):
+          listeCol=[]
+          for j in range(self.nbCols):
+              monItem=self.TBMatrice.item(i,j)       
+              texte=monItem.text()
+              val,ok=texte.toDouble() 
+              if ok == False :
+                 QMessageBox.critical( self, tr("Mauvaise Valeur"),tr( "l element ") + str(i) + "," +str(j) +tr("n est pas correct"))
+              listeCol.append(val)
+          liste.append(listeCol)
+      # on ajoute l ordre des variables aux valeurs
+      self.node.item.set_valeur(liste)
index 6469948a989e261155e6e43b9e361a3f8524eb78..23fcb7b943118656978344f3f90445f7115d5bec 100644 (file)
@@ -52,6 +52,7 @@ eficas_compile_ui ( desWidgetFact.ui )
 eficas_compile_ui ( desWidgetFactPlie.ui )
 eficas_compile_ui ( desWidgetHeure.ui )
 eficas_compile_ui ( desWidgetInformation.ui )
+eficas_compile_ui ( desWidgetMatrice.ui )
 eficas_compile_ui ( desWidgetParam.ui )
 eficas_compile_ui ( desWidgetPlusieursBase.ui )
 eficas_compile_ui ( desWidgetPlusieursInto.ui )
diff --git a/UiQT4/desWidgetMatrice.ui b/UiQT4/desWidgetMatrice.ui
new file mode 100644 (file)
index 0000000..ac04cd8
--- /dev/null
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>desWidgetMatrice</class>
+ <widget class="QDialog" name="desWidgetMatrice">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>802</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Dialog</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <property name="spacing">
+      <number>0</number>
+     </property>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_2">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <property name="sizeConstraint">
+        <enum>QLayout::SetFixedSize</enum>
+       </property>
+       <item>
+        <spacer name="horizontalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>21</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="MonBoutonValide" name="RBValide">
+         <property name="minimumSize">
+          <size>
+           <width>21</width>
+           <height>25</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>21</width>
+           <height>25</height>
+          </size>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::ClickFocus</enum>
+         </property>
+         <property name="toolTip">
+          <string>Affiche le rapport de validation du mot-clef</string>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">border : 0px</string>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="icon">
+          <iconset>
+           <normaloff>../../../../../../home/A96028/GitEficasTravail/eficas/Editeur/icons/ast-green-ball.png</normaloff>../../../../../../home/A96028/GitEficasTravail/eficas/Editeur/icons/ast-green-ball.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>25</width>
+           <height>25</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>5</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="MonLabelClic" name="label">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>300</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>178</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::NoFrame</enum>
+     </property>
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;aaa&lt;/p&gt;&lt;p&gt;dqsklmdqm&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="scaledContents">
+      <bool>false</bool>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="TBMatrice"/>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>MonBoutonValide</class>
+   <extends>QToolButton</extends>
+   <header>monBoutonValide.h</header>
+  </customwidget>
+  <customwidget>
+   <class>MonLabelClic</class>
+   <extends>QLabel</extends>
+   <header>monLabelClic.h</header>
+  </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>
diff --git a/UiQT4/desWidgetUniqueSDCO.ui b/UiQT4/desWidgetUniqueSDCO.ui
new file mode 100644 (file)
index 0000000..178cfc0
--- /dev/null
@@ -0,0 +1,277 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>WidgetUniqueSDCO</class>
+ <widget class="QWidget" name="WidgetUniqueSDCO">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>1069</width>
+    <height>56</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>0</width>
+    <height>0</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <property name="spacing">
+    <number>1</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_2">
+     <property name="spacing">
+      <number>0</number>
+     </property>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayout_3">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+       <property name="sizeConstraint">
+        <enum>QLayout::SetFixedSize</enum>
+       </property>
+       <item>
+        <spacer name="horizontalSpacer_3">
+         <property name="orientation">
+          <enum>Qt::Horizontal</enum>
+         </property>
+         <property name="sizeType">
+          <enum>QSizePolicy::Fixed</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>21</width>
+           <height>20</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+       <item>
+        <widget class="MonBoutonValide" name="RBValide">
+         <property name="minimumSize">
+          <size>
+           <width>21</width>
+           <height>25</height>
+          </size>
+         </property>
+         <property name="maximumSize">
+          <size>
+           <width>21</width>
+           <height>25</height>
+          </size>
+         </property>
+         <property name="focusPolicy">
+          <enum>Qt::ClickFocus</enum>
+         </property>
+         <property name="toolTip">
+          <string>Affiche le rapport de validation du mot-clef</string>
+         </property>
+         <property name="styleSheet">
+          <string notr="true">border : 0px</string>
+         </property>
+         <property name="text">
+          <string>...</string>
+         </property>
+         <property name="icon">
+          <iconset>
+           <normaloff>../Editeur/icons/ast-green-ball.png</normaloff>../Editeur/icons/ast-green-ball.png</iconset>
+         </property>
+         <property name="iconSize">
+          <size>
+           <width>25</width>
+           <height>25</height>
+          </size>
+         </property>
+        </widget>
+       </item>
+      </layout>
+     </item>
+     <item>
+      <spacer name="verticalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>2</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="MonLabelClic" name="label">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>300</width>
+       <height>25</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>178</width>
+       <height>16777215</height>
+      </size>
+     </property>
+     <property name="frameShape">
+      <enum>QFrame::NoFrame</enum>
+     </property>
+     <property name="text">
+      <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;aaa&lt;/p&gt;&lt;p&gt;dqsklmdqm&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+     </property>
+     <property name="scaledContents">
+      <bool>false</bool>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout">
+     <property name="spacing">
+      <number>0</number>
+     </property>
+     <item>
+      <widget class="QLineEdit" name="LESDCO">
+       <property name="minimumSize">
+        <size>
+         <width>0</width>
+         <height>25</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>805</width>
+         <height>16777215</height>
+        </size>
+       </property>
+       <property name="styleSheet">
+        <string notr="true">background:rgb(235,235,235);
+border:0px;</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_2">
+       <property name="text">
+        <string>Attend un objet de type CO </string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <spacer name="horizontalSpacer_2">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="sizeType">
+      <enum>QSizePolicy::MinimumExpanding</enum>
+     </property>
+     <property name="sizeHint" stdset="0">
+      <size>
+       <width>79</width>
+       <height>17</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayout_3">
+     <item>
+      <widget class="QToolButton" name="RBPoubelle">
+       <property name="minimumSize">
+        <size>
+         <width>21</width>
+         <height>25</height>
+        </size>
+       </property>
+       <property name="maximumSize">
+        <size>
+         <width>21</width>
+         <height>25</height>
+        </size>
+       </property>
+       <property name="focusPolicy">
+        <enum>Qt::ClickFocus</enum>
+       </property>
+       <property name="toolTip">
+        <string>Détruit le mot-clef</string>
+       </property>
+       <property name="styleSheet">
+        <string notr="true">border : 0px</string>
+       </property>
+       <property name="text">
+        <string>...</string>
+       </property>
+       <property name="icon">
+        <iconset>
+         <normaloff>../Editeur/icons/deleteRond.png</normaloff>../Editeur/icons/deleteRond.png</iconset>
+       </property>
+       <property name="iconSize">
+        <size>
+         <width>25</width>
+         <height>25</height>
+        </size>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="verticalSpacer">
+       <property name="orientation">
+        <enum>Qt::Vertical</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>20</width>
+         <height>2</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <customwidgets>
+  <customwidget>
+   <class>MonBoutonValide</class>
+   <extends>QToolButton</extends>
+   <header>monBoutonValide.h</header>
+  </customwidget>
+  <customwidget>
+   <class>MonLabelClic</class>
+   <extends>QLabel</extends>
+   <header>monLabelClic.h</header>
+  </customwidget>
+ </customwidgets>
+ <tabstops>
+  <tabstop>LESDCO</tabstop>
+ </tabstops>
+ <resources/>
+ <connections/>
+</ui>
index 82bb7ea65e4542e0520aca0c3f8e8c2007092546..15e0c3af9f9d55d10e9c4f46f0b7c4667d7ccd31 100644 (file)
@@ -11,7 +11,8 @@ PY_FILES = desSelectVal.py desViewTexte.py  desChoixCommandes.py desWidgetComman
         desChoixCata.py desWidgetPlusieursInto.py desWidgetPlusieursIntoOrdonne.py desBaseWidget.py desWidgetOptionnel.py \
         desWidgetSimpFichier.py desWidgetSimpTxt.py desRecherche.py desWidgetCommentaire.py\
        desWidgetTuple2.py desWidgetTuple3.py desWidgetCreeParam.py desWidgetParam.py desWidgetHeure.py desWidgetDate.py\
-        desWidgetVide.py desWidgetInformation.py desVisu.py desSelectVal.py desWidgetUniqueSDCO.py desWidgetSDCOInto.py
+        desWidgetVide.py desWidgetInformation.py desVisu.py desSelectVal.py desWidgetUniqueSDCO.py desWidgetSDCOInto.py\
+        desWidgetMatrice.py
 
 
 QM_FILES=eficas_en.qm