debug GUI
This commit is contained in:
parent
9dc57e3977
commit
d405e9e6f9
89
QtPyLoT.py
89
QtPyLoT.py
@ -52,9 +52,15 @@ class MainWindow(QMainWindow):
|
|||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(MainWindow, self).__init__(parent)
|
super(MainWindow, self).__init__(parent)
|
||||||
|
|
||||||
|
settings = QSettings()
|
||||||
|
self.setWindowTitle("PyLoT - do seismic processing the pythonic way")
|
||||||
|
self.setWindowIcon(QIcon(":/icon.ico"))
|
||||||
|
self.seismicPhase = str(settings.value("phase", "P"))
|
||||||
|
|
||||||
# initialize filter parameter
|
# initialize filter parameter
|
||||||
filterOptionsP = FILTERDEFAULTS['P']
|
filterOptionsP = FILTERDEFAULTS['P']
|
||||||
filterOptionsS = FILTERDEFAULTS['S']
|
filterOptionsS = FILTERDEFAULTS['S']
|
||||||
|
print filterOptionsP, "\n", filterOptionsS
|
||||||
self.filterOptionsP = FilterOptions(**filterOptionsP)
|
self.filterOptionsP = FilterOptions(**filterOptionsP)
|
||||||
self.filterOptionsS = FilterOptions(**filterOptionsS)
|
self.filterOptionsS = FilterOptions(**filterOptionsS)
|
||||||
|
|
||||||
@ -62,6 +68,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.data = None
|
self.data = None
|
||||||
self.loadData()
|
self.loadData()
|
||||||
self.updateFilterOptions()
|
self.updateFilterOptions()
|
||||||
|
print self.filteroptions
|
||||||
try:
|
try:
|
||||||
self.startTime = min([tr.stats.starttime for tr in self.data.wfdata])
|
self.startTime = min([tr.stats.starttime for tr in self.data.wfdata])
|
||||||
except:
|
except:
|
||||||
@ -87,9 +94,28 @@ class MainWindow(QMainWindow):
|
|||||||
action.setCheckable(True)
|
action.setCheckable(True)
|
||||||
return action
|
return action
|
||||||
|
|
||||||
|
def createMenus(self):
|
||||||
|
|
||||||
|
fileMenu = self.menuBar().addMenu("&File")
|
||||||
|
fileMenu.addAction(self.openEventAction)
|
||||||
|
fileMenu.addAction(self.saveEventAction)
|
||||||
|
fileMenu.addAction(self.printAction)
|
||||||
|
fileMenu.addSeparator()
|
||||||
|
fileMenu.addAction(self.quitAction)
|
||||||
|
|
||||||
|
editMenu = self.menuBar().addMenu("&Edit")
|
||||||
|
editMenu.addAction(self.filterAction)
|
||||||
|
editMenu.addAction(self.filterEditAction)
|
||||||
|
editMenu.addSeparator()
|
||||||
|
editMenu.addAction(self.selectPAction)
|
||||||
|
editMenu.addAction(self.selectSAction)
|
||||||
|
|
||||||
def loadData(self):
|
def loadData(self):
|
||||||
self.data = None
|
self.data = None
|
||||||
|
|
||||||
|
def saveData(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def getComponent(self):
|
def getComponent(self):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@ -115,52 +141,65 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
|
openIcon = self.style().standardIcon(QStyle.SP_DirOpenIcon)
|
||||||
quitIcon = self.style().standardIcon(QStyle.SP_MediaStop)
|
quitIcon = self.style().standardIcon(QStyle.SP_MediaStop)
|
||||||
|
saveIcon = self.style().standardIcon(QStyle.SP_DriveHDIcon)
|
||||||
self.openEventAction = self.createAction("&Open event ...",
|
self.openEventAction = self.createAction("&Open event ...",
|
||||||
self.loadData,
|
self.loadData,
|
||||||
QKeySequence.Open,
|
QKeySequence.Open,
|
||||||
openIcon,
|
openIcon,
|
||||||
"Open an event.")
|
"Open an event.")
|
||||||
|
self.saveEventAction = self.createAction("&Save event ...",
|
||||||
|
self.saveData,
|
||||||
|
QKeySequence.Save, saveIcon,
|
||||||
|
"Save actual event data.")
|
||||||
self.quitAction = self.createAction("&Quit", self.cleanUp,
|
self.quitAction = self.createAction("&Quit", self.cleanUp,
|
||||||
QKeySequence.Close,
|
QKeySequence.Close,
|
||||||
quitIcon,
|
quitIcon,
|
||||||
"Close event and quit PyLoT")
|
"Close event and quit PyLoT")
|
||||||
self.filterAction = self.createAction("&Filter ...", self.filterData,
|
self.filterAction = self.createAction("&Filter ...", self.filterData,
|
||||||
"Ctrl+F", ":/filter.png",
|
"Ctrl+F", QIcon(":/filter.png"),
|
||||||
"""Toggle un-/filtered waveforms
|
"""Toggle un-/filtered waveforms
|
||||||
to be displayed, accroding to the
|
to be displayed, according to the
|
||||||
desired seismic phase.""", True)
|
desired seismic phase.""", True)
|
||||||
|
self.filterEditAction = self.createAction("&Filter ...",
|
||||||
self.selectPAction = self.createAction("&P", self.alterPhase, "Ctrl+P",
|
self.adjustFilterOptions,
|
||||||
":/picon.png", "Toggle P phase.",
|
"Alt+F", QIcon(None),
|
||||||
True)
|
"""Adjust filter
|
||||||
self.selectSAction = self.createAction("&S", self.alterPhase, "Ctrl+S",
|
parameters.""")
|
||||||
":/sicon.png", "Toggle S phase",
|
self.selectPAction = self.createAction("&P", self.alterPhase, "Alt+P",
|
||||||
True)
|
QIcon(":/picon.png"),
|
||||||
|
"Toggle P phase.", True)
|
||||||
|
self.selectSAction = self.createAction("&S", self.alterPhase, "Alt+S",
|
||||||
|
QIcon(":/sicon.png"),
|
||||||
|
"Toggle S phase", True)
|
||||||
self.printAction = self.createAction("&Print event ...",
|
self.printAction = self.createAction("&Print event ...",
|
||||||
self.printEvent,
|
self.printEvent,
|
||||||
QKeySequence.Print,
|
QKeySequence.Print,
|
||||||
QIcon(":/printer.png"),
|
QIcon(":/printer.png"),
|
||||||
"Print waveform overview.")
|
"Print waveform overview.")
|
||||||
|
self.createMenus()
|
||||||
|
|
||||||
self.eventLabel = QLabel()
|
self.eventLabel = QLabel()
|
||||||
self.eventLabel.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken)
|
self.eventLabel.setFrameStyle(QFrame.StyledPanel|QFrame.Sunken)
|
||||||
status = self.statusBar()
|
status = self.statusBar()
|
||||||
status.setSizeGripEnabled(False)
|
status.setSizeGripEnabled(False)
|
||||||
status.addPermanentWidget(self.eventLabel)
|
status.addPermanentWidget(self.eventLabel)
|
||||||
status.showMessage("Ready", 5000)
|
status.showMessage("Ready", 10000)
|
||||||
|
|
||||||
statLayout = layoutStationButtons(self.getData(), self.getComponent())
|
#statLayout = layoutStationButtons(self.getData(), self.getComponent())
|
||||||
dataLayout = self.getDataWidget()
|
#dataLayout = self.getDataWidget()
|
||||||
|
|
||||||
maingrid = QGridLayout()
|
# maingrid = QGridLayout()
|
||||||
maingrid.setSpacing(10)
|
# maingrid.setSpacing(10)
|
||||||
maingrid.addLayout(statLayout, 0, 0)
|
# maingrid.addLayout(statLayout, 0, 0)
|
||||||
maingrid.addWidget(dataLayout, 1, 0)
|
# maingrid.addWidget(dataLayout, 1, 0)
|
||||||
self.setLayout(maingrid)
|
#self.setLayout(maingrid)
|
||||||
|
|
||||||
def plotData(self):
|
def plotData(self):
|
||||||
pass #self.data.plotData(self.DataPlot)
|
pass #self.data.plotData(self.DataPlot)
|
||||||
|
|
||||||
|
def filterData(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def adjustFilterOptions(self):
|
def adjustFilterOptions(self):
|
||||||
fstring = "Filter Options ({0})".format(self.getSeismicPhase())
|
fstring = "Filter Options ({0})".format(self.getSeismicPhase())
|
||||||
filterDlg = FilterOptionsDialog(titleString=fstring,
|
filterDlg = FilterOptionsDialog(titleString=fstring,
|
||||||
@ -181,22 +220,32 @@ class MainWindow(QMainWindow):
|
|||||||
try:
|
try:
|
||||||
self.filteroptions = [self.filterOptionsP
|
self.filteroptions = [self.filterOptionsP
|
||||||
if not self.seismicPhase == 'S'
|
if not self.seismicPhase == 'S'
|
||||||
else self.filterOptionsS]
|
else self.filterOptionsS][0]
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.updateStatus('Error ...')
|
self.updateStatus('Error ...')
|
||||||
QErrorMessage(e)
|
emsg = QErrorMessage(self)
|
||||||
|
emsg.showMessage('Error: {0}'.format(e))
|
||||||
else:
|
else:
|
||||||
self.updateStatus('Filter loaded ...')
|
self.updateStatus('Filter loaded ...')
|
||||||
|
|
||||||
def getSeismicPhase(self):
|
def getSeismicPhase(self):
|
||||||
return self.seismicPhase
|
return self.seismicPhase
|
||||||
|
|
||||||
|
def alterPhase(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def setSeismicPhase(self, phase):
|
def setSeismicPhase(self, phase):
|
||||||
self.seismicPhase = self.seismicPhaseButtonGroup.getValue()
|
self.seismicPhase = self.seismicPhaseButtonGroup.getValue()
|
||||||
|
|
||||||
def updateStatus(self, message):
|
def updateStatus(self, message):
|
||||||
self.statusBar().showMessage(message, 5000)
|
self.statusBar().showMessage(message, 5000)
|
||||||
|
|
||||||
|
def printEvent(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def cleanUp(self):
|
||||||
|
pass
|
||||||
|
|
||||||
def helpHelp(self):
|
def helpHelp(self):
|
||||||
if checkurl():
|
if checkurl():
|
||||||
form = HelpForm('https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki')
|
form = HelpForm('https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/wiki')
|
||||||
@ -207,7 +256,7 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
# create the Qt application
|
# create the Qt application
|
||||||
pylot_app = QApplication(sys.argv)
|
pylot_app = QApplication(['PyLoT'])
|
||||||
|
|
||||||
# set Application Information
|
# set Application Information
|
||||||
pylot_app.setOrganizationName("Ruhr-University Bochum / MAGS2")
|
pylot_app.setOrganizationName("Ruhr-University Bochum / MAGS2")
|
||||||
|
@ -1 +1 @@
|
|||||||
0.0.0-g0942
|
9dc5-dirty
|
||||||
|
@ -155,7 +155,7 @@ class FilterOptionsDialog(QDialog):
|
|||||||
"""
|
"""
|
||||||
super(FilterOptionsDialog, self).__init__()
|
super(FilterOptionsDialog, self).__init__()
|
||||||
|
|
||||||
if filterOptions is not None:
|
if filterOptions is not None and parent.getSeismicPhase() != "P":
|
||||||
self.filterOptions = filterOptions
|
self.filterOptions = filterOptions
|
||||||
else:
|
else:
|
||||||
self.filterOptions = FilterOptions()
|
self.filterOptions = FilterOptions()
|
||||||
@ -206,10 +206,10 @@ class FilterOptionsDialog(QDialog):
|
|||||||
|
|
||||||
self.setLayout(self.layoutEditables)
|
self.setLayout(self.layoutEditables)
|
||||||
|
|
||||||
self.freqminSpinBox.connect(self.updateUi)
|
self.freqminSpinBox.valueChanged.connect(self.updateUi)
|
||||||
self.freqmaxSpinBox.connect(self.updateUi)
|
self.freqmaxSpinBox.valueChanged.connect(self.updateUi)
|
||||||
self.orderSpinBox.connect(self.updateUi)
|
self.orderSpinBox.valueChanged.connect(self.updateUi)
|
||||||
self.selectTypeCombo.connect(self.updateUi)
|
self.selectTypeCombo.currentIndexChanged.connect(self.updateUi)
|
||||||
|
|
||||||
def updateUi(self):
|
def updateUi(self):
|
||||||
if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']:
|
if self.selectTypeCombo.currentText() not in ['bandpass', 'bandstop']:
|
||||||
|
Loading…
Reference in New Issue
Block a user