def change_dir_and_refresh_interface(self, new_dir): used_files_add(os.path.join(new_dir, "sim.gpvdm")) self.scan_human_labels.clear() inp_callbacks_clear() get_watch().reset() self.splash.inc_value() self.scan_human_labels.populate_from_known_tokens() self.splash.inc_value() self.splash.inc_value() set_sim_path(new_dir) self.splash.inc_value() calculate_paths() self.splash.inc_value() epi = get_epi() epi.load(get_sim_path()) self.splash.inc_value() self.splash.inc_value() if get_mesh().load(epi) == False: error_dlg( self, _("There was a problem loading the electrical mesh, I suspect you are trying to open a file generated in a very old version of gpvdm." )) return self.statusBar().showMessage(get_sim_path()) self.splash.inc_value() self.notebook.load() self.update_interface() self.enable_disable_buttons() self.splash.inc_value() if self.notebook.terminal != None: self.my_server.set_terminal(self.notebook.terminal) if self.notebook.update_display_function != None: self.my_server.set_display_function( self.notebook.update_display_function) self.scan_human_labels.add_item("sim.inp", "#simmode", "sim mode") self.scan_human_labels.add_item("light.inp", "#Psun", "light intensity") #scan_populate_from_file("light.inp") self.ribbon.update() self.splash.inc_value() if self.notebook.is_loaded() == True: self.l.run() self.notebook.tab_main.three_d.update() get_watch().rebase()
def change_dir_and_refresh_interface(self, new_dir): scan_items_clear() self.splash.inc_value() scan_items_populate_from_known_tokens() self.splash.inc_value() self.splash.inc_value() set_sim_path(new_dir) self.splash.inc_value() calculate_paths() self.splash.inc_value() epitaxy_load(get_sim_path()) self.splash.inc_value() contacts_load() self.splash.inc_value() if mesh_load_all() == False: error_dlg( self, _("There was a problem loading the electrical mesh, I suspect you are trying to open a file generated in a very old version of gpvdm." )) return self.statusBar().showMessage(get_sim_path()) self.splash.inc_value() self.update_interface() self.splash.inc_value() if self.notebook.terminal != None: self.my_server.set_terminal(self.notebook.terminal) if self.notebook.update_display_function != None: self.my_server.set_display_function( self.notebook.update_display_function) scan_item_add("sim.inp", "#simmode", "sim mode", 1) scan_item_add("light.inp", "#Psun", "light intensity", 1) #scan_populate_from_file("light.inp") self.ribbon.update() self.splash.inc_value()
def set_sim_path(self, path): set_sim_path(path)
def command_args(argc, argv): if test_arg_for_sim_file() != False: return if argc >= 2: if args.version: print(version()) sys.exit(0) elif args.ver: print(ver()) sys.exit(0) elif args.syncver: ver_sync_ver() sys.exit(0) elif args.importscandirs: import_scan_dirs(os.getcwd(), args.importscandirs[0]) exit(0) elif args.replace: device_lib_replace(args.replace[0], dir_name=args.replace[1]) exit(0) elif args.delete: device_lib_delete(args.delete[0], dir_name=args.delete[1]) exit(0) elif args.clean: clean_sim_dir() sys.exit(0) elif args.export: export_as(args.export[0]) sys.exit(0) elif args.makeman: make_man() sys.exit(0) elif args.cleanscandirs: clean_scan_dirs(os.getcwd()) sys.exit(0) elif args.importfile: import_archive(args.importfile[0], os.path.join(os.getcwd(), "sim.gpvdm"), False) sys.exit(0) elif args.dumptab: export_as(args.dumptab[0]) sys.exit(0) elif args.patch: import_archive(args.patch[0], args.patch[1], True) sys.exit(0) elif args.patchfile: patch_file(args.patchfile[0], args.patchfile[1], args.patchfile[2]) sys.exit(0) elif args.clone: gpvdm_clone(os.getcwd(), copy_dirs=True) sys.exit(0) elif args.matcompress: archive_materials(os.path.join(os.getcwd(), "materials")) sys.exit(0) elif args.clonesrc: gpvdm_copy_src(clone - src[0]) sys.exit(0) elif args.editvalue: inp_update_token_value(args.editvalue[0], args.editvalue[1], args.editvalue[2]) sys.exit(0) elif args.load: set_sim_path(os.path.dirname(args.load[0])) #print("a") elif args.encrypt: inp_encrypt(args.encrypt[0]) sys.exit(0) elif args.extract: archive_decompress("sim.gpvdm") sys.exit(0) elif args.scanplot: plot_token = dat_file() oplot_file = args.scan - plot[0] if plot_load_info(plot_token, oplot_file) == True: print("file0=", plot_token.file0, "<") plot_files, plot_labels, save_file = scan_gen_plot_data( plot_token, os.path.dirname(oplot_file)) print("written data to", save_file) else: print("Problem loading oplot file") sys.exit(0) if args.unpack: archive_unpack(args.unpack[0]) sys.exit() if args.runscan: set_gui(False) scan_dir_path = args.runscan[0] #program file exe_command = get_exe_command() program_list = tree_load_program(scan_dir_path) watch_dir = os.path.join(os.getcwd(), scan_dir_path) commands = [] #server_find_simulations_to_run(commands,scan_dir_path) commands = tree_load_flat_list(scan_dir_path) print(commands) myserver = base_server() myserver.base_server_init(watch_dir) for i in range(0, len(commands)): myserver.base_server_add_job(commands[i], "") print("Adding job" + commands[i]) myserver.print_jobs() myserver.simple_run() #simple_run(exe_command) sys.exit(0) if args.scanarchive: set_gui(False) scan_archive(args.scanarchive[0]) sys.exit(0) if args.buildscan: set_gui(False) scan_items_clear() scan_items_populate_from_known_tokens() scan_items_populate_from_files() scan_dir_path = args.buildscan[0] #program file base_dir = args.buildscan[1] #base dir build_scan(scan_dir_path, base_dir) sys.exit(0) if args.scanbuildvectors: set_gui(False) scan_ml_build_vector(args.scanbuildvectors[0]) sys.exit(0) if args.buildnestedscan: set_gui(False) scan_items_clear() scan_items_populate_from_known_tokens() scan_items_populate_from_files() scan_dir_path = os.path.abspath( args.buildnestedscan[0]) #program file sim_to_nest = os.path.abspath( args.buildnestedscan[1]) #program file scan_build_nested_simulation( scan_dir_path, os.path.join(os.getcwd(), sim_to_nest)) sys.exit(0)
def command_args(argc, argv): if test_arg_for_sim_file() != False: return if argc >= 2: if args.version: print(version()) sys.exit(0) elif args.ver: print(ver()) sys.exit(0) elif args.syncver: ver_sync_ver() sys.exit(0) elif args.importscandirs: import_scan_dirs(os.getcwd(), args.importscandirs[0]) exit(0) elif args.replace: device_lib_replace(args.replace[0], dir_name=args.replace[1]) exit(0) elif args.clean: clean_sim_dir() sys.exit(0) elif args.export: export_as(args.export[0]) sys.exit(0) elif args.makeman: make_man() sys.exit(0) elif args.cleanscandirs: scan = scans_io(os.getcwd()) scan.clean_all() sys.exit(0) elif args.importfile: import_archive(args.importfile[0], os.path.join(os.getcwd(), "sim.gpvdm"), False) sys.exit(0) elif args.dumptab: export_as(args.dumptab[0]) sys.exit(0) elif args.patch: import_archive(args.patch[0], args.patch[1], True) sys.exit(0) elif args.patchfile: patch_file(args.patchfile[0], args.patchfile[1], args.patchfile[2]) sys.exit(0) elif args.clone: gpvdm_clone(os.getcwd(), copy_dirs=True) sys.exit(0) elif args.matcompress: archive_materials(os.path.join(os.getcwd(), "materials")) sys.exit(0) elif args.clonesrc: gpvdm_copy_src(clone - src[0]) sys.exit(0) elif args.editvalue: inp_update_token_value(args.editvalue[0], args.editvalue[1], args.editvalue[2]) sys.exit(0) elif args.load: set_sim_path(os.path.dirname(args.load[0])) #print("a") elif args.encrypt: inp_encrypt(args.encrypt[0]) sys.exit(0) elif args.unpack: archive_decompress(os.path.join(os.getcwd(), "sim.gpvdm"), remove_gpvdm_file=False) sys.exit(0) elif args.pack: archive_compress(os.path.join(os.getcwd(), "sim.gpvdm")) sys.exit(0) elif args.scanplot: plot_token = dat_file() oplot_file = args.scan - plot[0] if plot_load_info(plot_token, oplot_file) == True: print("file0=", plot_token.file0, "<") plot_files, plot_labels, save_file = scan_gen_plot_data( plot_token, os.path.dirname(oplot_file)) print("written data to", save_file) else: print("Problem loading oplot file") sys.exit(0)