Ejemplo n.º 1
0
	def callback_plot_select(self):
		help_window().help_set_help(["dat_file.png",_("<big>Select a file to plot</big><br>Single clicking shows you the content of the file")])

		dialog=gpvdm_open(os.getcwd())
		dialog.show_inp_files=False
		dialog.show_directories=False
		ret=dialog.window.exec_()
		if ret==QDialog.Accepted:
			split=dialog.get_filename().split(".")
			if len(split)>1:
				if split[1]=="xlsx" or split[1]=="xls":
					desktop_open(dialog.get_filename())
	
					print("open with excel")
					return
				
			if os.path.basename(dialog.get_filename())=="sim_info.dat":
				if self.sim_info_window==None:
					self.sim_info_window=sim_info(dialog.get_filename())

				if self.sim_info_window.isVisible()==True:
					self.sim_info_window.hide()
				else:
					self.sim_info_window.show()
				return

			plot_gen([dialog.get_filename()],[],"auto")
Ejemplo n.º 2
0
    def on_item_activated(self, item):
        text = item.text()
        if text == "..":
            self.set_path(os.path.dirname(self.path))
            self.fill_store()
            return

        decode = self.decode_name(text)
        if self.decode_name(text).startswith("http"):
            webbrowser.open(decode)
            return

        full_path = os.path.join(self.path, decode)

        if os.path.isfile(full_path) == True:
            self.file_path = full_path
            if self.open_own_files == True:
                if isfiletype(full_path, "xls") == True or isfiletype(
                        full_path, "xlsx") == True or isfiletype(
                            full_path, "pdf") == True:
                    desktop_open(full_path)
                    self.reject.emit()
                    return
                elif isfiletype(full_path, "jpg") == True:
                    desktop_open(full_path)
                    self.reject.emit()
                    return
                elif os.path.basename(full_path) == "sim_info.dat":
                    self.sim_info_window = sim_info(full_path)
                    self.sim_info_window.show()
                    self.reject.emit()
                    return
                elif isfiletype(full_path, "dat") == True:
                    plot_gen([full_path], [], "auto")
                    self.reject.emit()
                    return
            else:
                self.accept.emit()
                return
        else:
            if os.path.isfile(os.path.join(full_path, "mat.inp")) == True:
                self.file_path = full_path

                gpvdm_file_type = inp_get_token_value(
                    os.path.join(full_path, "mat.inp"), "#gpvdm_file_type")
                if gpvdm_file_type == "spectra":
                    from spectra_main import spectra_main
                    self.mat_window = spectra_main(full_path)
                    self.mat_window.show()
                elif gpvdm_file_type == "mat":
                    from materials_main import materials_main
                    self.mat_window = materials_main(full_path)
                    self.mat_window.show()

                self.accept.emit()
            else:
                self.set_path(full_path)
                #self.path = full_path
                self.fill_store()
Ejemplo n.º 3
0
	def onclick(self, event):
		print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%(
		event.button, event.x, event.y, event.xdata, event.ydata)
		for i in range(0,len(self.layer_end)):
			if (self.layer_end[i]>event.xdata):
				break
		pwd=os.getcwd()
		plot_gen([os.path.join(pwd,"materials",self.layer_name[i],"alpha.omat")],[],None,"")
Ejemplo n.º 4
0
 def onclick(self, event):
     for i in range(0, len(self.layer_end)):
         if (self.layer_end[i] > event.xdata):
             break
     pwd = get_sim_path()
     plot_gen(
         [os.path.join(pwd, "materials", self.layer_name[i], "alpha.gmat")],
         [], None, "")
Ejemplo n.º 5
0
	def plot_results(self,plot_token):
		plot_token.key_units=self.get_units()
		print("scanning",self.sim_dir)
		plot_files, plot_labels, config_file = scan_gen_plot_data(plot_token,self.sim_dir)
		print(plot_files, plot_labels)
		plot_save_oplot_file(config_file,plot_token)
		plot_gen(plot_files,plot_labels,config_file)

		self.last_plot_data=plot_token
		return
Ejemplo n.º 6
0
    def plot_results(self, data_file):
        data_file.key_units = self.get_units()
        #print("scanning",self.scan_io.scan_dir)
        plot_files, plot_labels, config_file = scan_gen_plot_data(
            data_file, self.scan_io.scan_dir)
        #print("rod>>>>",plot_files, plot_labels)
        plot_gen(plot_files, plot_labels, config_file)

        self.last_plot_data = data_file
        return
Ejemplo n.º 7
0
	def callback_view_materials(self):
		dialog=gpvdm_open(get_materials_path())
		dialog.show_inp_files=False
		ret=dialog.window.exec_()

		if ret==QDialog.Accepted:
			if os.path.isfile(os.path.join(dialog.get_filename(),"mat.inp"))==True:
				self.mat_window=materials_main(dialog.get_filename())
				self.mat_window.show()
			else:
				plot_gen([dialog.get_filename()],[],"auto")
Ejemplo n.º 8
0
    def plot_results(self, plot_token):
        plot_token.key_units = self.get_units()
        #print("scanning",self.sim_dir)
        plot_files, plot_labels, config_file = scan_gen_plot_data(
            plot_token, self.sim_dir)
        #print(plot_files, plot_labels)
        plot_save_oplot_file(config_file, plot_token)
        plot_gen(plot_files, plot_labels, config_file)

        self.last_plot_data = plot_token
        return
Ejemplo n.º 9
0
	def plot_results(self,plot_token):
		plot_token.key_units=self.get_units()
		print "here!!!!!!!!!!"
		plot_files, plot_labels, config_file = scan_gen_plot_data(plot_token,self.sim_dir)
		print plot_files, plot_labels
		plot_save_oplot_file(config_file,plot_token)
		plot_gen(plot_files,plot_labels,config_file)
		self.plot_open.set_sensitive(True)

		self.last_plot_data=plot_token

		return 
Ejemplo n.º 10
0
	def callback_plot_select(self):
		help_window().help_set_help(["dat_file.png",_("<big>Select a file to plot</big><br>Single clicking shows you the content of the file")])

		dialog=gpvdm_open(get_sim_path(),show_inp_files=False)
		dialog.show_directories=False
		ret=dialog.exec_()
		if ret==QDialog.Accepted:
			file_name=dialog.get_filename()

			if os.path.basename(dialog.get_filename())=="sim_info.dat":
				self.sim_info_window=sim_info(dialog.get_filename())
				self.sim_info_window.show()
				return

			plot_gen([dialog.get_filename()],[],"auto")
Ejemplo n.º 11
0
	def callback_view_materials(self, widget, data=None):
		dialog=opvdm_open()

		dialog.init(get_materials_path())
		dialog.show_inp_files=False
		response=dialog.run()


		if response == True:
			full_file_name=dialog.get_filename()
			plot_gen([dialog.get_filename()],[],"auto")

		elif response == gtk.RESPONSE_CANCEL:
		    print _("Closed, no files selected")
		dialog.destroy()
Ejemplo n.º 12
0
	def callback_plot_select(self, widget, data=None):
		my_help_class.help_set_help(["dat_file.png",_("<big>Select a file to plot</big>\nSingle clicking shows you the content of the file")])

		dialog=opvdm_open()
		dialog.show_inp_files=False
		dialog.show_directories=False

		dialog.init(os.getcwd())
		response=dialog.run()

		if response == True:
			full_file_name=dialog.get_filename()
			#self.plot_open.set_sensitive(True)

			plot_gen([dialog.get_filename()],[],"auto")

			self.plotted_graphs.refresh()
			self.plot_after_run_file=dialog.get_filename()
		elif response == gtk.RESPONSE_CANCEL:
		    print _("Closed, no files selected")
		dialog.destroy()
Ejemplo n.º 13
0
    def on_item_activated(self, item):
        text = item.text()
        if text == "..":
            if self.path == self.root_dir:
                self.set_path("/gpvdmroot")
            else:
                old_path = self.path
                self.set_path(os.path.dirname(self.path))
                #print(self.path,old_path,os.path.dirname(self.path))
                if old_path == self.path:
                    self.set_path("/gpvdmroot")
            self.fill_store()
            return

        decode = self.decode_name(text)
        full_path = os.path.join(self.path, decode.file_name)

        if decode.file_name.startswith("http"):
            webbrowser.open(decode)
            return
        elif decode.file_name == "home_dir":
            self.set_path(get_home_path())
            self.fill_store()
            return
        elif decode.file_name == "desktop_dir":
            self.set_path(get_desktop_path())
            self.fill_store()
            return
        elif decode.file_name == "gpvdm_configure":
            self.set_path("/gpvdmroot/gpvdm_configure")
            self.fill_store()
            return

        elif decode.file_name == "music_dir":
            self.set_path(get_music_path())
            self.fill_store()
            return
        elif decode.file_name == "downloads_dir":
            self.set_path(get_downloads_path())
            self.fill_store()
            return
        elif decode.file_name == "simulation_dir":
            self.set_path(get_sim_path())
            self.fill_store()
            return
        elif decode.file_name.startswith("mount_point") == True:
            point = decode.split("::::")
            self.set_path(point[1])
            self.fill_store()
            return
        elif decode == "gpvdm_cluster_config":
            self.win = cluster_config_window(self)
            self.win.show()
            return
        elif decode.file_name == "gpvdm_language_config":
            self.config_window = class_config_window()

            from tab_lang import language_tab_class

            self.config_window.files = []
            self.config_window.description = []
            self.config_window.init()
            lang_tab = language_tab_class()
            self.config_window.notebook.addTab(lang_tab, _("Language"))
            self.config_window.show()

            return
        elif decode.file_name == "gpvdm_solver_config":
            self.config_window = class_config_window()
            self.config_window.files = ["math.inp"]
            self.config_window.description = [_("Solver configuration")]
            self.config_window.init()
            self.config_window.show()

            return

        elif decode.file_name == "gpvdm_dump_config":
            self.config_window = class_config_window()
            self.config_window.files = ["dump.inp"]
            self.config_window.description = [_("Output files")]
            self.config_window.init()
            self.config_window.show()
            return
        elif decode.file_name == "gpvdm_gui_config":
            self.config_window = class_config_window()
            self.config_window.files = ["config.inp"]
            self.config_window.description = [
                _("GUI configuration"),
            ]
            self.config_window.init()
            self.config_window.show()
            return
        elif decode.file_name == "gpvdm_server_config":
            self.config_window = class_config_window()
            self.config_window.files = ["server.inp"]
            self.config_window.description = [_("Server configuration")]
            self.config_window.init()
            self.config_window.show()
            return
        elif decode.file_name == "gpvdm_key":
            from lock_key_manager import lock_key_manager
            from msg_dlg import msg_dlg
            self.lock_key_manager = lock_key_manager(
                show_text=False,
                override_text=_("Please enter your license key:"))
            ret = self.lock_key_manager.run()
            if ret == QDialog.Accepted:
                msgBox = msg_dlg()
                msgBox.setText("License updated")
                reply = msgBox.exec_()
        elif decode.file_name == "gpvdm_cache":
            from cache import cache
            self.c = cache()
            self.c.show()
        elif decode.type == "scan_dir":
            from scan_tab import scan_vbox
            #print(full_path)
            self.scan_window = scan_vbox(full_path)
            self.scan_window.show()
            return
        elif decode.type == "parameter_dir":
            self.set_path(full_path)
            self.fill_store()
            return
        dir_type = get_dir_type(full_path)

        if self.open_own_files == True:
            self.file_path = full_path

            if dir_type == "spectra":
                from spectra_main import spectra_main
                self.mat_window = spectra_main(full_path)
                self.mat_window.show()
                return
            if dir_type == "shape":
                from shape_editor import shape_editor
                self.windows.append(shape_editor(full_path))
                self.windows[-1].show()
                return
            if dir_type == "light":
                from optics import class_optical
                self.optics_window = class_optical()
                self.optics_window.show()

            if dir_type == "material":
                from materials_main import materials_main
                self.mat_window = materials_main(full_path)
                self.mat_window.show()
                return

            if dir_type == "emission":
                from emission_main import emission_main
                self.emission_window = emission_main(full_path)
                self.emission_window.show()
                return

            if dir_type == "snapshots":
                from cmp_class import cmp_class

                help_window().help_set_help([
                    "plot_time.png",
                    _("<big><b>Examine the results in time domain</b></big><br> After you have run a simulation in time domain, if is often nice to be able to step through the simulation and look at the results.  This is what this window does.  Use the slider bar to move through the simulation.  When you are simulating a JV curve, the slider sill step through voltage points rather than time points."
                      )
                ])

                self.snapshot_window.append(cmp_class(full_path))
                self.snapshot_window[-1].show()
                #print("snapshots!!")
                return

            if dir_type == "backup":
                ret = yes_no_dlg(
                    self,
                    _("Are you sure you want restore this file from the backup, it will overwrite all files in the simulation directory?"
                      ) + "\n\n" + full_path)
                if ret == True:
                    from backup import backup_restore
                    backup_restore(get_sim_path(), full_path)

            if dir_type == "file":
                self.file_path = full_path
                if os.path.basename(full_path) == "sim_info.dat":
                    self.sim_info_window = sim_info(full_path)
                    self.sim_info_window.show()
                    return

                if isfiletype(full_path, "dat") == True:
                    text = peek_data(full_path)
                    if text.startswith(b"#multiplot"):
                        my_multiplot = multiplot()
                        my_multiplot.plot(full_path)
                    else:
                        plot_gen([full_path], [], "auto")
                    return

                if isfiletype(full_path, "gpvdm") == True:
                    return

                desktop_open(full_path)
                return
#self.reject.emit()

        if dir_type == "dir" or dir_type == "backup_main" or dir_type == "multi_plot_dir":
            self.file_path = full_path
            self.set_path(full_path)
            self.fill_store()
        else:
            self.accept.emit()
Ejemplo n.º 14
0
	def onclick(self, event):
		for i in range(0,len(self.layer_end)):
			if (self.layer_end[i]>event.xdata):
				break
		pwd=os.getcwd()
		plot_gen([os.path.join(pwd,"materials",self.layer_name[i],"alpha.omat")],[],None,"")
Ejemplo n.º 15
0
	def callback_plot_open(self, widget, data=None):
		plot_gen([self.plot_after_run_file],[],"")
Ejemplo n.º 16
0
 def callback_last_menu_click(self, widget, data):
     #self.plot_open.set_sensitive(True)
     file_to_load = os.path.join(get_sim_path(), data.file0)
     plot_gen([file_to_load], [], "auto")
     self.plot_after_run_file = file_to_load
Ejemplo n.º 17
0
	def callback_plot(self):
		file_name=os.path.join(get_sim_path(),"temp.dat")
		a = open(file_name, "w")
		a.write(self.out_data.toPlainText())
		a.close()
		plot_gen([file_name],[],"auto")
Ejemplo n.º 18
0
	def callback_last_menu_click(self, widget, data):
		#self.plot_open.set_sensitive(True)
		file_to_load=os.path.join(os.getcwd(),data.file0)
		plot_gen([file_to_load],[],"auto")
		self.plot_after_run_file=file_to_load
Ejemplo n.º 19
0
	def on_item_activated(self,item):
		text=item.text()
		if text=="..":
			if self.path==self.root_dir:
				self.set_path("/gpvdmroot")
			else:
				old_path=self.path
				self.set_path(os.path.dirname(self.path))
				print(self.path,old_path,os.path.dirname(self.path))
				if old_path==self.path:
					self.set_path("/gpvdmroot")
			self.fill_store()
			return

		decode=self.decode_name(text)
		if decode.startswith("http"):
			webbrowser.open(decode)
			return
		elif decode=="home_dir":
			self.set_path(get_home_path())
			self.fill_store()
			return
		elif decode=="desktop_dir":
			self.set_path(get_desktop_path())
			self.fill_store()
			return
		elif decode=="gpvdm_configure":
			self.set_path("/gpvdmroot/gpvdm_configure")
			self.fill_store()
			return

		elif decode=="music_dir":
			self.set_path(get_music_path())
			self.fill_store()
			return
		elif decode=="downloads_dir":
			self.set_path(get_downloads_path())
			self.fill_store()
			return
		elif decode=="simulation_dir":
			self.set_path(get_sim_path())
			self.fill_store()
			return			
		elif decode.startswith("mount_point")==True:
			point=decode.split("::::")
			self.set_path(point[1])
			self.fill_store()
			return
		elif decode=="gpvdm_cluster_config":
			self.win=cluster_config_window(self)
			self.win.show()
			return
		elif decode=="gpvdm_language_config":
			self.config_window=class_config_window()

			from tab_lang import language_tab_class

			self.config_window.files=[ ]
			self.config_window.description=[]
			self.config_window.init()
			lang_tab=language_tab_class()
			self.config_window.notebook.addTab(lang_tab,_("Language"))
			self.config_window.show()

			return
		elif decode=="gpvdm_solver_config":
			self.config_window=class_config_window()
			self.config_window.files=["math.inp"]
			self.config_window.description=[_("Solver configuration")]
			self.config_window.init()
			self.config_window.show()

			return
		elif decode=="gpvdm_led_config":
			self.config_window=class_config_window()
			self.config_window.files=["led.inp"]
			self.config_window.description=[_("LED")]
			self.config_window.init()
			self.config_window.show()
			return
		elif decode=="gpvdm_dump_config":
			self.config_window=class_config_window()
			self.config_window.files=["dump.inp"]
			self.config_window.description=[_("Output files")]
			self.config_window.init()
			self.config_window.show()
			return
		elif decode=="gpvdm_gui_config":
			self.config_window=class_config_window()
			self.config_window.files=["config.inp"]
			self.config_window.description=[_("GUI configuration"),]
			self.config_window.init()
			self.config_window.show()
			return
		elif decode=="gpvdm_thermal_config":
			self.config_window=class_config_window()
			self.config_window.files=["thermal.inp"]
			self.config_window.description=[_("Thermal")]
			self.config_window.init()
			self.config_window.show()
			return
		elif decode=="gpvdm_server_config":
			self.config_window=class_config_window()
			self.config_window.files=["server.inp"]
			self.config_window.description=[_("Server configuration")]
			self.config_window.init()
			self.config_window.show()
			return


		full_path=os.path.join(self.path,decode)
		if is_mat_file(full_path)==True:
			print("mat file!!")
			from materials_main import materials_main
			self.mat_window=materials_main(full_path)
			self.mat_window.show()
			return


		if os.path.isfile(full_path)==True:
			self.file_path=full_path
			if self.open_own_files==True:
				if os.path.basename(full_path)=="sim_info.dat":
					self.sim_info_window=sim_info(full_path)
					self.sim_info_window.show()
					self.reject.emit()
					return
				elif isfiletype(full_path,"dat")==True:
					plot_gen([full_path],[],"auto")
					self.reject.emit()
					return

				else:
					desktop_open(full_path)
					self.reject.emit()
					return

#				else:
#					self.accept.emit()	
			else:
				self.accept.emit()
				return
		else:
			if os.path.isfile(os.path.join(full_path,"mat.inp"))==True:
				self.file_path=full_path

				gpvdm_file_type=inp_get_token_value(os.path.join(full_path,"mat.inp"), "#gpvdm_file_type")
				if gpvdm_file_type=="spectra":
					from spectra_main import spectra_main
					self.mat_window=spectra_main(full_path)
					self.mat_window.show()

				self.accept.emit()
			else:
				self.set_path(full_path)
				#self.path = full_path
				self.fill_store()