def callback_clone_shape(self): tab = self.notebook.currentWidget() s = self.epi.find_shape_by_file_name(tab.file_name) name = s.name + "_new" new_sim_name = dlg_get_text("Clone the shape:", name, "clone.png") new_sim_name = new_sim_name.ret if new_sim_name != None: old_name = os.path.join(get_sim_path(), tab.file_name) new_name = get_epi().new_electrical_file("shape") my_shape = shape() my_shape.load(old_name) my_shape.name = new_sim_name my_shape.x0 = my_shape.x0 - my_shape.dx my_shape.shape_electrical = get_epi().gen_new_electrical_file( "electrical") my_shape.file_name = new_name my_shape.save() get_epi().layers[self.layer_index].shapes.append(my_shape) get_epi().save() my_tab = tab_class(my_shape.file_name + ".inp") self.notebook.addTab(my_tab, my_shape.name) my_tab.changed.connect(self.callback_edit) global_object_run("gl_force_redraw")
def save(self): if self.update_contact_db()==True: contacts_save() self.changed.emit() global_object_run("gl_force_redraw") else: error_dlg(self,_("There are some non numeric values in the table"))
def apply(self): try: val=float(self.widget0_edit.text()) if val<=0: return if val>0.1: return except: return mesh_set_xlen(val) try: val=float(self.widget1_edit.text()) if val<=0: return if val>0.1: return except: return mesh_set_zlen(val) mesh_save_x() mesh_save_z() global_object_run("mesh_update") global_object_run("gl_force_redraw")
def callback_enable_disable(self): tab = self.notebook.currentWidget() if tab != None: tab.setEnabled(self.enable.enabled) s = self.epi.find_shape_by_file_name(tab.file_name) if s != None: tab.tab.f.replace("#shape_enabled", str(self.enable.enabled)) s.shape_enabled = self.enable.enabled s.save() global_object_run("gl_force_redraw")
def callback_add_shape(self): layer = get_epi().layers[self.layer_index] s = get_epi().new_shape_file(layer) layer.shapes.append(s) new_filename = s.file_name + ".inp" get_epi().save() my_tab = tab_class(new_filename) self.notebook.addTab(my_tab, s.name) my_tab.changed.connect(self.callback_edit) global_object_run("gl_force_redraw")
def layer_selection_changed(self): a = self.tab.selectionModel().selectedRows() if len(a) > 0: y = a[0].row() else: y = -1 if global_isobject("display_set_selected_layer") == True: global_object_get("display_set_selected_layer")(y) global_object_run("gl_force_redraw")
def on_remove_item_clicked(self): ids = [] rows = self.tab.selectionModel().selectedRows() for r in rows: ids.append(self.tab.get_value(r.row(), 10)) items = self.tab.remove() epi = get_epi() print(ids) epi.remove_by_id(ids) epi.save() epi.clean_unused_files() global_object_run("gl_force_redraw")
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 callback_delete_shape(self): tab = self.notebook.currentWidget() s = self.epi.find_shape_by_file_name(tab.file_name) name = s.name response = yes_no_dlg(self, "Do you really want to delete the file: " + name) if response == True: inp_remove_file(os.path.join(get_sim_path(), tab.file_name)) index = self.notebook.currentIndex() self.notebook.removeTab(index) for i in range(0, len(get_epi().layers[self.layer_index].shapes)): if get_epi().layers[self.layer_index].shapes[ i].file_name + ".inp" == tab.file_name: get_epi().layers[self.layer_index].shapes.pop(i) get_epi().clean_unused_files() get_epi().save() break global_object_run("gl_force_redraw")
def apply(self): try: val = float(self.widget0_edit.text()) if val <= 0: return except: return get_mesh().set_xlen(val) try: val = float(self.widget1_edit.text()) if val <= 0: return except: return get_mesh().set_zlen(val) get_mesh().x.save() get_mesh().z.save() global_object_run("mesh_update") global_object_run("gl_force_redraw")
def layer_type_edit(self): self.tab.blockSignals(True) epi = get_epi() for i in range(0, self.tab.rowCount()): epi.update_layer_type(i, self.tab.get_value(i, 3).lower()) self.tab.set_value(i, 4, epi.layers[i].dos_file) self.tab.set_value(i, 5, epi.layers[i].pl_file) self.tab.set_value(i, 6, epi.layers[i].homo_file) self.tab.set_value(i, 7, epi.layers[i].lumo_file) self.tab.blockSignals(False) self.save_model() self.emit_change() global_object_run("dos_update") global_object_run("pl_update") global_object_run("interface_update")
def emit_structure_changed( self): #This will emit when there has been an edit global_object_run("mesh_update") global_object_run("optics_force_redraw") global_object_run("gl_force_redraw")
def callback_changed(self): global_object_run("ribbon_sim_mode_update") self.changed.emit()
def callback_sun(self): global_object_run("gl_force_redraw")
def emit_change(self): global_object_run("gl_force_redraw")
def callback_tab_changed(self): self.changed.emit() global_object_run("ribbon_configure_dump_refresh")
def emit_now(self): global_object_run("gl_force_redraw")
def gui_sim_stop(self): message = "" if self.notebook_active_page != None: self.notebook.goto_page(self.notebook_active_page) global_object_run("display_recalculate")
def save_and_redraw(self): #print("save and redraw called") self.save() self.changed.emit() global_object_run("gl_force_redraw")
def callback_edit(self): tab = self.notebook.currentWidget() s = self.epi.find_shape_by_file_name(tab.file_name) s.do_load() global_object_run("gl_force_redraw")
def callback_add_page(self, file_name): self.add_page(file_name) global_object_run("ribbon_sim_mode_update") self.changed.emit()
def changed(self): global_object_run("gl_force_redraw")