general crack dialog, working dir and result file

This commit is contained in:
Paul RASCLE 2016-02-25 17:57:05 +01:00
parent 15a305400b
commit a7e3aa2650
2 changed files with 75 additions and 9 deletions

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>629</width>
<height>536</height>
<width>666</width>
<height>589</height>
</rect>
</property>
<property name="windowTitle">
@ -269,12 +269,7 @@
</spacer>
</item>
</layout>
<zorder>groupBox_3</zorder>
<zorder>groupBox_7</zorder>
<zorder>horizontalSpacer_3</zorder>
<zorder>verticalSpacer</zorder>
<zorder>horizontalSpacer_3</zorder>
<zorder>horizontalSpacer_9</zorder>
</widget>
</item>
<item>
@ -461,6 +456,38 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_5">
<item row="0" column="0">
<widget class="QPushButton" name="pb_reptrav">
<property name="text">
<string>répertoire de travail</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="le_reptrav">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Répertoire dans lequel seront rangés le maillage final, les objets intermédiaires, la log d'exécution.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pb_nomres">
<property name="text">
<string>nom résultat</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="le_nomres">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;nom du fichier maillage résultat&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">

View File

@ -74,6 +74,10 @@ def fissureGeneraleDlg(context):
self.selectMaillage)
self.connect(self.ui.pb_facefiss, QtCore.SIGNAL("clicked()"),
self.selectFacefiss)
self.connect(self.ui.pb_reptrav, QtCore.SIGNAL("clicked()"),
self.selectReptrav)
self.connect(self.ui.pb_nomres, QtCore.SIGNAL("clicked()"),
self.selectNomres)
self.disconnect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"), self.accept)
self.connect(self.ui.bb_OkCancel, QtCore.SIGNAL("accepted()"),
self.execute)
@ -90,7 +94,9 @@ def fissureGeneraleDlg(context):
lenSegPipe = 2.5,
nbSegRad = 5,
nbSegCercle = 32,
areteFaceFissure = 10)
areteFaceFissure = 10,
reptrav = '.',
nomres = 'casStandard_fissure.med')
def initDialog(self, dico):
@ -105,6 +111,8 @@ def fissureGeneraleDlg(context):
self.ui.sb_couronnes.setValue(dico['nbSegRad'])
self.ui.sb_secteurs.setValue(dico['nbSegCercle'])
self.ui.dsb_areteFaceFissure.setValue(dico['areteFaceFissure'])
self.ui.le_reptrav.setText(os.path.abspath(dico['reptrav']))
self.ui.le_nomres.setText(os.path.split(dico['nomres'])[1])
incomplet = self.testval(dico)
pass
@ -256,6 +264,35 @@ def fissureGeneraleDlg(context):
print filedef
self.ui.le_facefiss.setText(filedef)
def selectReptrav(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.Directory)
fileDiag.setViewMode(QFileDialog.Detail)
fileDiag.setDirectory(self.ui.le_reptrav.text())
if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles()
reptrav = str(fileNames[0])
print "reptrav ", reptrav
self.ui.le_reptrav.setText(os.path.abspath(reptrav))
def selectNomres(self):
fileDiag = QFileDialog(self)
fileDiag.setFileMode(QFileDialog.AnyFile)
fileDiag.setViewMode(QFileDialog.Detail)
nomres=str(os.path.split(str(self.ui.le_nomres.text()))[1])
fileDiag.setDirectory(self.ui.le_reptrav.text())
fileDiag.selectFile(nomres)
fileDiag.setNameFilter("Maillage *.med (*.med)")
self.ui.le_nomres.setText(nomres)
if fileDiag.exec_() :
fileNames = fileDiag.selectedFiles()
tempnom = os.path.split(str(fileNames[0]))[1]
print "nomres ", tempnom
self.ui.le_nomres.setText(tempnom)
else:
self.ui.le_nomres.setText(nomres)
def creeDico(self):
dico = dict(
maillageSain = str(self.ui.le_maillage.text()),
@ -267,7 +304,9 @@ def fissureGeneraleDlg(context):
lenSegPipe = self.ui.dsb_lenSegPipe.value(),
nbSegRad = self.ui.sb_couronnes.value(),
nbSegCercle = self.ui.sb_secteurs.value(),
areteFaceFissure = self.ui.dsb_areteFaceFissure.value()
areteFaceFissure = self.ui.dsb_areteFaceFissure.value(),
reptrav = str(self.ui.le_reptrav.text()),
nomres = str(self.ui.le_nomres.text()),
)
print dico
return dico