[bugfix] default phases from obspy not unique
[add] toggle button for checking phases
This commit is contained in:
parent
f93713fdad
commit
04d43f67c5
@ -775,6 +775,7 @@ class PhaseDefaults (QtGui.QDialog):
|
|||||||
current_phases=[]):
|
current_phases=[]):
|
||||||
super (PhaseDefaults, self).__init__ (parent)
|
super (PhaseDefaults, self).__init__ (parent)
|
||||||
self.nrow = nrow
|
self.nrow = nrow
|
||||||
|
self.checktoggle = True
|
||||||
self.main_layout = QtGui.QVBoxLayout ()
|
self.main_layout = QtGui.QVBoxLayout ()
|
||||||
self.sub_layout = QtGui.QGridLayout ()
|
self.sub_layout = QtGui.QGridLayout ()
|
||||||
self.phase_names = phase_defaults
|
self.phase_names = phase_defaults
|
||||||
@ -786,19 +787,28 @@ class PhaseDefaults (QtGui.QDialog):
|
|||||||
self.selected_phases = []
|
self.selected_phases = []
|
||||||
|
|
||||||
def setButtons(self):
|
def setButtons(self):
|
||||||
|
self._check_all_button = QtGui.QPushButton('Check/Uncheck all')
|
||||||
self._buttonbox = QDialogButtonBox (QDialogButtonBox.Ok |
|
self._buttonbox = QDialogButtonBox (QDialogButtonBox.Ok |
|
||||||
QDialogButtonBox.Cancel)
|
QDialogButtonBox.Cancel)
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setLayout (self.main_layout)
|
self.setLayout (self.main_layout)
|
||||||
|
self.main_layout.addWidget(self._check_all_button)
|
||||||
self.main_layout.addLayout (self.sub_layout)
|
self.main_layout.addLayout (self.sub_layout)
|
||||||
self.init_phase_layout ()
|
self.init_phase_layout ()
|
||||||
self.main_layout.addWidget (self._buttonbox)
|
self.main_layout.addWidget (self._buttonbox)
|
||||||
|
|
||||||
def connectSignals(self):
|
def connectSignals(self):
|
||||||
|
self._check_all_button.clicked.connect(self.toggleAllChecked)
|
||||||
self._buttonbox.accepted.connect (self.accept)
|
self._buttonbox.accepted.connect (self.accept)
|
||||||
self._buttonbox.rejected.connect (self.reject)
|
self._buttonbox.rejected.connect (self.reject)
|
||||||
|
|
||||||
|
def toggleAllChecked(self):
|
||||||
|
for box in self._checkboxes.values():
|
||||||
|
box.setChecked(self.checktoggle)
|
||||||
|
print(box.text(), box.isChecked())
|
||||||
|
self.checktoggle = not self.checktoggle
|
||||||
|
|
||||||
def init_phase_layout(self):
|
def init_phase_layout(self):
|
||||||
self._checkboxes = {}
|
self._checkboxes = {}
|
||||||
row = 0
|
row = 0
|
||||||
@ -1084,8 +1094,8 @@ class PickDlg (QDialog):
|
|||||||
self.arrivals.plot(ax=ax, show=False)
|
self.arrivals.plot(ax=ax, show=False)
|
||||||
ax.legend()
|
ax.legend()
|
||||||
self.phaseplot.new = False
|
self.phaseplot.new = False
|
||||||
self.phaseplot.show()
|
|
||||||
self.phaseplot.draw()
|
self.phaseplot.draw()
|
||||||
|
self.phaseplot.show()
|
||||||
|
|
||||||
def setDirty(self, bool):
|
def setDirty(self, bool):
|
||||||
self._dirty = bool
|
self._dirty = bool
|
||||||
@ -3081,8 +3091,10 @@ class PhasesTab (PropTab):
|
|||||||
parameter = self.inputs
|
parameter = self.inputs
|
||||||
if parameter.get ('extent') == 'global':
|
if parameter.get ('extent') == 'global':
|
||||||
# get all default phase names known to obspy.taup
|
# get all default phase names known to obspy.taup
|
||||||
# in a list
|
# in a list and remove duplicates
|
||||||
phases = get_phase_names ('ttall')
|
phases = list(set(get_phase_names ('ttall')))
|
||||||
|
phases.sort()
|
||||||
|
|
||||||
phaseDefaults = PhaseDefaults (self, phase_defaults=phases,
|
phaseDefaults = PhaseDefaults (self, phase_defaults=phases,
|
||||||
current_phases=current_phases)
|
current_phases=current_phases)
|
||||||
if phaseDefaults.exec_ ():
|
if phaseDefaults.exec_ ():
|
||||||
|
Loading…
Reference in New Issue
Block a user