def callback_add_page(self): new_sim_name=dlg_get_text( _("New laser name:"), _("laser ")+str(self.notebook.count()),"new.png") if new_sim_name.ret!=None: index=laser_new_filename() inp_copy_file("laser"+str(index)+".inp","laser0.inp") inp_update_token_value("laser"+str(index)+".inp", "#laser_name", new_sim_name.ret,1) self.add_page(index)
def layer_add(self): obj=self.gl_objects_get_first_selected() if obj!=None: epi=get_epi() s=epi.find_shape_by_id(obj.id[0]) if type(s)==epi_layer or type(s)==shape: layer_index=epi.find_layer_by_id(obj.id[0]) new_filename=epi.new_electrical_file("shape")+".inp" orig_filename=os.path.join(get_default_material_path(),"shape.inp") inp_copy_file(os.path.join(get_sim_path(),new_filename),os.path.join(get_sim_path(),orig_filename)) mesh=get_mesh() my_shape=shape() my_shape.load(new_filename) my_shape.dy=epi.layers[layer_index].dy my_shape.dx=mesh.get_xlen() my_shape.dz=mesh.get_zlen() my_shape.shape_electrical=epi.gen_new_electrical_file("electrical") my_shape.shape_nx=1 my_shape.shape_ny=1 my_shape.shape_nz=1 my_shape.name="New shape" my_shape.save() epi.layers[layer_index].shapes.append(my_shape) epi.save() self.force_redraw()
def callback_copy_page(self): tab = self.notebook.currentWidget() old_index = tab.index new_sim_name = dlg_get_text( _("Clone the current experiment to a new experiment called") + ":", tab.tab_name.split("@")[0], "clone.png") new_sim_name = new_sim_name.ret if new_sim_name != None: new_sim_name = new_sim_name + "@" + tab.tab_name.split("@")[1] index = experiment_new_filename("fxdomain") if inp_copy_file( os.path.join(get_sim_path(), "fxdomain" + str(index) + ".inp"), os.path.join(get_sim_path(), "fxdomain" + str(old_index) + ".inp")) == False: print("Error copying file" + os.path.join(get_sim_path(), "fxdomain" + str(old_index) + ".inp")) return if inp_copy_file( os.path.join(get_sim_path(), "fxmesh" + str(index) + ".inp"), os.path.join(get_sim_path(), "fxmesh" + str(old_index) + ".inp")) == False: print("Error copying file" + os.path.join(get_sim_path(), "fxdomain" + str(old_index) + ".inp")) return inp_update_token_value( os.path.join(get_sim_path(), "fxdomain" + str(index) + ".inp"), "#sim_menu_name", new_sim_name) self.add_page(index) self.changed.emit()
def gen_new_electrical_file(self,prefix): new_file_name=self.new_electrical_file(prefix) full_new_file_name=new_file_name+".inp" db_file=os.path.join(get_default_material_path(),prefix+".inp") if inp().isfile(full_new_file_name)==False: inp_copy_file(full_new_file_name,db_file) return new_file_name
def callback_add_page(self): new_sim_name = dlg_get_text(_("New laser name:"), _("laser ") + str(self.notebook.count()), "document-new.png") if new_sim_name.ret != None: index = laser_new_filename() inp_copy_file("laser" + str(index) + ".inp", "laser0.inp") inp_update_token_value("laser" + str(index) + ".inp", "#laser_name", new_sim_name.ret) self.add_page(index)
def callback_add_page(self): new_sim_name=dlg_get_text( _("New experiment name:"), _("experiment ")+str(self.notebook.count()+1),"new.png") if new_sim_name.ret!=None: index=experiment_new_filename() inp_copy_file("pulse"+str(index)+".inp","pulse0.inp") inp_copy_file("time_mesh_config"+str(index)+".inp","time_mesh_config0.inp") inp_update_token_value("pulse"+str(index)+".inp", "#sim_menu_name", new_sim_name.ret+"@pulse",1) self.add_page(index) self.changed.emit()
def callback_add_page(self, widget, data=None): new_sim_name=dlg_get_text( _("New experiment name:"), _("experiment ")+str(len(self.notebook.get_children())+1)) if new_sim_name!=None: index=experiment_new_filename() inp_copy_file("pulse"+str(index)+".inp","pulse0.inp") inp_copy_file("time_mesh_config"+str(index)+".inp","time_mesh_config0.inp") inp_update_token_value("pulse"+str(index)+".inp", "#sim_menu_name", new_sim_name+"@pulse",1) self.add_page(index) global_object_get("tb_item_sim_mode_update")()
def callback_add_page(self): new_sim_name=dlg_get_text( _("New experiment name:"), _("experiment ")+str(self.notebook.count()+1),"new.png") new_sim_name=new_sim_name.ret if new_sim_name!=None: index=experiment_new_filename() inp_copy_file("fxdomain"+str(index)+".inp","fxdomain0.inp") inp_copy_file("fxmesh"+str(index)+".inp","fxmesh0.inp") inp_update_token_value("fxdomain"+str(index)+".inp", "#sim_menu_name", new_sim_name+"@fxdomain",1) self.add_page(index) self.changed.emit()
def callback_add_page(self): new_sim_name = dlg_get_text( _("New measurement name") + ":", _("measurement ") + str(self.notebook.count() + 1), "document-new.png") if new_sim_name.ret != None: index = measure_new_filename() inp_copy_file( os.path.join(get_sim_path(), "measure" + str(index) + ".inp"), os.path.join(get_sim_path(), "measure0.inp")) inp_update_token_value( os.path.join(get_sim_path(), "measure" + str(index) + ".inp"), "#measure_name", new_sim_name.ret) self.add_page(index)
def callback_add_page(self): new_sim_name = dlg_get_text( _("New experiment name") + ":", _("experiment ") + str(self.notebook.count() + 1), "document-new.png") if new_sim_name.ret != None: index = experiment_new_filename("jv") inp_copy_file( os.path.join(get_sim_path(), "jv" + str(index) + ".inp"), os.path.join(get_sim_path(), "jv0.inp")) inp_update_token_value( os.path.join(get_sim_path(), "jv" + str(index) + ".inp"), "#sim_menu_name", new_sim_name.ret + "@jv") self.add_page(index) self.changed.emit()
def callback_add_page(self): new_sim_name = dlg_get_text(self.new_dlg_text + ":", self.new_name(), "document-new.png") if new_sim_name.ret != None: number = self.new_filenumber() for b in range(0, len(self.base_file_name)): new_filename = self.base_file_name[b] + number + ".inp" orig_filename = self.base_file_name[b] + "0.inp" inp_copy_file(os.path.join(get_sim_path(), new_filename), os.path.join(get_sim_path(), orig_filename)) if b == 0: inp_update_token_value( os.path.join(get_sim_path(), new_filename), self.name_token, new_sim_name.ret + self.postfix) emit_file_name = new_filename self.added.emit(emit_file_name)
def callback_copy_page(self,widget,data): pageNum = self.notebook.get_current_page() tab = self.notebook.get_nth_page(pageNum) old_index=tab.index new_sim_name=dlg_get_text( _("Clone the current experiment to a new experiment called:"), tab.tab_name.split("@")[0]) if new_sim_name!=None: new_sim_name=new_sim_name+"@"+tab.tab_name.split("@")[1] index=experiment_new_filename() if inp_copy_file("pulse"+str(index)+".inp","pulse"+str(old_index)+".inp")==False: print "Error copying file"+"pulse"+str(old_index)+".inp" return if inp_copy_file("time_mesh_config"+str(index)+".inp","time_mesh_config"+str(old_index)+".inp")==False: print "Error copying file"+"pulse"+str(old_index)+".inp" return inp_update_token_value("pulse"+str(index)+".inp", "#sim_menu_name", new_sim_name,1) self.add_page(index) global_object_get("tb_item_sim_mode_update")()
def callback_copy_page(self,widget,data): pageNum = self.notebook.get_current_page() tab = self.notebook.get_nth_page(pageNum) old_index=tab.index new_sim_name=dlg_get_text( _("Clone the current experiment to a new experiment called:"), tab.tab_name.split("@")[0],image_name="clone.png") if new_sim_name!=None: new_sim_name=new_sim_name+"@"+tab.tab_name.split("@")[1] index=experiment_new_filename() if inp_copy_file("fxdomain"+str(index)+".inp","fxdomain"+str(old_index)+".inp")==False: print("Error copying file"+"fxdomain"+str(old_index)+".inp") return if inp_copy_file("fxmesh"+str(index)+".inp","fxmesh"+str(old_index)+".inp")==False: print("Error copying file"+"fxdomain"+str(old_index)+".inp") return inp_update_token_value("fxdomain"+str(index)+".inp", "#sim_menu_name", new_sim_name,1) self.add_page(index) self.changed.emit()
def update_layer_type(self, layer, data): l = self.layers[layer] if data == "active" and l.dos_file.startswith("dos") == False: l.dos_file = self.new_electrical_file("dos") mat_dir = os.path.join(get_materials_path(), l.optical_material) new_dos_file = l.dos_file + ".inp" if inp().isfile(new_dos_file) == False: dos_path_generic = os.path.join(get_default_material_path(), "dos.inp") inp_copy_file(new_dos_file, dos_path_generic) dos_path_material = os.path.join(mat_dir, "dos.inp") if os.path.isfile(dos_path_material) == True: archive_merge_file( os.path.join(get_sim_path(), "sim.gpvdm"), os.path.join(mat_dir, "sim.gpvdm"), new_dos_file, "dos.inp") if data == "active" and l.pl_file.startswith("pl") == False: l.pl_file = self.gen_new_electrical_file("pl") if data == "active" and l.lumo_file.startswith("lumo") == False: l.lumo_file = self.gen_new_electrical_file("lumo") if data == "active" and l.homo_file.startswith("h**o") == False: l.homo_file = self.gen_new_electrical_file("h**o") #if l.electrical_file=="none" or inp().isfile(l.electrical_file+".inp")==False: # l.electrical_file=self.gen_new_electrical_file("electrical") l.layer_type = data if data != "active": l.dos_file = data l.pl_file = "none" l.lumo_file = "none" l.homo_file = "none" self.clean_unused_files()
def add_new_electrical_to_shape(self,shape_file): s=self.find_shape_by_file_name(shape_file) if s.shape_dos!="none": return s.shape_dos new_file=self.new_electrical_file("electrical") s.shape_dos=new_file inp_update_token_value(s.file_name,"#shape_electrical",s.shape_electrical) new_electrical_file=new_file+".inp" if inp().isfile(new_electrical_file)==False: electrical_path_generic=os.path.join(get_default_material_path(),"electrical.inp") inp_copy_file(new_electrical_file,electrical_path_generic) return new_file
def callback_copy_page(self): tab = self.notebook.currentWidget() old_index=tab.index new_sim_name=dlg_get_text( _("Clone the current experiment to a new experiment called:"), tab.tab_name.split("@")[0],"clone.png") new_sim_name=new_sim_name.ret if new_sim_name!=None: new_sim_name=new_sim_name+"@"+tab.tab_name.split("@")[1] index=experiment_new_filename() if inp_copy_file("pulse"+str(index)+".inp","pulse"+str(old_index)+".inp")==False: print("Error copying file"+"pulse"+str(old_index)+".inp") return if inp_copy_file("time_mesh_config"+str(index)+".inp","time_mesh_config"+str(old_index)+".inp")==False: print("Error copying file"+"pulse"+str(old_index)+".inp") return inp_update_token_value("pulse"+str(index)+".inp", "#sim_menu_name", new_sim_name,1) self.add_page(index) self.changed.emit()
def active_layer_edit(self, widget, path, text, model): old_text=self.model[path][COLUMN_DEVICE] self.model[path][COLUMN_DEVICE]=text if yes_no(old_text)==False and yes_no(text)==True: self.model[path][COLUMN_DOS_LAYER]=epitay_get_next_dos() self.model[path][COLUMN_PL_FILE]=epitay_get_next_pl() new_file=self.model[path][COLUMN_DOS_LAYER]+".inp" if inp_isfile(new_file)==False: inp_copy_file(new_file,"dos0.inp") new_file=self.model[path][COLUMN_PL_FILE]+".inp" if inp_isfile(new_file)==False: inp_copy_file(new_file,"pl0.inp") if yes_no(text)==False: self.model[path][COLUMN_DOS_LAYER]="none" self.model[path][COLUMN_PL_FILE]="none" self.save_model() self.refresh(True)
def callback_copy_page(self): tab = self.notebook.currentWidget() new_sim_name=dlg_get_text(_("Clone the current laser to a new laser called:"), "clone.png") if new_sim_name.ret!=None: index=laser_new_filename() if inp_copy_file("laser"+str(index)+".inp",tab.file_name)==False: print ("Error copying file"+tab.file_name) return inp_update_token_value("laser"+str(index)+".inp", "#laser_name", new_sim_name.ret,1) self.add_page(index)
def layer_type_edit(self): for i in range(0, self.tab.rowCount()): if tab_get_value(self.tab, i, 3).lower() == "active layer" and tab_get_value( self.tab, i, 4).startswith("dos") == False: tab_set_value(self.tab, i, 4, epitay_get_next_dos()) tab_set_value(self.tab, i, 5, epitay_get_next_pl()) mat_dir = os.path.join(get_materials_path(), tab_get_value(self.tab, i, 2)) new_file = tab_get_value(self.tab, i, 4) + ".inp" if inp_isfile(new_file) == False: dos_path = os.path.join(mat_dir, "dos.inp") if os.path.isfile(dos_path) == False: dos_path = os.path.join(get_default_material_path(), "dos.inp") inp_copy_file(new_file, dos_path) new_file = tab_get_value(self.tab, i, 5) + ".inp" if inp_isfile(new_file) == False: inp_copy_file(new_file, os.path.join(mat_dir, "pl.inp")) if tab_get_value(self.tab, i, 3).lower() != "active layer" and tab_get_value( self.tab, i, 4).startswith("dos") == True: tab_set_value(self.tab, i, 4, tab_get_value(self.tab, i, 3)) tab_set_value(self.tab, i, 5, "none") if tab_get_value(self.tab, i, 3).lower() == "other": tab_set_value(self.tab, i, 4, tab_get_value(self.tab, i, 3)) if tab_get_value(self.tab, i, 3).lower() == "contact": tab_set_value(self.tab, i, 4, tab_get_value(self.tab, i, 3)) self.save_model() self.emit_change() global_object_run("dos_update") global_object_run("pl_update")
def layer_type_edit(self): for i in range(0,self.tab.rowCount()): if tab_get_value(self.tab,i,3).lower()=="active layer" and tab_get_value(self.tab,i,4).startswith("dos")==False: tab_set_value(self.tab,i,4,epitay_get_next_dos()) tab_set_value(self.tab,i,5,epitay_get_next_pl()) mat_dir=os.path.join(get_materials_path(),tab_get_value(self.tab,i,2)) new_file=tab_get_value(self.tab,i,4)+".inp" if inp_isfile(new_file)==False: inp_copy_file(new_file,os.path.join(mat_dir,"dos.inp")) new_file=tab_get_value(self.tab,i,5)+".inp" if inp_isfile(new_file)==False: inp_copy_file(new_file,os.path.join(mat_dir,"pl.inp")) if tab_get_value(self.tab,i,3).lower()!="active layer" and tab_get_value(self.tab,i,4).startswith("dos")==True: tab_set_value(self.tab,i,4,tab_get_value(self.tab,i,3)) tab_set_value(self.tab,i,5,"none") self.save_model() self.emit_change()
def callback_clone_page(self): tab = self.notebook_pointer.currentWidget() orig_number = extract_number_from_file_name(tab.file_name) new_sim_name = dlg_get_text(self.clone_dlg_text, self.new_name(), "clone.png") new_sim_name = new_sim_name.ret if new_sim_name != None: number = self.new_filenumber() for b in range(0, len(self.base_file_name)): new_filename = self.base_file_name[b] + number + ".inp" orig_filename = self.base_file_name[b] + orig_number + ".inp" inp_copy_file(os.path.join(get_sim_path(), new_filename), os.path.join(get_sim_path(), orig_filename)) if b == 0: inp_update_token_value( os.path.join(get_sim_path(), new_filename), self.name_token, new_sim_name + self.postfix) emit_file_name = new_filename self.added.emit(emit_file_name) self.changed.emit()
def callback_add_page(self): new_sim_name = dlg_get_text(self.new_dlg_text + ":", self.new_name(), "document-new.png") files = inp_ls_seq_files(os.path.join(get_sim_path(), "sim.gpvdm"), self.base_file_name[0]) if (len(files) == 0): error_dlg(self, _("The last tab is gone, I have nothign to copy.")) return old_file_number = int(files[0][len(self.base_file_name[0]):-4]) if new_sim_name.ret != None: number = self.new_filenumber() for b in range(0, len(self.base_file_name)): new_filename = self.base_file_name[b] + number + ".inp" orig_filename = self.base_file_name[b] + "0.inp" inp_copy_file(os.path.join(get_sim_path(), new_filename), os.path.join(get_sim_path(), orig_filename)) if b == 0: inp_update_token_value( os.path.join(get_sim_path(), new_filename), self.name_token, new_sim_name.ret + self.postfix) emit_file_name = new_filename self.added.emit(emit_file_name)
def callback_copy_page(self): tab = self.notebook.currentWidget() index = laser_new_filename() new_file = "laser" + str(index) + ".inp" new_sim_name = dlg_get_text( _("Clone the current laser to a new laser called:"), tab.tab_name + "_new", "clone.png") if new_sim_name.ret != None: dest = os.path.join(get_sim_path(), new_file) if inp_copy_file(dest, tab.file_name) == False: print("Error copying file" + dest + " " + tab.file_name) return inp_update_token_value(dest, "#laser_name", new_sim_name.ret) self.add_page(index)
def callback_copy_page(self): tab = self.notebook.currentWidget() old_index = tab.index new_sim_name = dlg_get_text( _("Clone the current measurement to a new measurement called:"), _("measurement ") + str(self.notebook.count() + 1), "clone.png") new_sim_name = new_sim_name.ret if new_sim_name != None: index = measure_new_filename() if inp_copy_file( os.path.join(get_sim_path(), "measure" + str(index) + ".inp"), os.path.join(get_sim_path(), "measure" + str(old_index) + ".inp")) == False: print( _("Error copying file") + "measure" + str(old_index) + ".inp") return inp_update_token_value( os.path.join(get_sim_path(), "measure" + str(index) + ".inp"), "#measure_name", new_sim_name) self.add_page(index)