[Bugfix] Take into account if only local or moment magnitude has been

derived to write event list properly.
This commit is contained in:
Ludger Küperkoch 2021-07-05 11:29:44 +02:00
parent 3af02bbbf7
commit 8b03aab381

View File

@ -3269,12 +3269,24 @@ class MainWindow(QMainWindow):
item_depth.setText(str(origin.depth))
if hasattr(event, 'magnitudes'):
if event.magnitudes:
if len(event.magnitudes) > 1:
moment_magnitude = event.magnitudes[0]
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
item_momentmag.setText(str(moment_magnitude.mag))
local_magnitude = event.magnitudes[1]
local_magnitude.mag = '%4.1f' % local_magnitude.mag
item_momentmag.setText(str(moment_magnitude.mag))
item_localmag.setText(str(local_magnitude.mag))
else:
# check type of magnitude
if event.magnitudes[0].magnitude_type == 'Mw':
moment_magnitude = event.magnitudes[0]
moment_magnitude.mag = '%4.1f' % moment_magnitude.mag
item_momentmag.setText(str(moment_magnitude.mag))
elif event.magnitudes[0].magnitude_type == 'ML':
local_magnitude = event.magnitudes[0]
local_magnitude.mag = '%4.1f' % local_magnitude.mag
item_localmag.setText(str(local_magnitude.mag))
item_notes.setText(event.notes)
set_enabled(item_path, True, False)