[change] delete old obspy dmt database files, current files unselectable

The metadata files that come from the obspy dmt database are saved in a list. When a new event is opened, the obspy dmt metadata files from the old event are deleted from the inventory (and the new ones are added). 
The metadata files from the obspy dmt database are now unselectable in the MetadataWidget. 
The clear inventory function is called when saving the project (otherwise the obspy dmt metadata gets saved and becomes editable). The update_obspy_dmt function is called after the save to get the obspy_dmt_metadata back to continue working after the save.
This commit is contained in:
Sally committed 2019-05-17 11:20:12 +02:00
1 parent be71fc0298
commit 8270bd4974
3 files changed
+19 -3

No files matched your search

+3 -1
View File
@@ -206,7 +206,7 @@ class AddMetadataWidget(QWidget):
def init_add_remove_buttons(self):
self.add_remove_layout = QVBoxLayout()
self.add_button = self.init_button("Add", Qt.Key_Insert, "Choose a file to add \n(Ins)")
self.remove_button = self.init_button("Remove", Qt.Key_Delete, "Remove selected file \n(Del)")
self.remove_button = self.init_button("Remove", Qt.Key_Delete, "Remove selected file(s) \n(Del)")
self.add_remove_layout.addWidget(self.add_button, 0, QtCore.Qt.AlignBottom)
self.add_remove_layout.addWidget(self.remove_button, 0, QtCore.Qt.AlignTop)
self.list_buttons_layout.insertLayout(1, self.add_remove_layout, 0)
@@ -252,6 +252,8 @@ class AddMetadataWidget(QWidget):
for inventory_path in self.metadata.inventories:
item = QtGui.QStandardItem(inventory_path)
self.list_model.appendRow(item)
if inventory_path in self.metadata.obspy_dmt_invs:
item.setFlags(Qt.NoItemFlags)
def directory_to_lineedit(self):
inventory_path = self.open_directory()