pre code cleanup
This commit is contained in:
parent
2a798a554b
commit
a8522d0fae
@ -9,8 +9,7 @@ matplotlib.rcParams['backend.qt4']='PySide'
|
||||
from PySide import QtCore, QtGui
|
||||
from pylot.core.active import activeSeismoPick, surveyUtils, fmtomoUtils, seismicArrayPreparation
|
||||
from pylot.core.active.gui.asp3d_layout import *
|
||||
from pylot.core.active.gui.vtk_tools_layout import *
|
||||
from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO
|
||||
from pylot.core.active.gui.windows import Gen_SeisArray, Gen_Survey_from_SA, Gen_Survey_from_SR, Call_autopicker, Call_FMTOMO, Call_VTK_dialog
|
||||
from pylot.core.active.gui.windows import openFile, saveFile, browseDir, getMaxCPU
|
||||
|
||||
from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
|
||||
@ -43,6 +42,7 @@ class gui_control(object):
|
||||
self.gssr = None
|
||||
self.autopicker = None
|
||||
self.fmtomo = None
|
||||
self.vtktools = None
|
||||
|
||||
def setInitStates(self):
|
||||
self.setPickState(False)
|
||||
@ -369,111 +369,10 @@ class gui_control(object):
|
||||
|
||||
|
||||
def startVTKtools(self):
|
||||
vtk_tools = QtGui.QDialog(self.mainwindow)
|
||||
ui = Ui_vtk_tools()
|
||||
ui.setupUi(vtk_tools)
|
||||
|
||||
self.vtk_tools_ui = ui
|
||||
self.connectButtons_vtk_tools()
|
||||
self.openVTKdialog(ui, vtk_tools)
|
||||
|
||||
|
||||
def openVTKdialog(self, ui, vtk_tools):
|
||||
vtk_tools.exec_()
|
||||
|
||||
|
||||
def connectButtons_vtk_tools(self):
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_vg, QtCore.SIGNAL("clicked()"), self.chooseVgrid)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_vgref, QtCore.SIGNAL("clicked()"), self.chooseVgridref)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_rays, QtCore.SIGNAL("clicked()"), self.chooseRaysIn)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_raysout, QtCore.SIGNAL("clicked()"), self.chooseRaysOutDir)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_vtkout, QtCore.SIGNAL("clicked()"), self.newFileVTK)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.pushButton_parav, QtCore.SIGNAL("clicked()"), self.openFileParaview)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.start_vg, QtCore.SIGNAL("clicked()"), self.startvgvtk)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.start_rays, QtCore.SIGNAL("clicked()"), self.startraysvtk)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.radioButton_rel, QtCore.SIGNAL("clicked()"), self.activateVgref)
|
||||
QtCore.QObject.connect(self.vtk_tools_ui.radioButton_abs, QtCore.SIGNAL("clicked()"), self.deactivateVgref)
|
||||
|
||||
|
||||
def openFileParaview(self):
|
||||
os.system('paraview %s &'%self.vtk_tools_ui.lineEdit_vgout.text())
|
||||
|
||||
|
||||
def activateVgref(self):
|
||||
self.vtk_tools_ui.lineEdit_vgref.setEnabled(True)
|
||||
self.vtk_tools_ui.pushButton_vgref.setEnabled(True)
|
||||
|
||||
|
||||
def deactivateVgref(self):
|
||||
self.vtk_tools_ui.lineEdit_vgref.setEnabled(False)
|
||||
self.vtk_tools_ui.pushButton_vgref.setEnabled(False)
|
||||
|
||||
|
||||
def checkVgStartButton(self):
|
||||
ui = self.vtk_tools_ui
|
||||
if ui.radioButton_rel.isChecked():
|
||||
if ui.lineEdit_vg.text() != '' and ui.lineEdit_vgref.text() != '':
|
||||
ui.start_vg.setEnabled(True)
|
||||
if self.vtktools is None:
|
||||
self.vtktools = Call_VTK_dialog(self.mainwindow)
|
||||
else:
|
||||
ui.start_vg.setEnabled(False)
|
||||
if ui.radioButton_abs.isChecked():
|
||||
if ui.lineEdit_vg.text() != '':
|
||||
ui.start_vg.setEnabled(True)
|
||||
else:
|
||||
ui.start_vg.setEnabled(False)
|
||||
|
||||
|
||||
def checkRaysStartButton(self):
|
||||
ui = self.vtk_tools_ui
|
||||
if ui.lineEdit_rays.text() != '' and ui.lineEdit_raysout.text() != '':
|
||||
ui.start_rays.setEnabled(True)
|
||||
else:
|
||||
ui.start_rays.setEnabled(False)
|
||||
|
||||
|
||||
def chooseVgrid(self):
|
||||
self.vtk_tools_ui.lineEdit_vg.setText(openFile())
|
||||
self.checkVgStartButton()
|
||||
|
||||
|
||||
def chooseVgridref(self):
|
||||
self.vtk_tools_ui.lineEdit_vgref.setText(openFile())
|
||||
self.checkVgStartButton()
|
||||
|
||||
|
||||
def chooseRaysIn(self):
|
||||
self.vtk_tools_ui.lineEdit_rays.setText(openFile())
|
||||
self.checkRaysStartButton()
|
||||
|
||||
|
||||
def chooseRaysOutDir(self):
|
||||
self.vtk_tools_ui.lineEdit_raysout.setText(browseDir())
|
||||
self.checkRaysStartButton()
|
||||
|
||||
|
||||
def startvgvtk(self):
|
||||
ui = self.vtk_tools_ui
|
||||
if ui.lineEdit_vgout.text() == '':
|
||||
if not self.printDialogMessage('Please specify output filename.'):
|
||||
return
|
||||
if ui.radioButton_abs.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
|
||||
outputfile = ui.lineEdit_vgout.text(),
|
||||
absOrRel='abs')
|
||||
elif ui.radioButton_rel.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
|
||||
outputfile = ui.lineEdit_vgout.text(),
|
||||
absOrRel='rel',
|
||||
inputfileref = ui.lineEdit_vgref.text())
|
||||
|
||||
|
||||
def startraysvtk(self):
|
||||
ui = self.vtk_tools_ui
|
||||
fmtomoUtils.rays2VTK(ui.lineEdit_rays.text(), ui.lineEdit_raysout.text())
|
||||
|
||||
|
||||
def newFileVTK(self):
|
||||
self.vtk_tools_ui.lineEdit_vgout.setText(saveFile())
|
||||
self.vtktools.start_dialog()
|
||||
|
||||
|
||||
def postprocessing(self):
|
||||
|
@ -8,6 +8,8 @@ from generate_survey_layout_minimal import Ui_generate_survey_minimal
|
||||
from generate_seisarray_layout import Ui_generate_seisarray
|
||||
from picking_parameters_layout import Ui_picking_parameters
|
||||
from fmtomo_parameters_layout import Ui_fmtomo_parameters
|
||||
from pylot.core.active.gui.vtk_tools_layout import Ui_vtk_tools
|
||||
|
||||
|
||||
import numpy as np
|
||||
import matplotlib
|
||||
@ -62,9 +64,7 @@ class Gen_SeisArray(object):
|
||||
self.connectButtons()
|
||||
|
||||
def start_dialog(self):
|
||||
self.init_last_selection()
|
||||
if self.qdialog.exec_():
|
||||
self.refresh_selection()
|
||||
if self.ui.radioButton_interpolatable.isChecked():
|
||||
self.seisarray = seismicArrayPreparation.SeisArray(self.recfile, True)
|
||||
elif self.ui.radioButton_normal.isChecked():
|
||||
@ -75,19 +75,8 @@ class Gen_SeisArray(object):
|
||||
self.seisarray.addMeasuredTopographyPoints(self.ptsfile)
|
||||
self.executed = True
|
||||
else:
|
||||
self.refresh_selection()
|
||||
self.executed = False
|
||||
|
||||
def refresh_selection(self):
|
||||
self.srcfile = self.ui.lineEdit_src.text()
|
||||
self.recfile = self.ui.lineEdit_rec.text()
|
||||
self.ptsfile = self.ui.lineEdit_pts.text()
|
||||
|
||||
def init_last_selection(self):
|
||||
self.ui.lineEdit_src.setText(self.srcfile)
|
||||
self.ui.lineEdit_rec.setText(self.recfile)
|
||||
self.ui.lineEdit_pts.setText(self.ptsfile)
|
||||
|
||||
def get_seisarray(self):
|
||||
if self.seisarray is not None:
|
||||
return self.seisarray
|
||||
@ -128,27 +117,14 @@ class Gen_Survey_from_SA(object):
|
||||
self.connectButtons()
|
||||
|
||||
def start_dialog(self):
|
||||
self.init_last_selection()
|
||||
if self.qdialog.exec_():
|
||||
self.refresh_selection()
|
||||
self.survey = activeSeismoPick.Survey(self.obsdir, seisArray = self.seisarray,
|
||||
useDefaultParas = True, fstart = self.fstart,
|
||||
fend = self.fend)
|
||||
self.executed = True
|
||||
else:
|
||||
self.refresh_selection()
|
||||
self.executed = False
|
||||
|
||||
def refresh_selection(self):
|
||||
self.obsdir = self.ui.lineEdit_obs.text()
|
||||
self.fstart = self.ui.fstart.text()
|
||||
self.fend = self.ui.fend.text()
|
||||
|
||||
def init_last_selection(self):
|
||||
self.ui.lineEdit_obs.setText(self.obsdir)
|
||||
self.ui.fstart.setText(self.fstart)
|
||||
self.ui.fend.setText(self.fend)
|
||||
|
||||
def get_survey(self):
|
||||
return self.survey
|
||||
|
||||
@ -180,31 +156,14 @@ class Gen_Survey_from_SR(object):
|
||||
self.connectButtons()
|
||||
|
||||
def start_dialog(self):
|
||||
self.init_last_selection()
|
||||
if self.qdialog.exec_():
|
||||
self.refresh_selection()
|
||||
self.survey = activeSeismoPick.Survey(self.obsdir, self.srcfile, self.recfile,
|
||||
useDefaultParas = True,
|
||||
fstart = self.fstart, fend = self.fend)
|
||||
self.executed = True
|
||||
else:
|
||||
self.refresh_selection()
|
||||
self.executed = False
|
||||
|
||||
def refresh_selection(self):
|
||||
self.obsdir = self.ui.lineEdit_obs.text()
|
||||
self.srcfile = self.ui.lineEdit_src.text()
|
||||
self.recfile = self.ui.lineEdit_rec.text()
|
||||
self.fstart = self.ui.fstart.text()
|
||||
self.fend = self.ui.fend.text()
|
||||
|
||||
def init_last_selection(self):
|
||||
self.ui.lineEdit_obs.setText(self.obsdir)
|
||||
self.ui.lineEdit_src.setText(self.srcfile)
|
||||
self.ui.lineEdit_rec.setText(self.recfile)
|
||||
self.ui.fstart.setText(self.fstart)
|
||||
self.ui.fend.setText(self.fend)
|
||||
|
||||
def get_survey(self):
|
||||
return self.survey
|
||||
|
||||
@ -223,7 +182,6 @@ class Gen_Survey_from_SR(object):
|
||||
self.ui.lineEdit_rec.setText(openFile('Open receiverfile.'))
|
||||
|
||||
|
||||
|
||||
class Call_autopicker(object):
|
||||
def __init__(self, mainwindow, survey):
|
||||
self.mainwindow = mainwindow
|
||||
@ -456,5 +414,115 @@ class Call_FMTOMO(object):
|
||||
self.ui.simuldir.setText(browseDir())
|
||||
|
||||
|
||||
class Call_VTK_dialog(object):
|
||||
def __init__(self, mainwindow):
|
||||
self.mainwindow = mainwindow
|
||||
self.init_dialog()
|
||||
#self.refresh_selection()
|
||||
self.start_dialog()
|
||||
|
||||
def init_dialog(self):
|
||||
qdialog = QtGui.QDialog(self.mainwindow)
|
||||
ui = Ui_vtk_tools()
|
||||
ui.setupUi(qdialog)
|
||||
self.ui = ui
|
||||
self.qdialog = qdialog
|
||||
self.connectButtons()
|
||||
|
||||
def start_dialog(self):
|
||||
#self.init_last_selection()
|
||||
self.qdialog.exec_()
|
||||
#self.refresh_selection()
|
||||
|
||||
# def refresh_selection(self):
|
||||
# self.vg = self.ui.lineEdit_vg.text()
|
||||
# self.vgout = self.ui.lineEdit_vgout.text()
|
||||
# self.rays = self.ui.lineEdit_rays.text()
|
||||
# self.raysout = self.ui.lineEdit_raysout.text()
|
||||
|
||||
# def init_last_selection(self):
|
||||
# self.ui.lineEdit_vg.setText(self.vg)
|
||||
# self.ui.lineEdit_vgout.setText(self.vgout)
|
||||
# self.ui.lineEdit_rays.setText(self.rays)
|
||||
# self.ui.lineEdit_raysout.setText(self.raysout)
|
||||
|
||||
def checkVgStartButton(self):
|
||||
ui = self.ui
|
||||
if ui.radioButton_rel.isChecked():
|
||||
if ui.lineEdit_vg.text() != '' and ui.lineEdit_vgref.text() != '':
|
||||
ui.start_vg.setEnabled(True)
|
||||
else:
|
||||
ui.start_vg.setEnabled(False)
|
||||
if ui.radioButton_abs.isChecked():
|
||||
if ui.lineEdit_vg.text() != '':
|
||||
ui.start_vg.setEnabled(True)
|
||||
else:
|
||||
ui.start_vg.setEnabled(False)
|
||||
|
||||
def checkRaysStartButton(self):
|
||||
ui = self.ui
|
||||
if ui.lineEdit_rays.text() != '' and ui.lineEdit_raysout.text() != '':
|
||||
ui.start_rays.setEnabled(True)
|
||||
else:
|
||||
ui.start_rays.setEnabled(False)
|
||||
|
||||
def connectButtons(self):
|
||||
QtCore.QObject.connect(self.ui.pushButton_vg, QtCore.SIGNAL("clicked()"), self.chooseVgrid)
|
||||
QtCore.QObject.connect(self.ui.pushButton_vgref, QtCore.SIGNAL("clicked()"), self.chooseVgridref)
|
||||
QtCore.QObject.connect(self.ui.pushButton_rays, QtCore.SIGNAL("clicked()"), self.chooseRaysIn)
|
||||
QtCore.QObject.connect(self.ui.pushButton_raysout, QtCore.SIGNAL("clicked()"), self.chooseRaysOutDir)
|
||||
QtCore.QObject.connect(self.ui.pushButton_vtkout, QtCore.SIGNAL("clicked()"), self.newFileVTK)
|
||||
QtCore.QObject.connect(self.ui.pushButton_parav, QtCore.SIGNAL("clicked()"), self.openFileParaview)
|
||||
QtCore.QObject.connect(self.ui.start_vg, QtCore.SIGNAL("clicked()"), self.startvgvtk)
|
||||
QtCore.QObject.connect(self.ui.start_rays, QtCore.SIGNAL("clicked()"), self.startraysvtk)
|
||||
QtCore.QObject.connect(self.ui.radioButton_rel, QtCore.SIGNAL("clicked()"), self.activateVgref)
|
||||
QtCore.QObject.connect(self.ui.radioButton_abs, QtCore.SIGNAL("clicked()"), self.deactivateVgref)
|
||||
|
||||
def openFileParaview(self):
|
||||
os.system('paraview %s &'%self.ui.lineEdit_vgout.text())
|
||||
|
||||
def activateVgref(self):
|
||||
self.ui.lineEdit_vgref.setEnabled(True)
|
||||
self.ui.pushButton_vgref.setEnabled(True)
|
||||
|
||||
def deactivateVgref(self):
|
||||
self.ui.lineEdit_vgref.setEnabled(False)
|
||||
self.ui.pushButton_vgref.setEnabled(False)
|
||||
|
||||
def chooseVgrid(self):
|
||||
self.ui.lineEdit_vg.setText(openFile())
|
||||
self.checkVgStartButton()
|
||||
|
||||
def chooseVgridref(self):
|
||||
self.ui.lineEdit_vgref.setText(openFile())
|
||||
self.checkVgStartButton()
|
||||
|
||||
def chooseRaysIn(self):
|
||||
self.ui.lineEdit_rays.setText(openFile())
|
||||
self.checkRaysStartButton()
|
||||
|
||||
def chooseRaysOutDir(self):
|
||||
self.ui.lineEdit_raysout.setText(browseDir())
|
||||
self.checkRaysStartButton()
|
||||
|
||||
def startvgvtk(self):
|
||||
ui = self.ui
|
||||
if ui.lineEdit_vgout.text() == '':
|
||||
return
|
||||
if ui.radioButton_abs.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
|
||||
outputfile = ui.lineEdit_vgout.text(),
|
||||
absOrRel='abs')
|
||||
elif ui.radioButton_rel.isChecked():
|
||||
fmtomoUtils.vgrids2VTK(inputfile = ui.lineEdit_vg.text(),
|
||||
outputfile = ui.lineEdit_vgout.text(),
|
||||
absOrRel='rel',
|
||||
inputfileref = ui.lineEdit_vgref.text())
|
||||
|
||||
def startraysvtk(self):
|
||||
ui = self.ui
|
||||
fmtomoUtils.rays2VTK(ui.lineEdit_rays.text(), ui.lineEdit_raysout.text())
|
||||
|
||||
def newFileVTK(self):
|
||||
self.ui.lineEdit_vgout.setText(saveFile())
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user