def callback_plot_select(self): help_window().help_set_help(["dat_file.png",_("<big>Select a file to plot</big><br>Single clicking shows you the content of the file")]) dialog=gpvdm_open(os.getcwd()) dialog.show_inp_files=False dialog.show_directories=False ret=dialog.window.exec_() if ret==QDialog.Accepted: split=dialog.get_filename().split(".") if len(split)>1: if split[1]=="xlsx" or split[1]=="xls": desktop_open(dialog.get_filename()) print("open with excel") return if os.path.basename(dialog.get_filename())=="sim_info.dat": if self.sim_info_window==None: self.sim_info_window=sim_info(dialog.get_filename()) if self.sim_info_window.isVisible()==True: self.sim_info_window.hide() else: self.sim_info_window.show() return plot_gen([dialog.get_filename()],[],"auto")
def callback_dir_open(self): dialog=gpvdm_open(self.path) dialog.show_inp_files=False ret=dialog.exec_() if ret==QDialog.Accepted: desktop_open(dialog.get_filename())
def callback_gen_plot_command(self): dialog = gpvdm_open(self.sim_dir, act_as_browser=False) ret = dialog.exec_() if ret == QDialog.Accepted: full_file_name = dialog.get_filename() #dialog.destroy() #print cur_dir=os.getcwd() #print full_file_name file_name = os.path.basename(full_file_name) plot_data = dat_file() plot_data.path = self.sim_dir plot_data.example_file0 = full_file_name plot_data.example_file1 = full_file_name plot_now = False if check_info_file(file_name) == True: plot_data.file0 = file_name plot_xy_window = plot_dlg_class(plot_data) plot_xy_window.run() plot_now = plot_xy_window.ret else: plot_data.file0 = file_name plot_data.tag0 = "" plot_data.file1 = "" plot_data.tag1 = "" plot_now = True if plot_now == True: self.plot_results(plot_data)
def callback_gen_plot_command(self): dialog=gpvdm_open(self.sim_dir) ret=dialog.window.exec_() if ret==QDialog.Accepted: full_file_name=dialog.get_filename() #dialog.destroy() #print cur_dir=os.getcwd() #print full_file_name file_name=os.path.basename(full_file_name) plot_data=plot_state() plot_data.path=self.sim_dir plot_data.example_file0=full_file_name plot_data.example_file1=full_file_name plot_now=False if check_info_file(file_name)==True: plot_data.file0=file_name plot_xy_window=plot_dlg_class(plot_data) plot_xy_window.run() plot_now=plot_xy_window.ret else: plot_data.file0=file_name plot_data.tag0="" plot_data.file1="" plot_data.tag1="" plot_now=True if plot_now==True: self.plot_results(plot_data)
def callback_home_backup(self): backup_path = get_backup_path() if os.path.isdir(backup_path) == False: os.makedirs(backup_path) lines = [] lines.append("#gpvdm_file_type") lines.append("backup_main") lines.append("#end") write_lines_to_archive(os.path.join(backup_path, "sim.gpvdm"), "mat.inp", lines, mode="l", dest="file") self.dialog = gpvdm_open(backup_path, big_toolbar=True) self.new_backup = QAction_lock("add_backup", wrap_text(_("New backup"), 2), self, "add_backup") self.new_backup.clicked.connect(self.on_new_backup) self.dialog.toolbar.addAction(self.new_backup) self.dialog.viewer.show_inp_files = False ret = self.dialog.exec_()
def callback_view_materials(self): self.dialog=gpvdm_open(get_materials_path(),big_toolbar=True) self.new_materials = QAction(icon_get("add_material"), wrap_text(_("Add Material"),8), self) self.new_materials.triggered.connect(self.on_new_materials_clicked) self.dialog.toolbar.addAction(self.new_materials) self.dialog.show_inp_files=False self.dialog.menu_new_material_enabled=True ret=self.dialog.exec_()
def menu_plot_open(self): from gpvdm_open import gpvdm_open dialog=gpvdm_open(get_sim_path(),show_inp_files=False,act_as_browser=False) ret=dialog.exec_() if ret==QDialog.Accepted: self.graph_path=dialog.get_filename() if self.graph_data.load(self.graph_path)==True: #print(self.graph_path) self.graph_data.data_max,self.graph_data.data_min=dat_file_max_min(self.graph_data)
def callback_config_window(self): self.config_window=gpvdm_open("/gpvdmroot/gpvdm_configure",show_inp_files=False,title=_("Configure")) self.config_window.toolbar.hide() self.config_window.show_directories=False ret=self.config_window.exec_() #self.config_window.changed.connect(self.dump.refresh) help_window().help_set_help(["preferences-system.png",_("<big><b>Configuration editor</b></big><br> Use this window to control advanced simulation parameters.")])
def callback_configure_shape(self): self.dialog = gpvdm_open(get_shape_path(), big_toolbar=True) self.new_shape = QAction_lock("add_shape", wrap_text(_("Add Shape"), 8), self, "add_shape") self.new_shape.clicked.connect(self.on_new_shape_clicked) self.dialog.toolbar.addAction(self.new_shape) self.dialog.show_inp_files = False ret = self.dialog.exec_()
def callback_configure_emission(self): self.dialog = gpvdm_open(get_emission_path(), big_toolbar=True) self.new_emission = QAction_lock("add_emission", wrap_text(_("Add Spectra"), 8), self, "add_emission") self.new_emission.clicked.connect(self.on_new_emission_clicked) self.dialog.toolbar.addAction(self.new_emission) self.dialog.show_inp_files = False ret = self.dialog.exec_()
def callback_view_optical(self): self.dialog = gpvdm_open(get_spectra_path(), big_toolbar=True) self.new_materials = QAction_lock("add_spectra", wrap_text(_("Add Spectra"), 8), self, "add_spectra") self.new_materials.clicked.connect(self.on_new_spectra_clicked) self.dialog.toolbar.addAction(self.new_materials) self.dialog.show_inp_files = False ret = self.dialog.exec_()
def callback_view_materials(self): dialog=gpvdm_open(get_materials_path()) dialog.show_inp_files=False ret=dialog.window.exec_() if ret==QDialog.Accepted: if os.path.isfile(os.path.join(dialog.get_filename(),"mat.inp"))==True: self.mat_window=materials_main(dialog.get_filename()) self.mat_window.show() else: plot_gen([dialog.get_filename()],[],"auto")
def callback_button_click(self): from gpvdm_open import gpvdm_open dialog=gpvdm_open(get_materials_path(),act_as_browser=False) ret=dialog.exec_() if ret==QDialog.Accepted: file_name=dialog.get_filename() rel_path=subtract_paths(get_materials_path(),file_name) rel_path=rel_path.replace("\\", "/") self.setText(rel_path) self.changed.emit()
def callback_plot_select(self): help_window().help_set_help(["dat_file.png",_("<big>Select a file to plot</big><br>Single clicking shows you the content of the file")]) dialog=gpvdm_open(get_sim_path(),show_inp_files=False) dialog.show_directories=False ret=dialog.exec_() if ret==QDialog.Accepted: file_name=dialog.get_filename() if os.path.basename(dialog.get_filename())=="sim_info.dat": self.sim_info_window=sim_info(dialog.get_filename()) self.sim_info_window.show() return plot_gen([dialog.get_filename()],[],"auto")
def callback_view_optical(self): dialog=gpvdm_open(get_spectra_path()) dialog.menu_new_spectra_enabled=True dialog.show_inp_files=False ret=dialog.exec_()
def callback_plot_select(self): dialog = gpvdm_open(get_sim_path(), show_inp_files=False) dialog.show_directories = False ret = dialog.exec_()
def callback_configure_user_data(self): self.dialog = gpvdm_open(get_user_data_path(), big_toolbar=True) ret = self.dialog.exec_()