Skip to content

Commit

Permalink
Expanded events that trigger updates to the "distance from events" ma…
Browse files Browse the repository at this point in the history
…rkers on the map. #33
  • Loading branch information
adam-iris committed Oct 3, 2017
1 parent 372dbd5 commit cdaf57e
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 47 deletions.
2 changes: 2 additions & 0 deletions pyweed/gui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ def onEventSelectionChanged(self):

self.seismap.addEventsHighlighting(points)

self.stationOptionsWidget.onEventSelectionChanged()

self.manageGetWaveformsButton()

def selectAllStations(self):
Expand Down
2 changes: 1 addition & 1 deletion pyweed/gui/OptionsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions pyweed/gui/StationOptionsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 5 additions & 15 deletions pyweed/gui/uic/StationOptionsWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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))

23 changes: 1 addition & 22 deletions pyweed/gui/uic/StationOptionsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>302</width>
<height>707</height>
<height>682</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -756,27 +756,6 @@
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_12">
<property name="spacing">
<number>0</number>
</property>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="toolButton">
<property name="text">
<string>Update</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
Expand Down
19 changes: 10 additions & 9 deletions pyweed/pyweed_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit cdaf57e

Please sign in to comment.