示例#1
0
    def on_selection_changed(self):
        self.selected = []

        if len(self.selectedItems()) > 0:
            item = self.selectedItems()[0]
            if type(item) != None:
                obj = self.decode_name(item.text())
                if obj == None:
                    return

                file_name = obj.file_name

                self.file_path = os.path.join(self.path, file_name)

            for item in self.selectedItems():
                self.selected.append(self.decode_name(item.text()))

            full_path = self.file_path

            if (file_name.endswith(".dat") == True):
                state = dat_file()
                get_plot_file_info(state, full_path)
                summary = "<big><b>" + file_name + "</b></big><br><br>" + _(
                    "title") + ": " + state.title + "<br>" + _(
                        "x axis"
                    ) + ": " + state.y_label + " (" + latex_to_html(
                        state.y_units) + ")<br>" + _(
                            "y axis"
                        ) + ": " + state.data_label + " (" + latex_to_html(
                            state.data_units) + ")<br><br><big><b>" + _(
                                "Double click to open") + "</b></big>"
                help_window().help_set_help(["dat_file.png", summary])

            if file_name.endswith("equilibrium"):
                state = dat_file()
                get_plot_file_info(state, full_path)
                summary = "<big><b>" + _(
                    "equilibrium"
                ) + "</b></big><br><br>" + _(
                    "This contains the simulation output at 0V in the dark.")
                help_window().help_set_help(["folder.png", summary])

            #if os.path.isdir(full_path)==True:
            if get_dir_type(full_path) == "material":

                summary = "<b><big>" + file_name + "</b></big><br>"
                ref_path = os.path.join(full_path, "mat.bib")
                b = bibtex()

                if b.load(ref_path) != False:
                    summary = summary + b.get_text()
                help_window().help_set_help(["organic_material", summary])

        self.selection_changed.emit()
示例#2
0
	def on_selection_changed(self,item):
		if type(item)!=None:
			file_name=item.text()
			print(file_name)
			full_path=os.path.join(self.dir, file_name)
			if (file_name.endswith(".dat")==True):
				state=plot_state()
				get_plot_file_info(state,full_path)
				summary="<big><b>"+file_name+"</b></big><br>"+_("<br>title: ")+state.title+_("<br>x axis: ")+state.x_label+" ("+latex_to_html(state.x_units)+_(")<br>y axis: ")+state.y_label+" ("+latex_to_html(state.y_units)+_(")<br><br><big><b>Double click to open</b></big>")
				help_window().help_set_help(["dat_file.png",summary])

			if file_name.endswith("equilibrium"):
				state=plot_state()
				get_plot_file_info(state,full_path)
				summary="<big><b>equilibrium</b></big><br>"+_("<br>This contains the simulation output at 0V in the dark.")
				help_window().help_set_help(["dir_file.png",summary])
示例#3
0
	def on_selection_changed(self, widget):
		selected=self.icon_view.get_selected_items()
		if len(selected)!=0:
			icon_pos=selected[0][0]
			icon_name=self.store[icon_pos][0]
			icon_type=self.store[icon_pos][COL_IS_DIRECTORY]
			full_path=os.path.join(self.dir,icon_name)
			if icon_type=="dat":
				state=plot_state()
				get_plot_file_info(state,full_path)
				summary="<big><b>"+self.store[icon_pos][0]+"</b></big>\n"+_("\ntitle: ")+state.title+_("\nx axis: ")+state.x_label+" ("+latex_to_pygtk_subscript(state.x_units)+_(")\ny axis: ")+state.y_label+" ("+latex_to_pygtk_subscript(state.y_units)+_(")\n\n<big><b>Double click to open</b></big>")
				my_help_class.help_set_help(["dat_file.png",summary])

			if icon_name.endswith("equilibrium"):
				state=plot_state()
				get_plot_file_info(state,full_path)
				summary="<big><b>equilibrium</b></big>\n"+_("\nThis contains the simulation output at 0V in the dark.")
				my_help_class.help_set_help(["dir_file.png",summary])
示例#4
0
    def on_selection_changed(self):
        if len(self.selectedItems()) > 0:
            item = self.selectedItems()[0]

            if type(item) != None:
                file_name = self.decode_name(item.text())
                if file_name == None:
                    return

                self.file_path = os.path.join(self.path, file_name)
            return

            if (file_name.endswith(".dat") == True):
                state = dat_file()
                get_plot_file_info(state, full_path)
                summary = "<big><b>" + file_name + "</b></big><br><br>" + _(
                    "title") + ": " + state.title + "<br>" + _(
                        "x axis"
                    ) + ": " + state.x_label + " (" + latex_to_html(
                        state.x_units) + ")<br>" + _(
                            "y axis"
                        ) + ": " + state.data_label + " (" + latex_to_html(
                            state.data_units) + ")<br><br><big><b>" + _(
                                "Double click to open") + "</b></big>"
                help_window().help_set_help(["dat_file.png", summary])

            if file_name.endswith("equilibrium"):
                state = dat_file()
                get_plot_file_info(state, full_path)
                summary = "<big><b>" + _(
                    "equilibrium"
                ) + "</b></big><br><br>" + _(
                    "This contains the simulation output at 0V in the dark.")
                help_window().help_set_help(["folder.png", summary])

            if os.path.isdir(full_path) == True:
                if os.path.isfile(os.path.join(full_path, "mat.inp")):
                    summary = "<b><big>" + file_name + "</b></big><br>"
                    ref_path = os.path.join(full_path, "n.ref")
                    ref = get_ref_text(ref_path)
                    if ref != None:
                        summary = summary + ref
                    help_window().help_set_help(["organic_material", summary])
示例#5
0
	def draw_graph(self):
		self.layer_end=[]
		self.layer_name=[]

		n=0
		self.my_figure.clf()
		ax1 = self.my_figure.add_subplot(111)
		ax2 = ax1.twinx()
		x_pos=0.0
		layer=0
		color =['r','g','b','y','o','r','g','b','y','o']
		start=0.0

		for i in range(0,epitaxy_get_layers()):
			if epitaxy_get_electrical_layer(i)=="none":
				start=start-epitaxy_get_width(i)
			else:
				break
		print "START=",start
		start=start*1e9

		x_pos=start
		for i in range(0,epitaxy_get_layers()):

			label=epitaxy_get_mat_file(i)
			layer_ticknes=epitaxy_get_width(i)
			layer_material=epitaxy_get_mat_file(i)

			delta=float(layer_ticknes)*1e9
			if epitaxy_get_electrical_layer(i)=="none":
				mat_file=os.path.join(os.getcwd(),'materials',layer_material,'mat.inp')
				myfile = open(mat_file)
				self.mat_file_lines = myfile.readlines()
				myfile.close()
			
				for ii in range(0, len(self.mat_file_lines)):
					self.mat_file_lines[ii]=self.mat_file_lines[ii].rstrip()

				lumo=-float(self.mat_file_lines[1])
				Eg=float(self.mat_file_lines[3])
			else:
				lines=[]
				if inp_load_file(lines,epitaxy_get_electrical_layer(i)+".inp")==True:
					lumo=-float(inp_search_token_value(lines, "#Xi"))
					Eg=float(inp_search_token_value(lines, "#Eg"))

			x = [x_pos,x_pos+delta,x_pos+delta,x_pos]

			lumo_delta=lumo-0.1
			h**o=lumo-Eg
			homo_delta=h**o-0.1
			if Eg==0.0:
				lumo_delta=-7.0
				h**o=0.0
			lumo_shape = [lumo,lumo,lumo_delta,lumo_delta]
			x_pos=x_pos+delta
			self.layer_end.append(x_pos)
			self.layer_name.append(layer_material)
			ax2.fill(x,lumo_shape, color[layer],alpha=0.4)
			ax2.text(x_pos-delta/1.5, lumo-0.4, epitaxy_get_name(i))

			if h**o!=0.0:
				homo_shape = [h**o,h**o,homo_delta,homo_delta]
				ax2.fill(x,homo_shape, color[layer],alpha=0.4)

			layer=layer+1

			n=n+1

		state=plot_state()
		get_plot_file_info(state,self.optical_mode_file)
		#summary="<big><b>"+self.store[path[0]][0]+"</b></big>\n"+"\ntitle: "+state.title+"\nx axis: "+state.x_label+" ("+latex_to_pygtk_subscript(state.x_units)+")\ny axis: "++" ("+latex_to_pygtk_subscript(state.y_units)+")\n\n<big><b>Double click to open</b></big>"

		print "ROD!!!!",state.y_label,self.optical_mode_file
		ax1.set_ylabel(state.y_label)
		ax1.set_xlabel('Position (nm)')
		ax2.set_ylabel('Energy (eV)')
		ax2.set_xlim([start, x_pos])
		#ax2.axis(max=)#autoscale(enable=True, axis='x', tight=None)
		loaded=False

		if os.path.isfile("light_dump.zip"):
			zf = zipfile.ZipFile("light_dump.zip", 'r')
			lines = zf.read(self.optical_mode_file).split("\n")
			zf.close()
			loaded=True
		elif os.path.isfile(self.optical_mode_file):
			print "I want to load",self.optical_mode_file
			f = open(self.optical_mode_file)
			lines = f.readlines()
			f.close()
			loaded=True
		
		if loaded==True:
			xx=[]
			yy=[]
			zz=[]
			lines_to_xyz(xx,yy,zz,lines)
			t = asarray(xx)
			s = asarray(yy)

			t=t*1e9
			ax1.plot(t,s, 'black', linewidth=3 ,alpha=0.5)

			

		self.my_figure.tight_layout()