def ajoutScript(self):
+ if not hasattr(self,'CBScripts') : return # Cas des Widgets Plies
self.dictCommandes={}
listeCommandes=self.dict_commandes_mesScripts[self.obj.nom]
if type(listeCommandes) != types.TupleType: listeCommandes=(listeCommandes,)
from desChoixCode import Ui_ChoixCode
from determine import monEnvQT5
if monEnvQT5:
- from PyQt5.QtWidgets import QDialog, QRadioButton
+ from PyQt5.QtWidgets import QDialog, QRadioButton, QGroupBox, QButtonGroup
from PyQt5.QtGui import QPalette
from PyQt5.QtCore import QProcess, QFileInfo, Qt, QSize
else :
self.groupCodes=QButtonGroup(self.groupBox)
vars=os.environ.items()
listeCode=('Aster','Adao','Carmel3D','CarmelCND','CF','MAP','MT','PSEN','PSEN_N1','Telemac','ZCracks',)
- i=1
for code in listeCode:
- nom='rB_'+code
dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
try :
l=os.listdir(dirCode)
- bouton=QRadioButton(self)
- bouton.setMinimumSize(QSize(0, 30))
+ bouton=QRadioButton(self.groupBox)
bouton.setText(code)
- bouton.setGeometry(QRect(10,20+30*i, 300, 30))
- bouton.show()
self.groupCodes.addButton(bouton)
- i=i+1
+ self.vlBouton.addWidget(bouton)
except :
clef="PREFS_CATA_"+code
try :
repIntegrateur=os.path.abspath(os.environ[clef])
l=os.listdir(repIntegrateur)
- bouton=QRadioButton(self)
- bouton.setGeometry(QRect(10,20+30*i, 300, 30))
- bouton.setMinimumSize(QSize(0, 30))
+ bouton=QRadioButton(self.groupBox)
bouton.setText(code)
bouton.show()
- i=i+1
self.groupCodes.addButton(bouton)
except :
pass
repIntegrateur=os.path.abspath(os.environ[clef])
l=os.listdir(repIntegrateur)
bouton=QRadioButton(self)
- bouton.setGeometry(QRect(10,20+30*i, 300, 30))
- i=i+1
- bouton.setMinimumSize(QSize(0, 30))
bouton.setText(code)
bouton.show()
self.groupCodes.addButton(bouton)
def choisitCode(self):
bouton=self.groupCodes.checkedButton()
+ if bouton==None : return
code=str(bouton.text())
codeUpper=code.upper()
self.parentAppli.code=codeUpper
from determine import monEnvQT5
if monEnvQT5:
from PyQt5.QtCore import Qt
- from PyQt5.QtWidgets import QDialog
+ from PyQt5.QtWidgets import QDialog, QListWidgetItem
else :
from PyQt4.QtGui import *
from PyQt4.QtCore import *
--- /dev/null
+def processXLS(listeparam) :
+ print "dans processXLS"
+ item=listeparam[0]
+ fileNameObj=item.object.get_child('XLS_file')
+ if fileNameObj : fileName=fileNameObj.get_valeur()
+ else : fileName = ""
+ if fileName == "" : return 0, 'Nom de fichier invalide'
+
+ ongletListObj=item.object.get_child('Onglets')
+ if ongletListObj : ongletList= ongletListObj.get_valeur()
+ else : ongletList = []
+ if ongletList == [] : return 0, 'ongletList invalide'
+
+ busListObj=item.object.get_child('BusList')
+ if busListObj : busList= busListObj.get_valeur()
+ else : busList = []
+ if busList == [] : return 0, 'BusList invalide'
+
+ contListObj=item.object.get_child('ContList')
+ if contListObj : contList=contListObj.get_valeur()
+ else : contList = []
+ if contList == [] : return 0, 'ContList invalide'
+
+ dicoBus={}
+ dicoCont={}
+ for onglet in ongletList:
+ recherche=str(" ("+ str(onglet) +" )")
+ listeBusPourOnglet=[]
+ listeContPourOnglet=[]
+ for bus in busList :
+ nomBusSplit=str(bus).split(recherche)
+ if len(nomBusSplit) == 2 : listeBusPourOnglet.append(nomBusSplit[0])
+ for cont in contList :
+ nomContSplit=str(cont).split(recherche)
+ if len(nomContSplit) == 2 : listeContPourOnglet.append(nomContSplit[0])
+ if listeBusPourOnglet != [] : dicoBus[onglet]=listeBusPourOnglet
+ if listeContPourOnglet != [] : dicoCont[onglet]=listeContPourOnglet
+
+ from Processor import processXLS
+ processXLS(fileName,dicoBus,dicoCont)
+ #if nouvelleVal != [] : prob.set_valeur(nouvelleVal)
+
+# le dictionnaire des commandes a la structure suivante :
+# la clef est la commande qui va proposer l action
+# puis un tuple qui contient
+# - la fonction a appeler
+# - le label dans le menu du clic droit
+# - un tuple contenant les parametres attendus par la fonction
+# - appelable depuis Salome uniquement -)
+# - appelable depuis un item valide uniquement
+# - toolTip
+dict_commandes={
+ 'DATA_PROCESSING': (
+ (processXLS,"process",('item',),False,True,"process values "),
+ ),
+ }
<property name="title">
<string/>
</property>
+ <layout class="QVBoxLayout" name="vlBouton">
+ <item>
+ <spacer name="verticalSpacer">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
</widget>
</item>
<item>
<property name="spacing">
<number>0</number>
</property>
- <property name="margin">
+ <property name="leftMargin">
+ <number>2</number>
+ </property>
+ <property name="topMargin">
+ <number>2</number>
+ </property>
+ <property name="rightMargin">
+ <number>2</number>
+ </property>
+ <property name="bottomMargin">
<number>2</number>
</property>
<item>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
- <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <layout class="QHBoxLayout" name="horizontalLayout_2">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <property name="leftMargin">
+ <number>0</number>
+ </property>
+ <property name="topMargin">
+ <number>0</number>
+ </property>
+ <property name="rightMargin">
+ <number>0</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
</spacer>
</item>
<item>
- <layout class="QVBoxLayout" name="verticalLayout_3">
- <property name="spacing">
- <number>5</number>
- </property>
- <item>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0" colspan="3">
<widget class="QLabel" name="textLabel6">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
</property>
</widget>
</item>
- <item>
+ <item row="1" column="0">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
- <height>2</height>
+ <height>13</height>
</size>
</property>
</spacer>
</item>
- <item>
+ <item row="2" column="0" colspan="2">
<widget class="QLineEdit" name="LEFiltre">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
</property>
</widget>
</item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout_2">
- <property name="sizeConstraint">
- <enum>QLayout::SetMinimumSize</enum>
+ <item row="3" column="0">
+ <widget class="QRadioButton" name="RBCasse">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
</property>
- <item>
- <widget class="QRadioButton" name="RBCasse">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Sensible à la casse</string>
- </property>
- <property name="autoExclusive">
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <spacer name="horizontalSpacer_3">
- <property name="orientation">
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" stdset="0">
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item>
- <widget class="QPushButton" name="RBClear">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="minimumSize">
- <size>
- <width>100</width>
- <height>30</height>
- </size>
- </property>
- <property name="maximumSize">
- <size>
- <width>70</width>
- <height>40</height>
- </size>
- </property>
- <property name="toolTip">
- <string>ré-affiche toutes les commandes</string>
- </property>
- <property name="styleSheet">
- <string notr="true">background-color:rgb(104,110,149);
+ <property name="text">
+ <string>Sensible à la casse</string>
+ </property>
+ <property name="autoExclusive">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="1">
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="3" column="2">
+ <widget class="QPushButton" name="RBClear">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>100</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>70</width>
+ <height>40</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>ré-affiche toutes les commandes</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color:rgb(104,110,149);
color :white;
border-radius : 12px
</string>
- </property>
- <property name="text">
- <string>Effacer </string>
- </property>
- </widget>
- </item>
- </layout>
+ </property>
+ <property name="text">
+ <string>Effacer </string>
+ </property>
+ </widget>
</item>
</layout>
</item>