예제 #1
0
	def init(self):
		self.window = gtk.Window()
		self.window.connect("show", self.show_cb)

		self.window.set_decorated(False)
		self.window.set_border_width(0)
		self.window.set_keep_above(True)
		fixed = gtk.Fixed()
		image = gtk.Image()
		image_file=os.path.join(get_image_file_path(),"splash.png")
		label = gtk.Label()
		label.set_use_markup(gtk.TRUE)
		label.set_markup('<span color="black" size="88000"><b>opvdm</b></span>')
		label.show()
		image.set_from_file(image_file)
		image.show()
		fixed.put(image, 0, 0)
		fixed.put(label,40,40)

		label = gtk.Label()
		label.set_use_markup(gtk.TRUE)
		label.set_markup(notice()+"\n"+ver())
		label.show()

		fixed.put(label,40,200)

		self.window.add(fixed)
		self.window.set_position(gtk.WIN_POS_CENTER)
		self.window.show_all()
		self.window.connect("destroy", self.callback_destroy)
예제 #2
0
 def __init__(self):
     # QDialog.__init__(self)
     self.ui = loadUi(os.path.join(get_ui_path(), "about.ui"))
     self.ui.ver.setText(ver() + "\n" + notice())
     self.ui.li.setText("Written by Roderick MacKenzie 2014, published under GPL v2.0")
     self.ui.show()
     pixmap = QPixmap(os.path.join(get_image_file_path(), "image.jpg"))
     self.ui.image.setPixmap(pixmap)
예제 #3
0
def update_fetch():
	text=[]
	text.append("Checking web for updates...")

#	disk_files=[]
	web_src=[]
	disk_dest=[]

	update_path="http://www.gpvdm.com/update_windows/"+ver()+"/"
	lines=get_data_from_web(update_path+"list.dat")
	print("Got file list")
	lines=lines.split('\n')
	files=[]
	md5=[]
	web_md5=[]
	for i in range(0,len(lines)):
		if lines[i].count("  ")!=0:
			m,f=lines[i].split("  ")
			f=f[2:].split("/")
			md5.append(m)
			files.append(f)

	for i in range(0,len(files)):

		root=files[i][0]
		if root=="images" or root=="solvers" or root=="gpvdm_core.exe" or root=="device_lib" or root=="sim.gpvdm" or root=="lang" or root=="materials" or root=="light":
			md5_web=md5[i]
			md5_disk="none"
			disk_path=os.path.join(get_share_path(),"/".join(files[i]))
			web_path=update_path+"/".join(files[i])
			if os.path.isfile(disk_path):
				md5_disk=hashlib.md5(open(disk_path,'rb').read()).hexdigest()

			if md5_web!=md5_disk:
				web_src.append(web_path)
				disk_dest.append(disk_path)
				web_md5.append(md5_web)

	for i in range(0,len(web_src)):
		text.append(web_src[i]+" "+disk_dest[i])
		a=get_data_from_web(web_src[i])
		l=len(a)
		if l>100:
			l=100;
		if a[:l].count("403 Forbidden")!=0:
			text.append("Access to file "+web_src[i]+" forbidden")
		else:
			web_hash=hashlib.md5(a).hexdigest()
			list_hash=web_md5[i]
			if web_hash==list_hash:
				text.append("updating file "+disk_dest[i])
				if running_on_linux()==False:
					f=open(disk_dest[i], mode='wb')
					lines = f.write(a)
					f.close()
			else:
				text.append("Checksum error "+disk_dest[i])
	return text
예제 #4
0
def about_dialog_show():
    about = gtk.AboutDialog()
    about.set_program_name("opvdm")
    about.set_version("")
    about.set_copyright("Written by Roderick MacKenzie 2014, published under GPL v2.0")
    about.set_comments(ver() + "\n" + notice())
    about.set_website("http://www.opvdm.com")

    image = os.path.join(get_image_file_path(), "image.jpg")
    about.set_logo(gtk.gdk.pixbuf_new_from_file(image))
    about.run()
    about.destroy()
예제 #5
0
파일: about.py 프로젝트: xj361685640/gpvdm
    def __init__(self):
        QDialog.__init__(self)
        self.main_hbox = QHBoxLayout()
        self.left_vbox = QVBoxLayout()
        self.main_vbox = QVBoxLayout()
        self.setFixedSize(650, 480)
        self.setWindowTitle(_("About") + " (https://www.gpvdm.com)")
        self.setWindowIcon(icon_get("icon"))
        self.gpvdm = QLabel("<font size=40><b>gpvdm</b></font>")
        self.image = QLabel()
        self.written_by = QLabel(
            _("Written by Roderick MacKenzie 2012-2017, published under GPL v2.0"
              ))
        self.written_by.setWordWrap(True)
        self.ver = QLabel(_("Version ") + ver())
        pixmap = QPixmap(os.path.join(get_image_file_path(), "image.jpg"))
        self.image.setPixmap(pixmap)
        self.left_vbox.addWidget(self.gpvdm)
        self.left_vbox.addWidget(self.image)
        self.left_vbox.addWidget(self.written_by)
        self.left_vbox.addWidget(self.ver)
        self.left = QWidget()
        self.left.setLayout(self.left_vbox)
        self.right = QTabWidget()
        self.right.setMinimumWidth(400)
        self.about = QTextBrowser()
        text = ""
        text = text + _(
            "gpvdm is a free general-purpose tool for simulation of light harvesting devices. It was originally written to simulate organic solar cells and OLEDs, but it has recently been extended to simulate other devices including silicon based devices. Currently the model can sumulate:"
        )
        text = text + "<ul>"
        text = text + "<li>" + _("Organic solar cells") + "</li>"
        text = text + "<li>" + _("Organic LEDs") + "</li>"
        text = text + "<li>" + _("Crystalline silicon solar cells") + "</li>"
        text = text + "<li>" + _("a-Si solar cells") + "</li>"
        text = text + "<li>" + _("CIGS solar cells") + "</li>"
        text = text + "</ul> "
        text = text + _(
            "The model solves both electron and hole drift-diffusion, and carrier continuity equations in position space to describe the movement of charge within the device. The model also solves Poisson's equation to calculate the internal electrostatic potential. Recombination and carrier trapping are described within the model using a Shockley-Read-Hall (SRH) formalism, the distribution of trap sates can be arbitrarily defined. All equations can be solved either in steady state or in time domain. A fuller description of the model can be found in the here, in the associated publications and in the manual."
        )
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<center><a href=\"https://www.gpvdm.com\">https://www.gpvdm.com</a></center>"
        self.about.setText(text)
        self.right.addTab(self.about, _("About"))

        self.license = QTextBrowser()
        text = ""
        text = text + _(
            "General-purpose Photovoltaic Device Model - a drift diffusion base/Shockley-Read-Hall model"
        )
        text = text + "<br>"
        text = text + "<br>"

        text = text + _(
            "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2.0, as published by the Free Software Foundation."
        )
        text = text + "<br>"
        text = text + "<br>"

        text = text + _(
            "This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details."
        )
        text = text + "<br>"
        text = text + "<br>"

        text = text + _(
            "You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA."
        )
        text = text + "<br>"
        text = text + "<br>"

        text = text + _(
            "When you start gpvdm the software checks the gpvdm.com server for updates and bug reports.  To do this it transmits your opperating system type, gpvdm version number.  It also tells the gpvdm.com server if opengl is working on your pc.  By installing gpvdm you agree that the gpvdm software may transmit this information to the gpvdm.com server.  The communications  process between gpvdm software and the gpvdm.com server is described in more detail in the manual."
        )
        text = text + "<br>"
        text = text + "<br>"
        text = text + "*****@*****.**"
        text = text + "<br>"
        self.license.setText(text)
        self.right.addTab(self.license, _("License"))

        self.translations = QTextBrowser()
        text = ""

        text = text + "<big><b>Translations of gpvdm:</b></big>"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<center>"
        text = text + "<b>English</b>: Roderick C. I. MacKenzie"
        text = text + "<br>"
        text = text + "<b>Chinese</b>:Liu Di (刘迪) and Zhao Chenyao (赵辰尧)"
        text = text + "<br>"
        text = text + "<b>Russian</b>: Timofey Golubev (Тимофей Голубев)"
        text = text + "<br>"
        text = text + "<b>German</b>: Roderick C. I. MacKenzie"
        text = text + "<br>"
        text = text + "<b>Spanish</b>:Translator needed!"
        text = text + "<br>"
        text = text + "<b>Korean</b>:Translator needed!"
        text = text + "<br>"
        text = text + "<b>Persian</b>:Translator needed!"
        text = text + "<br>"
        text = text + "<b>Your language</b>: Translator needed!"
        text = text + "</center>"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<big>Would you like gpvdm translated into your language?</big>"
        text = text + "<br>"
        text = text + "<big>Would you like your name in the credits of gpvdm?</big>"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "If so then please consider joining the gpvdm translation effort.  This is somthing you can put on your CV and it\'s a way to make sure that speakers of your language have access to high quality scientific tools for simulating solar cells."

        self.translations.setText(text)
        self.right.addTab(self.translations, _("Translations"))

        #self.materials=QListWidget()
        #self.right.addTab(self.materials,_("Materials"))

        self.main_hbox.addWidget(self.left)
        self.main_hbox.addWidget(self.right)
        self.widget_main_hbox = QWidget()
        self.widget_main_hbox.setLayout(self.main_hbox)
        self.main_vbox.addWidget(self.widget_main_hbox)

        self.hwidget = QWidget()

        self.closeButton = QPushButton(_("Close"))
        self.closeButton.clicked.connect(self.callback_close)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(self.closeButton)

        self.hwidget.setLayout(hbox)

        self.main_vbox.addWidget(self.hwidget)

        self.setLayout(self.main_vbox)
        self.show()

        #QDialog.__init__(self)

        #self.materials.setIconSize(QSize(32,32))
        #self.materials.setViewMode(QListView.ListMode)
        #self.materials.setSpacing(8)
        #self.materials.setWordWrap(True)
        #gridsize=self.materials.size()
        #gridsize.setWidth(80)
        #gridsize.setHeight(40)

        #self.materials.setGridSize(gridsize)
        self.mat_icon = icon_get("organic_material")
예제 #6
0
파일: about.py 프로젝트: Ly0n/gpvdm
    def __init__(self):
        QDialog.__init__(self)
        self.main_hbox = QHBoxLayout()
        self.left_vbox = QVBoxLayout()
        self.main_vbox = QVBoxLayout()
        self.setFixedSize(750, 480)
        self.setWindowTitle(_("About") + " (https://www.gpvdm.com)")
        self.setWindowIcon(icon_get("icon"))
        self.gpvdm = QLabel("<font size=40><b>gpvdm_gui</b></font>")
        self.image = QLabel()
        self.written_by = QLabel(
            _("Written by Roderick MacKenzie 2012-2019, published under the GPL V2.0 license."
              ))
        self.written_by.setWordWrap(True)
        self.ver = QLabel(_("Version ") + ver())
        pixmap = QPixmap(os.path.join(get_image_file_path(), "image.jpg"))
        self.image.setPixmap(pixmap)
        self.left_vbox.addWidget(self.gpvdm)
        self.left_vbox.addWidget(self.image)
        self.left_vbox.addWidget(self.written_by)
        self.left_vbox.addWidget(self.ver)
        self.left = QWidget()
        self.left.setLayout(self.left_vbox)
        self.right = QTabWidget()
        self.right.setMinimumWidth(500)
        self.about = QTextBrowser()
        text = ""
        text = text + _(
            "gpvdm is a general-purpose tool for simulation of light harvesting devices. It was originally written to simulate organic solar cells and OLEDs, but it has recently been extended to simulate other devices including silicon based devices. Currently the model can sumulate:"
        )
        text = text + "<ul>"
        text = text + "<li>" + _("Organic solar cells") + "</li>"
        text = text + "<li>" + _("Organic LEDs") + "</li>"
        text = text + "<li>" + _("Crystalline silicon solar cells") + "</li>"
        text = text + "<li>" + _("a-Si solar cells") + "</li>"
        text = text + "<li>" + _("CIGS solar cells") + "</li>"
        text = text + "</ul> "
        text = text + _(
            "The model solves both electron and hole drift-diffusion, and carrier continuity equations in position space to describe the movement of charge within the device. The model also solves Poisson's equation to calculate the internal electrostatic potential. Recombination and carrier trapping are described within the model using a Shockley-Read-Hall (SRH) formalism, the distribution of trap sates can be arbitrarily defined. All equations can be solved either in steady state or in time domain. A fuller description of the model can be found in the here, in the associated publications and in the manual."
        )
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<center><a href=\"https://www.gpvdm.com\">https://www.gpvdm.com</a></center>"
        self.about.setText(text)
        self.right.addTab(self.about, _("About"))

        self.license = QTextBrowser()
        text = ""
        license_file = os.path.join(get_html_path(), "LICENSE.html")
        if (os.path.isfile(license_file) == True):
            f = open(license_file, mode='rb')
            lines = f.read()
            f.close()
            lines = lines.decode('utf-8')
            lines = lines.split("\n")
            for l in lines:
                text = text + l + "<br>"

        self.license.setText(text)
        self.right.addTab(self.license, _("Legal"))

        self.translations = QTextBrowser()
        text = ""

        text = text + "<big><b>Translations of gpvdm:</b></big>"
        text = text + "<center>"
        text = text + "<br>"
        text = text + "<b>Chinese</b>: Liu Di (刘迪) and Zhao Chenyao (赵辰尧)"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<b>French</b>: Alexis Prel"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<b>Russian</b>: Timofey Golubev (Тимофей Голубев)"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<b>Your language</b>: Translator needed!"
        text = text + "</center>"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "<big>Would you like gpvdm translated into your language?</big>"
        text = text + "<br>"
        text = text + "<big>Would you like your name in the credits of gpvdm?</big>"
        text = text + "<br>"
        text = text + "<br>"
        text = text + "If so then please consider joining the gpvdm translation effort.  This is somthing you can put on your CV and it\'s a way to make sure that speakers of your language have access to high quality scientific tools for simulating solar cells."

        self.translations.setText(text)
        #self.right.addTab(self.translations,_("Translations"))

        self.paths = QTextBrowser()
        text = ""

        text = text + "<b>" + _(
            "Materials library path") + ":</b>" + get_materials_path() + "<br>"
        text = text + "<b>" + _(
            "Device library path") + ":</b>" + get_device_lib_path() + "<br>"
        text = text + "<b>" + _(
            "Binary path") + ":</b>" + get_bin_path() + "<br>"
        text = text + "<b>" + _(
            "Plugins path") + ":</b>" + get_plugins_path() + "<br>"
        text = text + "<b>" + _(
            "Binary name") + ":</b>" + get_exe_name() + "<br>"
        text = text + "<b>" + _(
            "Install ID") + ":</b>" + get_lock().uid + "<br>"

        self.paths.setText(text)
        self.right.addTab(self.paths, _("Paths"))

        #self.materials=QListWidget()
        #self.right.addTab(self.materials,_("Materials"))

        self.main_hbox.addWidget(self.left)
        self.main_hbox.addWidget(self.right)
        self.widget_main_hbox = QWidget()
        self.widget_main_hbox.setLayout(self.main_hbox)
        self.main_vbox.addWidget(self.widget_main_hbox)

        self.hwidget = QWidget()

        self.closeButton = QPushButton(_("Close"))
        self.closeButton.clicked.connect(self.callback_close)
        hbox = QHBoxLayout()
        hbox.addStretch(1)
        hbox.addWidget(self.closeButton)

        self.hwidget.setLayout(hbox)

        self.main_vbox.addWidget(self.hwidget)

        self.setLayout(self.main_vbox)
        self.show()

        #QDialog.__init__(self)

        #self.materials.setIconSize(QSize(32,32))
        #self.materials.setViewMode(QListView.ListMode)
        #self.materials.setSpacing(8)
        #self.materials.setWordWrap(True)
        #gridsize=self.materials.size()
        #gridsize.setWidth(80)
        #gridsize.setHeight(40)

        #self.materials.setGridSize(gridsize)
        self.mat_icon = icon_get("organic_material")
예제 #7
0
def command_args(argc,argv):
	if argc>=2:
		if argv[1]=="--help":
			print "Usage: opvdm [option] src_file dest_file"
			print ""
			print "Options:"
			print "\t--version\tdisplays the current version"
			print "\t--help\t\tdisplays the help"
			print "\t--export\texport a simulation to a gz file"
			print "\t--import\timport a simulation from a .opvdm file"
			print "\t--patch\tpatch an .opvdm file with an older .opvdm file"
			print "\t\t\tusage --import abc.opvdm ./path/to/output/ "
			print "\t--clone\t\tgenerate a clean simulation in the current directory"
			print "\t--clean\t\tcleans the current simulation directory deleting .dat files and scan dirs"
			print "\t--dump-tab (output file)\t\tdumps simulation parameters as jpg"
			print "\t--import-scandirs\t\tOnly imports the scan directories"
			print "\t--clean-scandirs\t\tDeletes the content of all scan dirs"
			print "\t--scan-plot\t\truns an oplot file"
			print "\t\t\tusage --scan-plot /path/to/oplot/file.oplot "
			print "\t--run-scan\t\truns a scan"
			print "\t\t\tusage --run-scan /path/containing/base/files/ /path/to/scan/dir/ "

			print ""
			print "Additional information about opvdm is available at http://www.opvdm.com."
			print ""
			print "Report bugs to: [email protected]"
			sys.exit(0)
		if argv[1]=="--version":
			print ver()
			sys.exit(0)
		if argv[1]=="--import-scandirs":
			import_scan_dirs(os.getcwd(),argv[2])
			exit(0)
		if argv[1]=="--export":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--dump-tab":
			export_as(argv[2])
			sys.exit(0)
		if argv[1]=="--import":
			import_archive(argv[2],os.path.join(os.getcwd(),"sim.opvdm"),False)
			sys.exit(0)
		if argv[1]=="--patch":
			import_archive(argv[2],argv[3],True)
			sys.exit(0)
		if argv[1]=="--clone":
			opvdm_clone()
			sys.exit(0)
		if argv[1]=="--clone-src":
			opvdm_copy_src(argv[2])
			sys.exit(0)

		if argv[1]=="--file_info":
			data=plot_data()
			data.dump_file()
			sys.exit(0)
		if argv[1]=="--clean":
			clean_sim_dir()
			sys.exit(0)
		if argv[1]=="--clean-scandirs":
			clean_scan_dirs(os.getcwd())
			sys.exit(0)

		if argv[1]=="--server":
			obj=udp_server()
			obj.start()

		if argv[1]=="--client":
			client=udp_client()
			client.init()

		if argv[1]=="--make-man":
			make_man()
			sys.exit(0)

		if argv[1]=="--run-scan":
			scan_dir_path=argv[3]	#program file
			program_list=[]
			base_dir=argv[2]				#base dir
			exe_command   =  get_exe_command()
			scan_item_load(os.path.join(scan_dir_path,"scan_items.inp"))
			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 argv[1]=="--scan-plot":
			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)
예제 #8
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)
예제 #9
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.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.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)