예제 #1
0
def ver_load_info():
    lines = []
    global core
    global ver_error
    global subver

    core = ""
    ver_error = ""

    ver_file_path = os.path.join(get_inp_file_path(), "ver.inp")

    lines = inp_load_file(ver_file_path, archive="base.gpvdm")
    if lines != False:
        core = inp_search_token_value(lines, "#core")
        subver = inp_search_token_value(lines, "#sub_ver")
        return True
    else:
        ver_error = "I can not find the file sim.gpvdm/ver.inp.\n\nI have tried looking in " + ver_file_path + "\n\nThe share path is" + get_share_path(
        ) + "\n\nThe bin path is" + get_bin_path(
        ) + "\n\nThe current working dir is " + get_sim_path(
        ) + "\n\nTry reinstalling a new version of gpvdm and/or report the bug to me at  [email protected]."
        return False
예제 #2
0
	def load(self):
		self.clean_menu()
		self.last_page=0
		#print "paths",os.getcwd(),get_bin_path(),(os.path.normcase(os.getcwd())!=os.path.normcase(get_bin_path()))
		if (os.path.exists("sim.opvdm")==True) and (os.path.normcase(os.getcwd())!=os.path.normcase(get_bin_path())):
			self.finished_loading=False
			self.progress.init()
			self.progress.show()
			self.progress.start()
			self.progress.set_text("Loading..")
			process_events()

			for child in self.get_children():
					self.remove(child)

			dos_files=inp_get_token_value("device_epitaxy.inp", "#layers")

			self.main_tab=tab_main()
			self.main_tab.init()
			self.main_tab.show()
			self.append_page(self.main_tab, gtk.Label(_("Device structure")))

			lines=[]
			pos=0
			if inp_load_file(lines,"gui_config.inp")==True:
				pos=0
				tab_number=0
				tabs=(len(lines)-3)/2
				print "tabs=",tabs
				while (1):
					add_to_widget=False
					ret,pos=inp_get_next_token_array(lines,pos)

					if ret[0]=="#ver":
						break

					file_name=ret[0]
					if file_name[0]=="#":
						file_name=file_name[1:]
					name=inp_file_to_description(file_name)
					if name==False:
						print "name not found",name
						break
					visible=bool(int(ret[1]))

					self.progress.set_fraction(float(tab_number)/float(tabs))

					tab_number=tab_number+1
					self.progress.set_text(_("Loading ")+name)
					process_events()
					if file_name=="pl0.inp":
						tab=pl_main()
						tab.init()
						tab.update()
						add_to_widget=True
						tab.visible=visible
						tab.label_name=name
						tab.file_name=file_name
					elif file_name=="epitaxy.inp":
						tab=dos_main()
						tab.init()
						tab.update()
						add_to_widget=True
						tab.visible=visible
						tab.label_name=name
						tab.file_name=file_name
					elif file_name=="lumo0.inp":
						tab=tab_bands()
						tab.update()
						if tab.enabled==True:
							add_to_widget=True
							tab.visible=visible
							tab.wow()
							tab.label_name=name
							tab.file_name=file_name

					elif inp_isfile(file_name)==True:
						add_to_widget=True
						tab=tab_class()
						tab.visible=visible
						tab.init(file_name,name)
						tab.label_name=name
						tab.file_name=file_name

					if add_to_widget==True:
						#print file_name,name,visible,type(tab)
						hbox=gtk.HBox()
						hbox.set_size_request(-1, 25)
						mytext=name
						if len(mytext)<10:
							for i in range(len(mytext),10):
								mytext=mytext+" "

						label=gtk.Label(mytext)
						label.set_justify(gtk.JUSTIFY_LEFT)
						self.connect("switch-page", self.callback_switch_page)
						hbox.pack_start(label, False, True, 0)

						button = gtk.Button()
						close_image = gtk.Image()
						close_image.set_from_file(os.path.join(get_image_file_path(),"close.png"))
						print os.path.join(get_image_file_path(),"close.png")
						close_image.show()
						button = gtk.Button()
						button.add(close_image)


						button.props.relief = gtk.RELIEF_NONE
						button.connect("clicked", self.callback_close_button,name)
						button.set_size_request(25, 25)
						button.show()
					

						hbox.pack_end(button, False, False, 0)
						hbox.show_all()

						if (visible==True):
							tab.show()

						self.append_page(tab,hbox)



						self.set_tab_reorderable(tab,True)

						self.add_to_menu(name,visible)

			else:
				print _("No gui_config.inp file found\n")

			#for child in self.get_children():
			#		print type(child)

			if self.terminal_widget!=None:
				self.terminal_widget.show()
				self.append_page(self.terminal_widget, gtk.Label(_("Terminal")))


			self.add_welcome_page()

			self.finished_loading=True
			self.progress.stop()
			self.progress.set_fraction(0.0)
			self.goto_page("tab_main")

			self.set_tab_pos(gtk.POS_TOP)
			#self.set_current_page(1)

			return True
		else:
			self.add_welcome_page()
			self.goto_page(_("Welcome"))
			return False
예제 #3
0
def debug_mode():
	if os.path.isfile(os.path.join(get_bin_path(),"debug_mode"))==True:
		return True
	else:
		return False
예제 #4
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")
예제 #5
0
	def load(self):
		self.clean_menu()
		self.last_page=0

		#self.setTabsClosable(True)
		self.setMovable(True)
		if (os.path.exists("sim.gpvdm")==True) and (os.path.normcase(os.getcwd())!=os.path.normcase(get_bin_path())):
			self.finished_loading=False
			#self.progress.init()
			#self.progress.show()
			#self.progress.start()
			#self.progress.set_text("Loading..")
			#process_events()

			self.clear()

#			dos_files=inp_get_token_value("device_epitaxy.inp", "#layers")

			widget=tab_main()

			self.addTab(widget,_("Device structure"))

	
			lines=[]
			pos=0
			if inp_load_file(lines,"gui_config.inp")==True:
				pos=0
				tab_number=0
				tabs=(len(lines)-3)/2
				while (1):
					add_to_widget=False
					ret,pos=inp_get_next_token_array(lines,pos)

					if ret[0]=="#ver":
						break

					file_name=ret[0]
					if file_name[0]=="#":
						file_name=file_name[1:]
					name=inp_file_to_description(file_name)
					if name==False:
						print("name not found",name)
						break
					visible=bool(int(ret[1]))

					#self.progress.set_fraction(float(tab_number)/float(tabs))

					tab_number=tab_number+1
					#self.progress.set_text(_("Loading ")+name)
					#process_events()

					if file_name=="lumo0.inp":
						widget=tab_bands()
						#tab.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif file_name=="epitaxy.inp":
						widget=dos_main()
						widget.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif file_name=="pl0.inp":
						widget=pl_main()
						widget.update()
						add_to_widget=True
						widget.visible=visible
						widget.label_name=name
						widget.file_name=file_name
					elif inp_isfile(file_name)==True:
						add_to_widget=True
						widget=tab_class()
						widget.init(file_name,name)


					#	add_to_widget=True
					#	tab=
					#	tab.visible=visible
					#	tab.init(file_name,name)
					#	tab.label_name=name
					#	tab.file_name=file_name

					if add_to_widget==True:
						mytext=name
						if len(mytext)<10:
							for i in range(len(mytext),10):
								mytext=mytext+" "
						self.addTab(widget,mytext)


			self.terminal=tab_terminal()
			self.terminal.init()
			self.addTab(self.terminal,"Terminal")
			self.terminal.run(os.getcwd(),get_exe_command()+" --version --html")

			self.add_info_page()

			return True




			self.finished_loading=True
			#self.progress.stop()
			#self.progress.set_fraction(0.0)
			self.goto_page("tab_main")

		else:
			self.add_info_page()
			self.goto_page(_("Information"))
			return False
예제 #6
0
def ver_load_info():
	lines=[]
	global core
	global mat
	global ver_error

	core=""
	mat=""
	ver_error=""

	ver_file_path=os.path.join(get_inp_file_path(),"ver.inp")

	if inp_load_file(lines,ver_file_path)==True:
		core=lines[1]
		mat=lines[5]
		return True
	else:
		ver_error="I can not find the file sim.gpvdm/ver.inp.\n\nI have tried looking in "+ver_file_path+"\n\nThe share path is"+get_share_path()+"\n\nThe bin path is"+get_bin_path()+"\n\nThe current working dir is "+os.getcwd()+"\n\nTry reinstalling a new version of gpvdm and/or report the bug to me at  [email protected]."
		return False