[bugfix] #267 Remove stations from ArrayMap whose metadata files were removed

Fixes https://ariadne.geophysik.ruhr-uni-bochum.de/trac/PyLoT/ticket/267
This commit is contained in:
Darius Arnold 2018-12-07 11:19:54 +01:00
parent f1690edf71
commit 45949afca6
2 changed files with 7 additions and 0 deletions

View File

@ -2906,6 +2906,10 @@ class MainWindow(QMainWindow):
self.get_metadata will be called. self.get_metadata will be called.
''' '''
self.tabs.setCurrentIndex(1) self.tabs.setCurrentIndex(1)
# if there is no metadata (invetories is an empty list), just initialize the default empty tab
if not self.metadata.inventories:
self.init_array_tab()
return
if hasattr(self, 'metadata_widget'): if hasattr(self, 'metadata_widget'):
if self.metadata_widget: if self.metadata_widget:
self.metadata_widget.setParent(None) self.metadata_widget.setParent(None)

View File

@ -85,6 +85,9 @@ class Metadata(object):
for seed_id in self.seed_ids.keys(): for seed_id in self.seed_ids.keys():
if self.seed_ids[seed_id].startswith(path_to_inventory): if self.seed_ids[seed_id].startswith(path_to_inventory):
del (self.seed_ids[seed_id]) del (self.seed_ids[seed_id])
# have to clean self.stations_dict as well
# this will be rebuilt for the next init of the arraymap anyway, so just reset it
self.stations_dict = {}
def get_metadata(self, seed_id, time=None): def get_metadata(self, seed_id, time=None):
""" """