From 8e09fd7c4293e842813fe8836031d17727812601 Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Tue, 7 Jun 2016 13:51:03 +0200 Subject: [PATCH] [refs #195] pushing GUI element implementation forward --- QtPyLoT.py | 8 ++++++-- pylot/core/util/widgets.py | 37 ++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/QtPyLoT.py b/QtPyLoT.py index e8709d0c..f3c21ba7 100755 --- a/QtPyLoT.py +++ b/QtPyLoT.py @@ -42,6 +42,7 @@ from obspy import UTCDateTime from pylot.core.io.data import Data from pylot.core.io.inputs import FilterOptions, AutoPickParameter from pylot.core.pick.autopick import autopickevent +from pylot.core.pick.compare import Comparison from pylot.core.io.phases import picksdict_from_picks from pylot.core.loc.nll import locate as locateNll from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP, \ @@ -53,7 +54,8 @@ from pylot.core.util.utils import fnConstructor, getLogin, \ getGlobalTimes from pylot.core.io.location import create_creation_info, create_event from pylot.core.util.widgets import FilterOptionsDialog, NewEventDlg, \ - WaveformWidget, PropertiesDlg, HelpForm, createAction, PickDlg, getDataType + WaveformWidget, PropertiesDlg, HelpForm, createAction, PickDlg, \ + getDataType, ComparisonDialog from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.thread import AutoPickThread from pylot.core.util.version import get_git_version as _getVersionString @@ -578,7 +580,9 @@ class MainWindow(QMainWindow): def comparePicks(self): if self.check4Comparison(): - compare_dlg = ComparisonDialog(self) + co = Comparison(auto=self.getPicks('auto'), manu=self.getPicks()) + compare_dlg = ComparisonDialog(co, self) + compare_dlg.exec_() def getPlotWidget(self): return self.DataPlot diff --git a/pylot/core/util/widgets.py b/pylot/core/util/widgets.py index 0b30c0c8..16beb544 100644 --- a/pylot/core/util/widgets.py +++ b/pylot/core/util/widgets.py @@ -64,16 +64,43 @@ def createAction(parent, text, slot=None, shortcut=None, icon=None, action.setCheckable(True) return action -class ComparsionDialog(QDialog): +class ComparisonDialog(QDialog): def __init__(self, c, parent=None): self._data = c self._stats = c.keys() - self._canvas = PlotWidget(parent) - super(ComparsionDialog, self).__init__(parent) - self + self._canvas = PlotWidget(self) + super(ComparisonDialog, self).__init__(parent) + self.setupUI() def setupUI(self): - pass + + _outerlayout = QVBoxLayout(self) + _innerlayout = QVBoxLayout(self) + + _stats_combobox = QComboBox(self) + _stats_combobox.setEditable(True) + _stats_combobox.addItems(self.stations) + _stats_combobox.textChanged.connect(self.plotcomparison) + + _phases_combobox = QComboBox(self) + _phases_combobox.addItems(['P', 'S']) + + _toolbar = QToolBar(self) + _toolbar.addWidget(_stats_combobox) + _toolbar.addWidget(_phases_combobox) + + _buttonbox = QDialogButtonBox(QDialogButtonBox.Close) + + _innerlayout.addWidget(self.canvas) + _innerlayout.addWidget(_buttonbox) + + _outerlayout.addWidget(_toolbar) + _outerlayout.addLayout(_innerlayout) + + _buttonbox.rejected.connect(self.reject) + + # finally layout the entire dialog + self.setLayout(_outerlayout) @property def canvas(self):