Commit 1bb4c600 authored by Christoph Sommer's avatar Christoph Sommer

parameter class will be subclassed

parent 9091d452
...@@ -24,14 +24,14 @@ class GuiParams(dict): ...@@ -24,14 +24,14 @@ class GuiParams(dict):
params = json.load(read_file) params = json.load(read_file)
for k, v in params.items(): for k, v in params.items():
self[k] = v self[k] = v
GuiParams._file = proj_fn self.__class__._file = proj_fn
def saveas(self, proj_fn): def saveas(self, proj_fn):
GuiParams._file = proj_fn self.__class__._file = proj_fn
self.save() self.save()
def save(self): def save(self):
with open(GuiParams._file, "w") as save_file: with open(self.__class__._file, "w") as save_file:
json.dump(self, save_file) json.dump(self, save_file)
def initialize(self): def initialize(self):
...@@ -54,7 +54,7 @@ params = GuiParams() ...@@ -54,7 +54,7 @@ params = GuiParams()
params.initialize() params.initialize()
### GUI widgets ### GUI widgets
def select_project(): def select_project(default_name="./bif_care.json", params=params):
btn_new_proj = widgets.Button(description="New") btn_new_proj = widgets.Button(description="New")
btn_load_proj = widgets.Button(description="Load") btn_load_proj = widgets.Button(description="Load")
...@@ -62,7 +62,7 @@ def select_project(): ...@@ -62,7 +62,7 @@ def select_project():
@out_project.capture(clear_output=True, wait=True) @out_project.capture(clear_output=True, wait=True)
def btn_btn_new_proj_clicked(btn): def btn_btn_new_proj_clicked(btn):
new_proj_fn = gui_fsavename("./bif_care.json") new_proj_fn = gui_fsavename(default_name)
if len(new_proj_fn) == 0: if len(new_proj_fn) == 0:
return return
params.initialize() params.initialize()
...@@ -266,7 +266,7 @@ def select_patch_parameter(): ...@@ -266,7 +266,7 @@ def select_patch_parameter():
### Train parameter ### Train parameter
################### ###################
def select_train_paramter(): def select_train_paramter(params=params):
### Training epochs ### Training epochs
################### ###################
int_train_epochs = widgets.BoundedIntText(min=1, max=4096, step=1, value=params['train_epochs']) int_train_epochs = widgets.BoundedIntText(min=1, max=4096, step=1, value=params['train_epochs'])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment