diff --git a/pyweed/gui/MainWindow.py b/pyweed/gui/MainWindow.py
index dbebe0e..ad9253c 100644
--- a/pyweed/gui/MainWindow.py
+++ b/pyweed/gui/MainWindow.py
@@ -421,6 +421,8 @@ def onEventSelectionChanged(self):
self.seismap.addEventsHighlighting(points)
+ self.stationOptionsWidget.onEventSelectionChanged()
+
self.manageGetWaveformsButton()
def selectAllStations(self):
diff --git a/pyweed/gui/OptionsWidget.py b/pyweed/gui/OptionsWidget.py
index a205282..69d606e 100644
--- a/pyweed/gui/OptionsWidget.py
+++ b/pyweed/gui/OptionsWidget.py
@@ -122,7 +122,7 @@ def isCoordinateInput(self, key):
Return true if the given key represents a coordinate input.
Subclasses may override/extend this.
"""
- for marker in ('latitude', 'longitude', 'radius', '_location',):
+ for marker in ('latitude', 'longitude', 'radius', '_location', 'distance',):
if marker in key:
return True
return False
diff --git a/pyweed/gui/StationOptionsWidget.py b/pyweed/gui/StationOptionsWidget.py
index 0525f70..81274bf 100644
--- a/pyweed/gui/StationOptionsWidget.py
+++ b/pyweed/gui/StationOptionsWidget.py
@@ -75,3 +75,14 @@ def get_timeFromOtherButton(self):
def get_locationFromOtherButton(self):
return self.locationFromEventsToolButton
+ def onEventSelectionChanged(self):
+ """
+ This should be called whenever the event selection has changed.
+ If the "distance from selected events" is enabled, this will emit a
+ change event.
+ """
+ key = '_locationDistanceFromEvents'
+ LOGGER.debug("StationOptionsWidget.onEventSelectionChanged: %s", self.getInputValue(key))
+ if self.getInputValue(key):
+ self.changed.emit(key)
+ self.changedCoords.emit(key)
diff --git a/pyweed/gui/uic/StationOptionsWidget.py b/pyweed/gui/uic/StationOptionsWidget.py
index a783bf1..1aba220 100644
--- a/pyweed/gui/uic/StationOptionsWidget.py
+++ b/pyweed/gui/uic/StationOptionsWidget.py
@@ -25,7 +25,7 @@ def _translate(context, text, disambig):
class Ui_StationOptionsWidget(object):
def setupUi(self, StationOptionsWidget):
StationOptionsWidget.setObjectName(_fromUtf8("StationOptionsWidget"))
- StationOptionsWidget.resize(302, 707)
+ StationOptionsWidget.resize(302, 682)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
@@ -357,18 +357,9 @@ def setupUi(self, StationOptionsWidget):
self.label_9.setObjectName(_fromUtf8("label_9"))
self.horizontalLayout_16.addWidget(self.label_9)
self.verticalLayout_11.addLayout(self.horizontalLayout_16)
- self.horizontalLayout_12 = QtGui.QHBoxLayout()
- self.horizontalLayout_12.setSpacing(0)
- self.horizontalLayout_12.setObjectName(_fromUtf8("horizontalLayout_12"))
- spacerItem8 = QtGui.QSpacerItem(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout_12.addItem(spacerItem8)
- self.toolButton = QtGui.QToolButton(self.locationGroupBox)
- self.toolButton.setObjectName(_fromUtf8("toolButton"))
- self.horizontalLayout_12.addWidget(self.toolButton)
- self.verticalLayout_11.addLayout(self.horizontalLayout_12)
self.horizontalLayout_11.addLayout(self.verticalLayout_11)
- spacerItem9 = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
- self.horizontalLayout_11.addItem(spacerItem9)
+ spacerItem8 = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout_11.addItem(spacerItem8)
self.horizontalLayout_11.setStretch(1, 1)
self.verticalLayout_10.addLayout(self.horizontalLayout_11)
self.verticalLayout_4.addLayout(self.verticalLayout_10)
@@ -387,8 +378,8 @@ def setupUi(self, StationOptionsWidget):
self.locationFromEventsToolButton.setObjectName(_fromUtf8("locationFromEventsToolButton"))
self.verticalLayout_4.addWidget(self.locationFromEventsToolButton)
self.verticalLayout.addWidget(self.locationGroupBox)
- spacerItem10 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
- self.verticalLayout.addItem(spacerItem10)
+ spacerItem9 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout.addItem(spacerItem9)
self.retranslateUi(StationOptionsWidget)
QtCore.QMetaObject.connectSlotsByName(StationOptionsWidget)
@@ -432,6 +423,5 @@ def retranslateUi(self, StationOptionsWidget):
self.locationDistanceFromEventsRadioButton.setText(_translate("StationOptionsWidget", "Distance from selected events", None))
self.label_3.setText(_translate("StationOptionsWidget", "-", None))
self.label_9.setText(_translate("StationOptionsWidget", "degrees", None))
- self.toolButton.setText(_translate("StationOptionsWidget", "Update", None))
self.locationFromEventsToolButton.setText(_translate("StationOptionsWidget", ">> Copy Location from Event Options", None))
diff --git a/pyweed/gui/uic/StationOptionsWidget.ui b/pyweed/gui/uic/StationOptionsWidget.ui
index 926f59b..fa2489b 100644
--- a/pyweed/gui/uic/StationOptionsWidget.ui
+++ b/pyweed/gui/uic/StationOptionsWidget.ui
@@ -7,7 +7,7 @@
0
0
302
- 707
+ 682
@@ -756,27 +756,6 @@
- -
-
-
- 0
-
-
-
-
-
- Qt::Horizontal
-
-
-
- -
-
-
- Update
-
-
-
-
-
-
diff --git a/pyweed/pyweed_utils.py b/pyweed/pyweed_utils.py
index f6eb6a6..f11b103 100644
--- a/pyweed/pyweed_utils.py
+++ b/pyweed/pyweed_utils.py
@@ -118,15 +118,16 @@ def iter_channels(inventory, dedupe=True):
multiple epochs for a given channel. Only the first channel will be included in this case.
"""
last_sncl = None
- for network in inventory.networks:
- for station in network.stations:
- for channel in station.channels:
- if dedupe:
- sncl = get_sncl(network, station, channel)
- if sncl == last_sncl:
- continue
- last_sncl = sncl
- yield (network, station, channel)
+ if inventory:
+ for network in inventory.networks:
+ for station in network.stations:
+ for channel in station.channels:
+ if dedupe:
+ sncl = get_sncl(network, station, channel)
+ if sncl == last_sncl:
+ continue
+ last_sncl = sncl
+ yield (network, station, channel)
def get_sncl(network, station, channel):