def on_ParamsUpdate_mouseClick(self,event): model = self.get_Model() if model == None: return # params = self.get_Params() model.set_param(**params) self.UpdateGuiFromModel()
def on_ParamsUpdate_mouseClick(self, event): model = self.get_Model() if model == None: return # params = self.get_Params() model.set_param(**params) self.UpdateGuiFromModel()
def UpdateModelFromGui(self): """ create a new model instance """ mname = self.components.SaveName.text.strip() if len(mname) == 0: print "Model save name required" return # params = self.get_Params() theta = self.get_Theta() delta = float(self.components.SlabDelta.text) layers = self.components.LayerList.items layers = self.sort_LayerList(layers, reverse=False) # mlayers = [] for layer in layers: comp = compound.parse_fmt_formula(str(layer[1])) if comp == []: print "Error parsing formula" return thick = float(layer[2]) density = float(layer[3]) rough = float(layer[4]) m = interface_model.Layer(comp=comp, density=density, roughness=rough, thickness=thick) mlayers.append(copy.copy(m)) # model = interface_model.Model(substrate=None, layers=mlayers, top=None, theta=theta, params=params) model.slabify(delta=delta) model.set_param(fyel=params["fyel"]) # if model: self.set_data(mname, model) self.components.Model.text = mname
def UpdateModelFromGui(self): """ create a new model instance """ mname = self.components.SaveName.text.strip() if len(mname) == 0: print "Model save name required" return # params = self.get_Params() theta = self.get_Theta() delta = float(self.components.SlabDelta.text) layers = self.components.LayerList.items layers = self.sort_LayerList(layers, reverse=False) # mlayers = [] for layer in layers: comp = compound.parse_fmt_formula(str(layer[1])) if comp == []: print "Error parsing formula" return thick = float(layer[2]) density = float(layer[3]) rough = float(layer[4]) m = interface_model.Layer(comp=comp, density=density, roughness=rough, thickness=thick) mlayers.append(copy.copy(m)) # model = interface_model.Model(substrate=None, layers=mlayers, top=None, theta=theta, params=params) model.slabify(delta=delta) model.set_param(fyel=params['fyel']) # if model: self.set_data(mname, model) self.components.Model.text = mname