1 # Copyright (C) 2012-2013 EDF
3 # This file is part of SALOME HYDRO module.
5 # SALOME HYDRO module is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # SALOME HYDRO module is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
19 from PyQt5.QtCore import *
20 from PyQt5.QtGui import *
21 from PyQt5.QtWidgets import *
24 from salome.hydro.pytel.genjob import generate_job
25 from genjobwindow_ui import Ui_GenJobDialog
28 class GenJobDialog(QtGui.QDialog, Ui_GenJobDialog):
30 def __init__(self, parent, pytel_params):
31 QtGui.QDialog.__init__(self, parent)
33 self.connect(self.dialogButtonBox, SIGNAL("accepted()"), self.validate)
34 self.connect(self.dialogButtonBox, SIGNAL("rejected()"), self.close)
35 self.connect(self.chooseInputDataDirectoryButton, SIGNAL("clicked()"), self.choose_input_dir)
36 self.connect(self.chooseResultDirectoryButton, SIGNAL("clicked()"), self.choose_result_dir)
37 self.telemacRootDirLE.setText("/home/projets-bgq/systel/V6P2")
38 self.telemacEnvFileLE.setText("/home/projets-bgq/systel/V6P2/config/pysource.zumbrota.xlf14.sh")
39 casedir = os.path.dirname(pytel_params["FICHIER_CAS"])
40 self.inputDataDirectoryLE.setText(casedir)
41 self.resultDirectoryLE.setText(casedir)
43 # Populate resource combo box
44 res_manager = salome.naming_service.Resolve("/ResourcesManager")
45 res_params = salome.ResourceParameters()
46 res_list = res_manager.GetFittingResources(res_params)
47 self.resourceCB.addItems(res_list)
49 self.pytel_params = pytel_params
51 def choose_input_dir(self):
52 directory = QFileDialog.getExistingDirectory(self,
53 directory = self.inputDataDirectoryLE.text(),
54 options = QFileDialog.ShowDirsOnly)
55 if not directory.isNull():
56 self.inputDataDirectoryLE.setText(directory)
58 def choose_result_dir(self):
59 directory = QFileDialog.getExistingDirectory(self,
60 directory = self.resultDirectoryLE.text(),
61 options = QFileDialog.ShowDirsOnly)
62 if not directory.isNull():
63 self.resultDirectoryLE.setText(directory)
66 generate_job(self.pytel_params,
67 str(self.resourceCB.currentText()),
68 str(self.telemacRootDirLE.text()),
69 str(self.telemacEnvFileLE.text()),
70 self.nbCoreSB.value(),
71 str(self.inputDataDirectoryLE.text()),
72 str(self.resultDirectoryLE.text()))