[update] slightly improved feasibility using obspy_dmt with metadata and array map

This commit is contained in:
Marcel Paffrath 2018-07-23 16:03:15 +02:00
parent eb07c19c2e
commit ef6e011d22
2 changed files with 10 additions and 9 deletions

View File

@ -395,7 +395,7 @@ class MainWindow(QMainWindow):
"Ctrl+F", self.filter_icon, "Ctrl+F", self.filter_icon,
"""Adjust filter parameters.""") """Adjust filter parameters.""")
self.inventoryAction = self.createAction(self, "Manage &Inventories ...", self.inventoryAction = self.createAction(self, "Manage &Inventories ...",
self.get_new_metadata, self.add_metadata,
"Ctrl+I", self.inventoryIcon, "Ctrl+I", self.inventoryIcon,
"""Manage metadata for current project""", """Manage metadata for current project""",
False) False)
@ -1922,14 +1922,15 @@ class MainWindow(QMainWindow):
if True in self.comparable.values(): if True in self.comparable.values():
self.compare_action.setEnabled(True) self.compare_action.setEnabled(True)
self.draw() self.draw()
# MP MP ++++
# TODO: Quick and dirty, improve this on later iteration # TODO: Quick and dirty, improve this on later iteration
if self.obspy_dmt: if self.obspy_dmt:
self.metadata = Metadata(os.path.join(self.get_current_event_path(), 'resp')) invpath = os.path.join(self.get_current_event_path(), 'resp')
self.inventoryAction.setEnabled(not self.obspy_dmt) if not invpath in self.metadata.inventories:
self.initMapAction.setEnabled(self.obspy_dmt) self.metadata.add_inventory(invpath)
# MP MP --- # check if directory is empty
if os.listdir(invpath):
self.init_map_button.setEnabled(True)
self.initMapAction.setEnabled(True)
@staticmethod @staticmethod
def checkEvent4comparison(event): def checkEvent4comparison(event):
@ -3109,7 +3110,7 @@ class MainWindow(QMainWindow):
self.inventory_label.setText('Inventory set!') self.inventory_label.setText('Inventory set!')
self.setDirty(True) self.setDirty(True)
def get_new_metadata(self): def add_metadata(self):
self.add_metadata_widget = AddMetadataWidget(self, metadata=self.metadata) self.add_metadata_widget = AddMetadataWidget(self, metadata=self.metadata)
self.add_metadata_widget.close_button.clicked.connect(self.set_metadata) self.add_metadata_widget.close_button.clicked.connect(self.set_metadata)

View File

@ -196,7 +196,7 @@ class AddMetadataWidget(QWidget):
self.main_layout.insertWidget(2, self.list_view, 1) self.main_layout.insertWidget(2, self.list_view, 1)
def init_close(self): def init_close(self):
self.close_button = QPushButton('Close') self.close_button = QPushButton('Update')
self.close_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape)) self.close_button.setShortcut(QtGui.QKeySequence(QtCore.Qt.Key_Escape))
self.main_layout.addWidget(self.close_button) self.main_layout.addWidget(self.close_button)