class runMODFLOW
(QDialog, Ui_ModflowWindow
): def __init__(self, iface, modDirectory, prefDirectory):
QDialog.__init__
(self, iface.
mainWindow()) self.iface = iface
self.setupUi(self)
#... some irrelevent Ui stuff ...
self.workerThread = buildMODFLOWdata()
self.workerThread.progress.connect(self.updateProgressBar)
self.RunButton.clicked.connect(self.startWriting)
def startWriting(self):
Tolerance = self.TolerVal.text()
MaxOutIterVal = self.MaxOutIterVal.text()
self.workerThread.writeMODFLOWInputs(self.modDir,self.prefDir,MaxOutIterVal,Tolerance)
progress = pyqtSignal(int)
def writeMODFLOWInputs(self,modDirectory,prefDirectory,MaxOutIterVal,Tolerance):
#... some other time consuming processes here ...
#... amounting to signals to increase self.progress...
NAMfile = r'%s'%(self.modDirectory+'mfnam.txt')
MODFLOW = r'%s'%(sys.path[4] + "/GraphicGroundwater/mf2005.exe")
qMODFLOW.setWorkingDirectory(self.modDirectory)
qMODFLOW.finished.connect(self.returnResultStats)
qMODFLOW.start(MODFLOW,[NAMfile])
qMODFLOW.waitForFinished(40000)
class runMODFLOW(QDialog, Ui_ModflowWindow):
def __init__(self, iface, modDirectory, prefDirectory):
QDialog.__init__(self, iface.mainWindow())
self.iface = iface
self.setupUi(self)
#... some irrelevent Ui stuff ...
self.workerThread = buildMODFLOWdata()
self.workerThread.progress.connect(self.updateProgressBar)
self.RunButton.clicked.connect(self.startWriting)
def startWriting(self):
Tolerance = self.TolerVal.text()
MaxOutIterVal = self.MaxOutIterVal.text()
self.workerThread.writeMODFLOWInputs(self.modDir,self.prefDir,MaxOutIterVal,Tolerance)
class buildMODFLOWdata(QThread):
progress = pyqtSignal(int)
def writeMODFLOWInputs(self,modDirectory,prefDirectory,MaxOutIterVal,Tolerance):
#... some other time consuming processes here ...
#... amounting to signals to increase self.progress...
NAMfile = r'%s'%(self.modDirectory+'mfnam.txt')
MODFLOW = r'%s'%(sys.path[4] + "/GraphicGroundwater/mf2005.exe")
qMODFLOW = QProcess()
qMODFLOW.setWorkingDirectory(self.modDirectory)
qMODFLOW.finished.connect(self.returnResultStats)
qMODFLOW.start(MODFLOW,[NAMfile])
qMODFLOW.waitForFinished(40000)
To copy to clipboard, switch view to plain text mode
Bookmarks