Example #1
0
	def add_page(self,name):

		hbox=gtk.HBox()

		hbox.set_size_request(-1, 25)
		label=gtk.Label("")
		sim_name=os.path.basename(os.path.normpath(name))
		print "Looking for",sim_name,name
		self.rod.append(scan_vbox())
		self.rod[len(self.rod)-1].init(self.myserver,self.tooltips,self.status_bar,self.context_id,label,self.sim_dir,sim_name)
		label.set_justify(gtk.JUSTIFY_LEFT)
		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"))
		close_image.show()
		button.add(close_image)
		button.props.relief = gtk.RELIEF_NONE
		button.connect("clicked", self.callback_view_toggle_tab,self.rod[len(self.rod)-1].tab_name)
		button.set_size_request(25, 25)
		button.show()

		hbox.pack_end(button, False, False, 0)
		hbox.show_all()
		self.notebook.append_page(self.rod[len(self.rod)-1],hbox)
		self.notebook.set_tab_reorderable(self.rod[len(self.rod)-1],True)

		menu_item = gtk.CheckMenuItem(sim_name)		   
		menu_item.set_active(True)
		self.tab_menu.append(menu_item)
		menu_item.show()
		menu_item.set_active(self.rod[len(self.rod)-1].visible)
		#print "Rod",name,self.rod[len(self.rod)-1].visible
		menu_item.connect("activate", self.callback_view_toggle,menu_item)

		self.number_of_tabs=self.number_of_tabs+1
Example #2
0
 def add_page(self, name):
     tab = scan_vbox(self.myserver, self.status_bar, self.sim_dir, name)
     self.notebook.addTab(tab, os.path.basename(name))
Example #3
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()
Example #4
0
	def add_page(self,name):
		tab=scan_vbox(self.myserver,self.status_bar,self.sim_dir,name)
		self.notebook.addTab(tab,os.path.basename(name))