Skip to content

Commit 66f005a

Browse files
authored
Merge pull request #1727 from knutfrode/dev
opendrift_gui: setting mode to Config after the run, to allow adjusti…
2 parents 8e92c12 + e35e39c commit 66f005a

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

opendrift/scripts/opendrift_gui.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from opendrift.models.openberg import OpenBerg
2626
from opendrift.models.plastdrift import PlastDrift
2727
from opendrift.models.radionuclides import RadionuclideDrift
28+
from opendrift.models.basemodel import Mode
2829

2930
# Class to redirect output to text box
3031
class TextRedirector:
@@ -487,10 +488,12 @@ def validate_config(self, value_if_allowed, prior_value, key):
487488
value_if_allowed = float(value_if_allowed)
488489
except:
489490
return False
491+
490492
try:
491493
self.o.set_config(key, value_if_allowed)
492494
return True
493-
except:
495+
except Exception as e:
496+
print(e)
494497
return False
495498

496499
def set_model(self, model, rebuild_gui=True, logfile=None):
@@ -880,6 +883,8 @@ def run_opendrift(self):
880883
command=lambda: self.handle_result(
881884
'copy_netcdf')).grid(row=81, column=1)
882885

886+
# Allow setting config for next run
887+
self.o.mode = Mode.Config
883888

884889
def main():
885890
parser = argparse.ArgumentParser()

0 commit comments

Comments
 (0)