예제 #1
0
	def callback_rename_page(self):
		tab = self.notebook.currentWidget()
		new_laser_name=dlg_get_text( _("Rename the laser to be called:"), tab.tab_name ,"rename.png")

		if new_laser_name.ret!=None:
			print ("calling rename")
			index=self.notebook.currentIndex() 
			self.notebook.setTabText(index, new_laser_name.ret)
			inp_update(tab.file_name, "#laser_name", new_laser_name.ret)
예제 #2
0
def ver_sync_ver():
	file_name=os.path.join(os.getcwd(),"include","version.h")
	found=False

	if os.path.isfile(file_name)==True:
		f = open(file_name, "r")
		lines = f.readlines()
		f.close()
		for l in range(0, len(lines)):
			lines[l]=lines[l].rstrip()
			if lines[l].startswith("#define")==True:
				text=(lines[l].split("\t")[2].strip("\""))
				found=True

	if found==True:
		print("seting ver to: ",text)
		inp_update("ver.inp","#core",text)
	else:
		print(_("version.h not found"))
예제 #3
0
	def save_data(self):
		print("save")
		for i in range(0,self.tab.rowCount()):
			inp_update(self.tab.item(i, 0).text()+".inp", "#doping_start", self.tab.item(i, 2).text())
			inp_update(self.tab.item(i, 0).text()+".inp", "#doping_stop", self.tab.item(i, 3).text())
예제 #4
0
	def run(self):
		ret=self.ui.exec_()
		if ret==True:
			print("update ",self.file_name)
			inp_update(self.file_name, self.token, self.ui.text.toPlainText())
예제 #5
0
def command_args(argc,argv):
	if argc>=2:
		if argv[1]=="--help":
			print(_("Usage: gpvdm [option] src_file dest_file"))
			print("")
			print(_("Options:"))
			print(_("\t--version\t\tdisplays the current version"))
			print(_("\t--help\t\t\tdisplays the help"))
			print(_("\t--export\t\texport a simulation to a gz file"))
			print(_("\t--import\t\timport a simulation from a .gpvdm file"))
			print(_("\t--patch\t\t\tpatch an .gpvdm file with an older .gpvdm file"))
			print(_("\t\t\t\tusage --import abc.gpvdm ./path/to/output/ "))
			print(_("\t--clone\t\t\tgenerate a clean simulation in the current directory"))
			print(_("\t--clean\t\t\tcleans the current simulation directory deleting .dat files but not  scan dirs"))
			print(_("\t--dump-tab\t\tdumps simulation parameters as jpg"))
			print(_("\t\t\t\tusage --dump-tab output_path "))
			print(_("\t--import-scandirs\tOnly imports the scan directories"))
			print(_("\t--clean-scandirs\tDeletes the content of all scan dirs"))
			print(_("\t--scan-plot\t\truns an oplot file"))
			print(_("\t\t\t\tusage --scan-plot /path/to/oplot/file.oplot "))
			print(_("\t--run-scan\t\truns a scan"))
			print(_("\t\t\t\tusage --run-scan /path/containing/base/files/ /path/to/scan/dir/ "))
			print(_("\t--sync-ver\t\truns a scan"))
			print(_("\t--edit-value\t\tedits a value in a .gpvdm archive"))
			print(_("\t\t\t\tusage --edit-value /path/to/sim.gpvdm #token_to_change new_value "))
			print(_("\t\t\t\tchanges the version of input file"))
			print(_("\t--replace\t\treplaces file in device lib"))
			if enable_cluster()==True:
				print(_("\t--server\t\tRun as server node for cluster"))
				print(_("\t--server\t\tRun as client node for cluster"))


			print("\t\t\t")
			print("")
			print(_("Additional information about gpvdm is available at http://www.gpvdm.com."))
			print("")
			print(_("Report bugs to: [email protected]"))
			sys.exit(0)

		if 	check_params(argv,"--version",0)==True:
			print(version())
			sys.exit(0)
		if 	check_params(argv,"--ver",0)==True:
			print(ver())
			sys.exit(0)
		if check_params(argv,"--import-scandirs",1)==True:
			import_scan_dirs(os.getcwd(),argv[2])
			exit(0)
		if check_params(argv,"--replace",1)==True:
			device_lib_replace(argv[2])
			exit(0)
		if check_params(argv,"--export",1)==True:
			export_as(argv[2])
			sys.exit(0)
		if check_params(argv,"--dump-tab",1)==True:
			export_as(argv[2])
			sys.exit(0)
		if check_params(argv,"--import",1)==True:
			import_archive(argv[2],os.path.join(os.getcwd(),"sim.gpvdm"),False)
			sys.exit(0)
		if check_params(argv,"--patch",2)==True:
			import_archive(argv[2],argv[3],True)
			sys.exit(0)
		if check_params(argv,"--clone",0)==True:
			gpvdm_clone(os.getcwd(),True)
			sys.exit(0)
		if check_params(argv,"--clone-src",1)==True:
			gpvdm_copy_src(argv[2])
			sys.exit(0)
		if check_params(argv,"--edit-value",3)==True:
			inp_update(argv[2], argv[3], argv[4])
			sys.exit(0)

		#if check_params(argv,"--file_info",0)==True:
		#	data=plot_data()
		#	data.dump_file()
		#	sys.exit(0)
		if check_params(argv,"--clean",0)==True:
			clean_sim_dir()
			sys.exit(0)
		if check_params(argv,"--clean-scandirs",0)==True:
			clean_scan_dirs(os.getcwd())
			sys.exit(0)

		if check_params(argv,"--make-man",1)==True:
			make_man()
			sys.exit(0)

		if check_params(argv,"--sync-ver",0)==True:
			ver_sync_ver()
			sys.exit(0)

		if check_params(argv,"--run-scan",2)==True:
			scan_dir_path=argv[3]	#program file
			program_list=[]
			base_dir=argv[2]				#base dir
			exe_command   =  get_exe_command()
			tree_load_program(program_list,scan_dir_path)

			watch_dir=os.path.join(os.getcwd(),scan_dir_path)
			#print(program_list,pwd,scan_dir_path)
			#sys.exit(0)
			#print(pwd,scan_dir_path)
			#print(os.getcwd(),os.path.join(scan_dir_path))
			#tree_gen(program_list,os.getcwd(),os.path.join(os.getcwd(),"suns"))
			flat_list=[]
			tree_gen(flat_list,program_list,base_dir,scan_dir_path)
			commands=[]
			server_find_simulations_to_run(commands,scan_dir_path)
			myserver=server()
			myserver.init(watch_dir)
			myserver.clear_cache()
			for i in range(0, len(commands)):
				myserver.add_job(commands[i],"")
				print("Adding job"+commands[i])
			myserver.simple_run(exe_command)

			sys.exit(0)

		if check_params(argv,"--scan-plot",1)==True:
			plot_token=plot_state()
			oplot_file=argv[2]
			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)