Esempio n. 1
0
    def loadPreferences(self):
        """
        Load preferences relevant to this widget
        """
        prefs = self.pyweed.preferences

        self.waveformDirectory = prefs.Waveforms.saveDir

        self.timeWindowAdapter.setValues(
            safe_int(prefs.Waveforms.timeWindowBefore, 60),
            safe_int(prefs.Waveforms.timeWindowAfter,
                     600), prefs.Waveforms.timeWindowBeforePhase,
            prefs.Waveforms.timeWindowAfterPhase)

        self.saveFormatAdapter.setValue(prefs.Waveforms.saveFormat)
Esempio n. 2
0
 def showEvent(self, *args, **kwargs):
     """
     Perform any necessary initialization each time the dialog is opened
     """
     super(PreferencesDialog, self).showEvent(*args, **kwargs)
     # Indicate the currently selected data centers
     self.eventDataCenterAdapter.setValue(self.pyweed.event_data_center)
     self.stationDataCenterAdapter.setValue(self.pyweed.station_data_center)
     self.cacheSizeSpinBox.setValue(
         safe_int(self.pyweed.preferences.Waveforms.cacheSize, 10))
Esempio n. 3
0
    def loadPreferences(self):
        """
        Load preferences relevant to this widget
        """
        prefs = self.pyweed.preferences

        self.waveformDirectory = prefs.Waveforms.saveDir

        self.timeWindowAdapter.setValues(
            safe_int(prefs.Waveforms.timeWindowBefore, 60),
            safe_int(prefs.Waveforms.timeWindowAfter, 600),
            prefs.Waveforms.timeWindowBeforePhase,
            prefs.Waveforms.timeWindowAfterPhase
        )

        self.saveFormatAdapter.setValue(prefs.Waveforms.saveFormat)
        self.sacUseEventTimeCheckBox.setChecked(
            safe_bool(prefs.Waveforms.useEventTime)
        )
        self.hideNoDataCheckBox.setChecked(
            safe_bool(prefs.Waveforms.hideNoData)
        )
Esempio n. 4
0
    def initialize(self):
        """
        Most of the initialization should happen here. PyWEED has to create the MainWindow first, before
        it's fully configured everything (mainly because it needs to attach various other widgets and things
        to MainWindow). So __init__() above needs to be very minimal. Once everything is ready, the application
        will call initialize() and we can safely do all the "real" initialization.
        """
        prefs = self.pyweed.preferences

        # Set MainWindow properties
        self.setWindowTitle('%s version %s' % (__app_name__, __version__))

        # Options widgets
        self.eventOptionsWidget = EventOptionsWidget(
            self, self.pyweed.event_options, self.pyweed.station_options,
            self.eventOptionsDockWidget, self.toggleEventOptions)
        self.stationOptionsWidget = StationOptionsWidget(
            self, self.pyweed.station_options, self.pyweed.event_options,
            self.stationOptionsDockWidget, self.toggleStationOptions)

        # When any options change, enable the relevant download button
        self.eventOptionsWidget.changed.connect(lambda: self.getEventsButton.setEnabled(True))
        self.stationOptionsWidget.changed.connect(lambda: self.getStationsButton.setEnabled(True))

        # Map
        self.initializeMap()

        # When the options coordinates change, we want to update the map
        self.eventOptionsWidget.changedCoords.connect(
            lambda: self.updateSeismap(events=True)
        )
        self.stationOptionsWidget.changedCoords.connect(
            lambda: self.updateSeismap(stations=True)
        )

        # Table selection
        self.eventsTable.itemSelectionChanged.connect(self.onEventSelectionChanged)
        self.stationsTable.itemSelectionChanged.connect(self.onStationSelectionChanged)
        self.clearEventSelectionButton.clicked.connect(self.eventsTable.clearSelection)
        self.clearStationSelectionButton.clicked.connect(self.stationsTable.clearSelection)

        # Main window buttons
        self.getEventsButton.clicked.connect(self.getEvents)
        self.getStationsButton.clicked.connect(self.getStations)
        self.getWaveformsButton.clicked.connect(self.getWaveforms)

        # Size and placement according to preferences
        self.resize(
            safe_int(prefs.MainWindow.width, 1000),
            safe_int(prefs.MainWindow.height, 800))
        self.eventOptionsDockWidget.setFloating(safe_bool(prefs.MainWindow.eventOptionsFloat, False))
        self.stationOptionsDockWidget.setFloating(safe_bool(prefs.MainWindow.stationOptionsFloat, False))

        # Add spinner overlays to the event/station widgets
        self.eventsSpinner = SpinnerWidget("Loading events...", parent=self.eventsWidget)
        self.eventsSpinner.cancelled.connect(self.pyweed.events_handler.cancel)
        self.stationsSpinner = SpinnerWidget("Loading stations...", parent=self.stationsWidget)
        self.stationsSpinner.cancelled.connect(self.pyweed.stations_handler.cancel)

        # Do an initial update
        self.updateSeismap(events=True)
        self.updateSeismap(stations=True)

        self.manageGetWaveformsButton()