def __init__(self, verbose=True): self.save_dir = os.getcwd() self.server = base_server() if verbose == True: self.server.pipe_to_null = False else: self.server.pipe_to_null = True #self.server.base_server_init(get_sim_path()) if server_get() != False: self.server = server_get() self.server.clear_cache() self.epi = get_epi() if self.epi.loaded == False: self.epi.load(os.getcwd()) self.scan = api_scan(self.server) #image ops self.Image = Image self.ImageFilter = ImageFilter self.ImageOps = ImageOps self.path = "" self.callback = None self.get_scan_human_labels = get_scan_human_labels() self.get_scan_human_labels.clear() self.get_scan_human_labels.populate_from_known_tokens() self.get_scan_human_labels.populate_from_files()
def do_emit(self): value = False if self.running == False: self.start_sim.emit() else: server_get().killall()
def callback_run_fit(self, widget): if self.fit_window==None: self.fit_window=fit_window("fit") server_get().set_fit_update_function(self.fit_window.update) help_window().help_set_help(["fit.png",_("<big><b>Fit window</b></big><br> Use this window to fit the simulation to experimental data. Gpvdm uses advanced and optimized fitting algorithms to fit the model to your experimental data, so that material parameters such as mobilities and recombination rates can be extracted."),"youtube",_("<big><b><a href=\"https://www.youtube.com/watch?v=61umU4hrsqk\">Watch the tutorial video 1</b></big><br>Fitting gpvdm to experimental data to extract mobility and recombination rate parameters."),"youtube",_("<big><b><a href=\"https://www.youtube.com/watch?v=_cm3Cb3kzUg\">Watch the tutorial video 2</b></big><br>Fitting gpvdm to large area solar cells")]) if self.fit_window.isVisible()==True: self.fit_window.hide() else: self.fit_window.show()
def __init__(self, parent, id, play_icon="media-playback-start", run_text=_("Run simulation")): self.play_icon = play_icon self.run_text = run_text self.running = False QAction_lock.__init__(self, self.play_icon, self.run_text, parent, id) self.clicked.connect(self.do_emit) server_get().sim_started.connect(self.start) server_get().sim_finished.connect(self.stop)
def callback_run_fit(self, widget): if self.fit_window == None: self.fit_window = fit_window("fit") server_get().set_fit_update_function(self.fit_window.update) help_window().help_set_help([ "fit.png", _("<big><b>Fit window</b></big><br> Use this window to fit the simulation to experimental data." ) ]) if self.fit_window.isVisible() == True: self.fit_window.hide() else: self.fit_window.show()
def __init__(self): QWidget.__init__(self) hbox=QHBoxLayout(self) mainLayout = QSplitter(Qt.Horizontal) self.viewer=gpvdm_viewer(get_sim_path()) self.viewer.allow_navigation=True self.viewer.set_directory_view(True) self.viewer.set_back_arrow(True) self.viewer.set_multi_select() hbox.addWidget(self.viewer) self.setLayout(hbox) server_get().sim_finished.connect(self.refresh)
def __init__(self): QToolBar.__init__(self) self.myserver = server_get() self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(42, 42)) self.scan_window = None self.fit_window = None self.undo = QAction(QIcon_load("edit-undo"), _("Undo"), self) self.addAction(self.undo) self.addSeparator() self.run = QAction(QIcon_load("media-playback-start"), _("Run simulation"), self) self.addAction(self.run) self.stop = QAction(QIcon_load("media-playback-pause"), _("Stop\nsimulation"), self) self.stop.triggered.connect(self.callback_simulate_stop) self.addAction(self.stop) self.addSeparator() self.scan = QAction(QIcon_load("scan"), _("Parameter\nscan"), self) self.scan.triggered.connect(self.callback_scan) self.addAction(self.scan) self.addSeparator() self.fit = QAction(QIcon_load("fit"), _("Fit\ndata"), self) self.fit.triggered.connect(self.callback_run_fit) self.addAction(self.fit) self.addSeparator() self.plot = QAction(QIcon_load("plot"), _("Plot\nFile"), self) self.plot.triggered.connect(self.callback_plot_select) self.addAction(self.plot) self.time = QAction(QIcon_load("plot_time"), _("Examine results\nin time domain"), self) self.time.triggered.connect(self.callback_examine) self.addAction(self.time) self.addSeparator() self.sun = tb_item_sun() self.sun.changed.connect(self.callback_sun) self.addWidget(self.sun) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.addWidget(spacer) self.help = QAction(QIcon_load("internet-web-browser"), _("Help"), self) self.addAction(self.help)
def callback_run_all_simulations(self): scansio=scans_io(self.sim_dir) scans=scansio.get_scans() for s in scans: s.parent_window=self s.myserver=server_get() s.set_base_dir(get_sim_path()) s.run()
def __init__(self): QTabWidget.__init__(self) self.cluster_tab = None self.setMaximumHeight(140) #self.setStyleSheet("QWidget { background-color:cyan; }") self.myserver = server_get() self.holder = QWidget() self.hbox = QHBoxLayout() self.holder.setLayout(self.hbox) self.toolbar = QToolBar() self.toolbar.setIconSize(QSize(32, 32)) self.about = QToolButton(self) self.about.setText(_("About")) self.about.pressed.connect(self.callback_about_dialog) self.cluster_button = QAction(QIcon_load("not_connected"), _("Connect to cluster"), self) self.cluster_button.triggered.connect(self.callback_cluster_connect) self.toolbar.addAction(self.cluster_button) self.hbox.addWidget(self.toolbar) self.hbox.addWidget(self.about) self.setCornerWidget(self.holder) w = self.file() self.addTab(w, _("File")) self.home = ribbon_home() self.addTab(self.home, _("Home")) self.simulations = ribbon_simulations() self.addTab(self.simulations, _("Simulations")) self.configure = ribbon_configure() self.addTab(self.configure, _("Configure")) #self.device=ribbon_device() #self.addTab(self.device,_("Device")) self.database = ribbon_database() self.addTab(self.database, _("Databases")) if enable_betafeatures() == True: self.tb_cluster = ribbon_cluster() self.addTab(self.tb_cluster, _("Cluster")) self.information = ribbon_information() self.addTab(self.information, _("Information")) #self.setStyleSheet("QWidget { background-color:cyan; }") css_apply(self, "style.css")
def __init__(self): QWidget.__init__(self) self.tab = QTabWidget() css_apply(self.tab, "style_h.css") self.vbox = QHBoxLayout() self.vbox.addWidget(self.tab) self.usage = cpu_usage() self.vbox.addWidget(self.usage) self.setLayout(self.vbox) self.my_server = server_get()
def __init__(self): QToolBar.__init__(self) self.actions=[] self.order=["jv","jv_perovskite","|","sun_voc","suns_jsc","equilibrium","|","TPC","TPV","|","IS", "IMPS","|", "CELIV","Photo"] self.dont_show=["photon_extraction"] self.myserver=server_get() self.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(42, 42)) global_object_register("ribbon_sim_mode_update",self.update)
def callback_scan(self, widget): help_window().help_set_help(["scan.png",_("<big><b>The scan window</b></big><br> Very often it is useful to be able to systematically very a device parameter such as mobility or density of trap states. This window allows you to do just that."),"list-add.png",_("Use the plus icon to add a new scan line to the list."),"youtube",_("<big><b><a href=\"https://www.youtube.com/watch?v=cpkPht-CKeE\">Tutorial video</b></big><br>Using the parameter scan window.")]) #self.tb_run_scan.setEnabled(True) if self.scan_window==None: self.scan_window=scan_class(server_get()) if self.scan_window.isVisible()==True: self.scan_window.hide() else: self.scan_window.show()
def callback_run_simulation(self): if self.tab.rowCount() == 0: error_dlg( self, _("You have not selected any parameters to scan through. Use the add button." )) return self.save_combo() self.scan_io.myserver = server_get() self.scan_io.myserver.callback = self.callback_build_plots self.scan_io.set_base_dir(get_sim_path()) self.scan_io.run()
def __init__(self): QToolBar.__init__(self) self.myserver = server_get() self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(42, 42)) self.cluster_get_data = QAction(icon_get("server_get_data"), wrap_text(_("Cluster get data"), 8), self) self.cluster_get_data.triggered.connect(self.callback_cluster_get_data) self.addAction(self.cluster_get_data) self.cluster_get_data.setEnabled(False) self.cluster_copy_src = QAction(icon_get("server_copy_src"), wrap_text(_("Copy src to cluster"), 8), self) self.cluster_copy_src.triggered.connect(self.callback_cluster_copy_src) self.addAction(self.cluster_copy_src) self.cluster_copy_src.setEnabled(False) self.cluster_make = QAction(icon_get("server_make"), wrap_text(_("Make on cluster"), 6), self) self.cluster_make.triggered.connect(self.callback_cluster_make) self.addAction(self.cluster_make) self.cluster_make.setEnabled(False) self.cluster_clean = QAction(icon_get("server_clean"), wrap_text(_("Clean cluster"), 8), self) self.cluster_clean.triggered.connect(self.callback_cluster_clean) self.addAction(self.cluster_clean) self.cluster_clean.setEnabled(False) self.cluster_off = QAction(icon_get("off"), wrap_text(_("Kill all cluster code"), 8), self) self.cluster_off.triggered.connect(self.callback_cluster_off) self.addAction(self.cluster_off) self.cluster_off.setEnabled(False) self.cluster_sync = QAction(icon_get("sync"), _("Sync"), self) self.cluster_sync.triggered.connect(self.callback_cluster_sync) self.addAction(self.cluster_sync) self.cluster_sync.setEnabled(False) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.addWidget(spacer) self.help = QAction(icon_get("internet-web-browser"), _("Help"), self) self.addAction(self.help)
def __init__(self): super().__init__() self.server=server_get() self.load=[] self.wait_last=0.0 self.setMinimumSize(40, 40) for i in range(0,1000): s=store() self.load.append(s) self.delta=0 self.start()
def callback_run(self): self.my_server = server_get() self.dump_optics = inp_get_token_value("dump.inp", "#dump_optics") #self.dump_optics_verbose=inp_get_token_value("dump.inp", "#dump_optics_verbose") inp_update_token_value("dump.inp", "#dump_optics", "true") #inp_update_token_value("dump.inp", "#dump_optics_verbose","true") #pwd=os.getcwd() #os.chdir(get_sim_path()) #cmd = get_exe_command()+' --simmode opticalmodel@optics' #print(cmd) #ret= os.system(cmd) #os.chdir(pwd) self.my_server.clear_cache() self.my_server.add_job(get_sim_path(), "--simmode opticalmodel@optics") self.my_server.set_callback_when_done(self.optics_sim_finished) self.my_server.start()
def __init__(self): QDialog.__init__(self) self.main_vbox = QVBoxLayout() self.setFixedSize(600, 450) self.setWindowTitle( _("Connect to cluster") + " (https://www.gpvdm.com)") self.setWindowIcon(icon_get("si")) #self.title=QLabel("<big><b>"+_("Which type of device would you like to simulate?")+"</b></big>") active_file = inp_find_active_file( os.path.join(get_sim_path(), "cluster")) self.viewer = tab_class() self.viewer.init(active_file, "cluster") #gpvdm_viewer(get_device_lib_path()) self.main_vbox.addWidget(self.viewer) self.hwidget = QWidget() self.myserver = server_get() if self.myserver.cluster == False: self.nextButton = QPushButton(_("Connect")) else: self.nextButton = QPushButton(_("Disconnect")) self.cancelButton = QPushButton(_("Cancel")) self.files = [] hbox = QHBoxLayout() hbox.addStretch(1) hbox.addWidget(self.cancelButton) hbox.addWidget(self.nextButton) self.hwidget.setLayout(hbox) self.main_vbox.addWidget(self.hwidget) self.setLayout(self.main_vbox) self.nextButton.clicked.connect(self.callback_connect) self.cancelButton.clicked.connect(self.callback_close)
def __init__(self): QWidget.__init__(self) self.main_vbox = QVBoxLayout() self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) # self.tab.cellChanged.connect(self.tab_changed) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.myserver = server_get() self.myserver.jobs_update.connect(self.callback_cluster_get_jobs) self.show()
def __init__(self): QWidget.__init__(self) self.updating = False #self.setMinimumSize(900, 600) self.setWindowIcon(icon_get("connected")) self.setWindowTitle(_("Cluster status (www.gpvdm.com)")) self.myserver = server_get() self.node_view = QWidget() self.node_view_vbox = QVBoxLayout() self.node_view.setLayout(self.node_view_vbox) self.main_vbox = QVBoxLayout() self.main_vbox.addWidget(self.node_view) self.node_view.show() self.setLayout(self.main_vbox) self.myserver.load_update.connect(self.callback_cluster_get_info)
def __init__(self,path): QWidgetSavePos.__init__(self,"shape_import") self.path=path self.discretizer=image_discretizer(self.path) self.setMinimumSize(900, 900) self.setWindowIcon(icon_get("shape")) #self.setWindowTitle(_("Import microscope image")+" (https://www.gpvdm.com)") self.setWindowTitle(os.path.basename(self.path)+" "+_("Shape editor")) self.scripts=scripts(path=self.path,api_callback=self.discretizer.force_update) self.scripts.ribbon.help.setVisible(False) self.scripts.ribbon.plot.setVisible(False) self.scripts.ribbon.hashtag.setVisible(False) self.main_vbox = QVBoxLayout() self.ribbon=ribbon_shape_import() f=inp() f.load(os.path.join(self.path,"shape_import.inp")) self.ribbon.tb_norm_y.setChecked(str2bool(f.get_token("#shape_import_y_norm"))) self.ribbon.tb_norm_z.setChecked(str2bool(f.get_token("#shape_import_z_norm"))) self.ribbon.tb_blur.setChecked(str2bool(f.get_token("#shape_import_blur_enabled"))) self.ribbon.mesh_edit.triggered.connect(self.callback_mesh_editor) self.ribbon.mesh_build.clicked.connect(self.callback_mesh_build) server_get().sim_finished.connect(self.ribbon.mesh_build.stop) server_get().sim_started.connect(self.ribbon.mesh_build.start) self.ribbon.edit_norm_y.triggered.connect(self.callback_edit_norm_y) self.ribbon.menu_blur.triggered.connect(self.callback_menu_blur) self.ribbon.tb_honeycomb_menu_edit.triggered.connect(self.callback_honeycomb_menu_edit) #self.ribbon.tb_boundary_menu_edit.triggered.connect(self.callback_boundary_menu_edit) self.ribbon.tb_gaus_menu_edit.triggered.connect(self.callback_gaus_menu_edit) self.ribbon.tb_gaus.triggered.connect(self.callback_tb_gaus) self.ribbon.tb_honeycomb.triggered.connect(self.callback_tb_honeycomb) self.ribbon.tb_boundary.triggered.connect(self.callback_boundary_menu_edit) self.ribbon.tb_norm_y.triggered.connect(self.callback_norm_y) self.ribbon.tb_norm_z.triggered.connect(self.callback_norm_z) self.ribbon.tb_blur.triggered.connect(self.callback_blur_enable) self.ribbon.tb_rotate.triggered.connect(self.callback_rotate) self.ribbon.import_image.clicked.connect(self.callback_open_image) self.ribbon.save_data.clicked.connect(self.callback_import) self.ribbon.show_mesh.clicked.connect(self.callback_show_mesh) self.ribbon.tb_script.clicked.connect(self.callback_script) #self.ribbon.help.triggered.connect(self.callback_help) self.main_vbox.addWidget(self.ribbon) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) self.notebook.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.ribbon.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) #3d widget self.three_d_shape=glWidget(self) self.three_d_shape.triangle_file="" self.three_d_shape.draw_electrical_mesh=False self.three_d_shape.view.draw_device=False self.three_d_shape.enable_draw_ray_mesh=True self.three_d_shape.enable_draw_light_source=False self.three_d_shape.enable_draw_rays=False self.three_d_shape.view.render_photons=False self.notebook.addTab(self.three_d_shape,_("Shape")) self.notebook.addTab(self.discretizer,_("Image")) self.setLayout(self.main_vbox) self.load_data() self.notebook.currentChanged.connect(self.changed_click)
def callback_mesh_build(self): self.my_server=server_get() self.my_server.add_job(get_sim_path(),"--simmode mesh_gen@mesh_gen --path "+self.path) self.my_server.sim_finished.connect(self.reload) self.my_server.start()
def __init__(self): QToolBar.__init__(self) self.myserver=server_get() self.setToolButtonStyle( Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(42, 42)) self.scan_window=None self.fit_window=None self.optics_window=False self.undo = QAction(icon_get("edit-undo"), _("Undo"), self) self.addAction(self.undo) self.addSeparator() self.run = play(self,"main_play_button",run_text=wrap_text(_("Run\nsimulation"),2))#QAction(icon_get("media-playback-start"), _("Run simulation"), self) server_get().sim_finished.connect(self.run.stop) server_get().sim_started.connect(self.run.start) self.addAction(self.run) #self.stop = QAction(icon_get("media-playback-pause"), _("Stop\nsimulation"), self) #self.stop.triggered.connect(self.callback_simulate_stop) #self.addAction(self.stop) self.addSeparator() self.scan = QAction_lock("scan", _("Parameter\nscan"), self,"ribbon_home_scan") self.scan.clicked.connect(self.callback_scan) self.addAction(self.scan) self.addSeparator() self.fit = QAction_lock("fit", _("Fit to\nexperimental data"), self,"ribbon_home_fit") self.fit.clicked.connect(self.callback_run_fit) self.addAction(self.fit) self.addSeparator() self.plot = QAction_lock("plot", _("Plot\nFile"), self,"ribbon_home_plot") self.plot.clicked.connect(self.callback_plot_select) self.addAction(self.plot) self.addSeparator() self.optics = QAction_lock("optics", _("Optical\nSimulation"), self,"ribbon_home_optics") self.optics.clicked.connect(self.callback_optics_sim) self.addAction(self.optics) self.sun=tb_item_sun() #self.sun.changed.connect(self.callback_sun) self.addWidget(self.sun) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.addWidget(spacer) if get_lock().is_trial()==True and get_lock().is_registered()==True: self.home_cart = QAction(icon_get("upgrade"), _("Upgrade to\ngpvdm professional."), self) self.home_cart.triggered.connect(self.callback_buy) self.addAction(self.home_cart) self.help = QAction(icon_get("internet-web-browser"), _("Help"), self) self.addAction(self.help)
def callback_simulate_stop(self): server_get().killall()
def __init__(self): super(gpvdm_main_window, self).__init__() self.splash = splash_window() self.splash.inc_value() process_events() process_events() #from wiz import wiz #a=wiz() #a.exec_() #sys.exit() do_import() if os.path.isdir(os.path.dirname(sys.argv[0])) == False: error_dlg(self, _("I can't run from inside a zip file!")) sys.exit() self.splash.inc_value() self.splash.inc_value() server_init() self.splash.inc_value() self.check_sim_exists = check_sim_exists() self.splash.inc_value() self.check_sim_exists.start_thread() self.splash.inc_value() self.check_sim_exists.sim_gone.connect(self.sim_gone) self.splash.inc_value() self.my_server = server_get() self.my_server.init(get_sim_path()) self.splash.inc_value() self.undo_list = undo_list_class() wpos_load() self.splash.inc_value() self.ribbon = ribbon() self.splash.inc_value() self.notebook_active_page = None self.setAcceptDrops(True) #self.setGeometry(200, 100, 1300, 600) self.setWindowTitle( "General-purpose Photovoltaic Device Model (https://www.gpvdm.com)" ) #super(gpvdm_main_window, self).__init__(parent, QtCore.Qt.FramelessWindowHint) #gobject.GObject.__init__(self) self.my_server.setup_gui(self.gui_sim_start) self.splash.inc_value() self.my_server.sim_finished.connect(self.gui_sim_stop) self.splash.inc_value() help_init() self.splash.inc_value() #help_window().help_set_help(["star.png",_("<big><b>Update available!</b></big><br>")]) #self.show() if running_on_linux() == True: DBusQtMainLoop(set_as_default=True) self.bus = dbus.SessionBus() self.bus.add_match_string_non_blocking( "type='signal',interface='org.my.gpvdm'") self.bus.add_message_filter(self.adbus) else: self.win_pipe = win_pipe() self.win_pipe.new_data.connect(self.win_dbus) self.win_pipe.start() self.notebook = gpvdm_notebook() vbox = QVBoxLayout() self.splash.inc_value() vbox.addWidget(self.ribbon) vbox.addWidget(self.notebook) wvbox = QWidget() self.splash.inc_value() wvbox.setLayout(vbox) self.setCentralWidget(wvbox) self.splash.inc_value() self.statusBar() temp_error = ver_error() #print(temp_error) if len(temp_error) > 0: error_dlg(self, temp_error) return self.setWindowIcon( QIcon(os.path.join(get_image_file_path(), "image.jpg"))) self.splash.inc_value() self.show_tabs = True self.show_border = True self.ribbon.home_export.triggered.connect(self.callback_export) #if enable_webupdates()==False: # self.help_menu_update=help_menu.addAction("&"+_("Check for updates")) # self.help_menu_update.triggered.connect(self.callback_update) self.ribbon.home_new.triggered.connect(self.callback_new) self.ribbon.home_open.triggered.connect(self.callback_open) self.ribbon.home.undo.triggered.connect(self.callback_undo) self.ribbon.home.run.triggered.connect(self.callback_simulate) self.splash.inc_value() self.ribbon.home.stop.setEnabled(False) self.ribbon.home.scan.setEnabled(False) self.ribbon.home.help.triggered.connect(self.callback_on_line_help) resize_window_to_be_sane(self, 0.7, 0.75) self.change_dir_and_refresh_interface(get_sim_path()) self.splash.inc_value() self.ribbon.home.sun.changed.connect(self.notebook.update) self.ribbon.setAutoFillBackground(True) self.splash.inc_value() self.show() help_window().show() from update import update_window self.a = update_window() self.a.show()
def __init__(self): super(gpvdm_main_window, self).__init__() icon_init_db() #from scans_io import scans_io #from cal_path import get_sim_path #scans=scans_io(get_sim_path()) #sims=scans.get_scan_dirs() #print(sims) #asdsa self.splash = splash_window() self.scan_human_labels = get_scan_human_labels() self.splash.inc_value() process_events() process_events() #from wiz import wiz #a=wiz() #a.exec_() #sys.exit() do_import() if os.path.isdir(os.path.dirname(sys.argv[0])) == False: error_dlg(self, _("I can't run from inside a zip file!")) sys.exit() self.splash.inc_value() self.splash.inc_value() server_init() self.splash.inc_value() self.check_sim_exists = check_sim_exists() self.splash.inc_value() self.check_sim_exists.start_thread() self.splash.inc_value() self.check_sim_exists.sim_gone.connect(self.sim_gone) self.splash.inc_value() self.my_server = server_get() self.my_server.init(get_sim_path()) self.splash.inc_value() self.undo_list = undo_list_class() wpos_load() self.splash.inc_value() self.ribbon = ribbon() self.splash.inc_value() self.notebook_active_page = None self.setAcceptDrops(True) #self.setGeometry(200, 100, 1300, 600) self.setWindowTitle( "General-purpose Photovoltaic Device Model (https://www.gpvdm.com)" ) self.l = lock_gui() #self.l.disable_all.connect(self.disable_interface) #self.l.enable_all.connect(self.enable_disable_buttons) #super(gpvdm_main_window, self).__init__(parent, QtCore.Qt.FramelessWindowHint) #gobject.GObject.__init__(self) #self.my_server.setup_gui(self.gui_sim_start) self.my_server.sim_started.connect(self.gui_sim_start) self.splash.inc_value() self.my_server.sim_finished.connect(self.gui_sim_stop) self.splash.inc_value() help_init() self.splash.inc_value() #help_window().help_set_help(["star.png",_("<big><b>Update available!</b></big><br>")]) #self.show() if running_on_linux() == True: self.bus = dbus.SessionBus() self.bus.add_match_string_non_blocking( "type='signal',interface='org.my.gpvdm'") self.bus.add_message_filter(self.adbus) else: self.win_pipe = win_pipe() self.win_pipe.new_data.connect(self.win_dbus) self.win_pipe.start() self.notebook = gpvdm_notebook() vbox = QVBoxLayout() self.splash.inc_value() vbox.addWidget(self.ribbon) self.ribbon.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) self.notebook.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) vbox.addWidget(self.notebook) wvbox = QWidget() self.splash.inc_value() wvbox.setLayout(vbox) self.setCentralWidget(wvbox) self.splash.inc_value() self.statusBar() temp_error = ver_error() #print(temp_error) if len(temp_error) > 0: error_dlg(self, temp_error) return self.setWindowIcon( QIcon(os.path.join(get_image_file_path(), "image.jpg"))) self.splash.inc_value() self.show_tabs = True self.show_border = True self.ribbon.file.home_new.clicked.connect(self.callback_new) self.ribbon.file.home_open.clicked.connect(self.callback_open) self.ribbon.file.used_files_click.connect(self.load_sim) self.ribbon.home.undo.triggered.connect(self.callback_undo) self.ribbon.home.run.start_sim.connect(self.callback_simulate) self.splash.inc_value() #self.ribbon.home.stop.setEnabled(False) self.ribbon.home.scan.setEnabled(False) self.ribbon.thermal.setEnabled(False) self.ribbon.home.help.triggered.connect(self.callback_on_line_help) update_init() resize_window_to_be_sane(self, 0.7, 0.75) self.change_dir_and_refresh_interface(get_sim_path()) self.splash.inc_value() #self.ribbon.home.sun.changed.connect(self.notebook.update) self.ribbon.setAutoFillBackground(True) self.splash.inc_value() self.show() help_window().show() self.enable_disable_buttons() val = inp_get_token_value(os.path.join(get_sim_path(), "config.inp"), "#use_gpvdm_local") if val != "false": if os.path.isdir(get_materials_path()) == False: clone_materials(get_materials_path(), get_base_material_path(), "material") if os.path.isdir(get_emission_path()) == False: clone_materials(get_emission_path(), get_base_emission_path(), "emission") if os.path.isdir(get_shape_path()) == False: clone_materials(get_shape_path(), get_base_shape_path(), "shape") if os.path.isdir(get_scripts_path()) == False: shutil.copytree(get_base_scripts_path(), get_scripts_path(), symlinks=True) if os.path.isdir(get_spectra_path()) == False: clone_spectras(get_spectra_path()) self.cache = cache(only_open_if_full=True) #from shape_editor import shape_editor #self.shape_window=shape_editor("/home/rod/gpvdm_local/shape/pedot") #self.shape_window.show() #from shape_import import shape_import #self.shape_import=shape_import("/home/rod/gpvdm_local/shape/pedot") #self.shape_import.show() check_lib_in_bash_rc()
def __init__(self, scan_file): QWidget.__init__(self) self.notebook = QTabWidget() self.setWindowTitle(_("Parameter scan editor - (www.gpvdm.com)")) self.setWindowIcon(icon_get("scan")) self.main_vbox = QVBoxLayout() self.scan_tab_vbox = QVBoxLayout() self.tokens = tokens() self.myserver = server_get() self.status_bar = QStatusBar() self.param_list = get_scan_human_labels().list #self.tab_label=tab_label self.scan_io = scan_io() self.scan_io.parent_window = self #self.scan_io.set_path(self.scan_io.scan_dir) self.scan_io.load(scan_file) self.scan_io.make_dir() toolbar = QToolBar() toolbar.setIconSize(QSize(32, 32)) self.tb_add = QAction(icon_get("list-add"), _("Add parameter to scan"), self) self.tb_add.triggered.connect(self.callback_add_item) toolbar.addAction(self.tb_add) self.tb_minus = QAction(icon_get("list-remove"), _("Delete item"), self) self.tb_minus.triggered.connect(self.callback_delete_item) toolbar.addAction(self.tb_minus) self.tb_down = QAction(icon_get("go-down"), _("Move down"), self) self.tb_down.triggered.connect(self.callback_move_down) toolbar.addAction(self.tb_down) self.tb_up = QAction(icon_get("go-up"), _("Move up"), self) self.tb_up.triggered.connect(self.callback_move_up) toolbar.addAction(self.tb_up) self.tb_command = QAction(icon_get("utilities-terminal"), _("Insert python command"), self) self.tb_command.triggered.connect(self.callback_insert_command) toolbar.addAction(self.tb_command) self.scan_tab_vbox.addWidget(toolbar) self.tab = gpvdm_tab() css_apply(self.notebook, "tab_default.css") self.notebook.setMovable(True) self.tab.verticalHeader().setVisible(False) self.tab.setColumnCount(5) #if enable_betafeatures()==False: # self.tab.setColumnHidden(0, True) # self.tab.setColumnHidden(1, True) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.tab.setColumnWidth(2, 300) self.tab.setColumnWidth(3, 300) self.tab.setColumnWidth(4, 300) self.load() self.tab.cellChanged.connect(self.tab_changed) self.scan_tab_vbox.addWidget(self.tab) self.notebook.popMenu = QMenu(self) #self.mp_show_list=QAction(_("Select parameter to scan"), self) #self.mp_show_list.triggered.connect(self.callback_show_list) #self.popMenu.addAction(self.mp_show_list) self.notebook.popMenu.addSeparator() self.mp_delete = QAction(_("Delete item"), self) self.mp_delete.triggered.connect(self.callback_delete_item) self.notebook.popMenu.addAction(self.mp_delete) self.mp_copy = QAction(_("Copy"), self) self.mp_copy.triggered.connect(self.callback_copy_item) self.notebook.popMenu.addAction(self.mp_copy) self.mp_paste = QAction(_("Paste"), self) self.mp_paste.triggered.connect(self.callback_paste_item) self.notebook.popMenu.addAction(self.mp_paste) self.notebook.popMenu.addSeparator() self.mp_add = QAction(_("Add item"), self) self.mp_add.triggered.connect(self.callback_add_item) self.notebook.popMenu.addAction(self.mp_add) self.mp_down = QAction(_("Move down"), self) self.mp_down.triggered.connect(self.callback_move_down) self.notebook.popMenu.addAction(self.mp_down) self.mp_down = QAction(_("Move down"), self) self.mp_down.triggered.connect(self.callback_move_down) self.notebook.popMenu.addAction(self.mp_down) self.notebook.popMenu.addSeparator() self.notebook.setMinimumSize(700, 500) self.program_widget = QWidget() self.program_widget.setLayout(self.scan_tab_vbox) self.notebook.addTab(self.program_widget, "Commands") self.viewer = gpvdm_viewer(self.scan_io.scan_dir) self.viewer.show_back_arrow = True self.notebook.addTab(self.viewer, "Output") self.ribbon = scan_tab_ribbon() self.ribbon.tb_simulate.triggered.connect(self.callback_run_simulation) self.ribbon.tb_clean.triggered.connect(self.clean_scan_dir) self.ribbon.tb_plot.triggered.connect(self.callback_gen_plot_command) self.ribbon.tb_notes.triggered.connect(self.callback_notes) self.main_vbox.addWidget(self.ribbon) self.main_vbox.addWidget(self.notebook) self.main_vbox.addWidget(self.status_bar) self.setLayout(self.main_vbox) self.select_param_window = select_param(self.tab)
def __init__(self): QWidget.__init__(self) self.complex_display = False self.hbox = QVBoxLayout() self.data = dat_file() self.my_server = server_get() mesh = get_mesh() if mesh.y.circuit_model == True and mesh.x.tot_points == 1 and mesh.z.tot_points == 1: self.display = circuit_editor() epi = get_epi() pos = 3 self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3, "bat") pos = pos + 1 for l in epi.layers: f = inp() f.load( os.path.join(get_sim_path(), l.shape_electrical + ".inp")) component = f.get_token("#electrical_component") if component == "resistance": self.display.ersatzschaltbild.add_object( pos, 3, pos + 1, 3, "resistor") if component == "diode": self.display.ersatzschaltbild.add_object( pos, 3, pos + 1, 3, "diode") pos = pos + 1 self.display.ersatzschaltbild.add_object(pos, 3, pos + 1, 3, "ground") self.display.ersatzschaltbild.objects_push() if inp().isfile(os.path.join(get_sim_path(), "diagram.inp")) == True: self.display.ersatzschaltbild.load() else: toolbar = QToolBar() toolbar.setIconSize(QSize(42, 42)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.tb_refresh = QAction(icon_get("view-refresh"), _("Refresh"), self) self.tb_refresh.triggered.connect(self.rebuild_mesh) toolbar.addAction(self.tb_refresh) self.xy = QAction(icon_get("xy"), _("xy"), self) self.xy.triggered.connect(self.callback_xy) toolbar.addAction(self.xy) self.yz = QAction(icon_get("yz"), _("yz"), self) self.yz.triggered.connect(self.callback_yz) toolbar.addAction(self.yz) self.xz = QAction(icon_get("xz"), _("xz"), self) self.xz.triggered.connect(self.callback_xz) toolbar.addAction(self.xz) self.tb_rotate = QAction(icon_get("rotate.png"), _("Rotate"), self) self.tb_rotate.triggered.connect(self.tb_rotate_click) toolbar.addAction(self.tb_rotate) self.tb_rotate.setEnabled(True) self.hbox.addWidget(toolbar) self.display = glWidget(self) #self.data.load(os.path.join(get_sim_path(),"electrical_mesh.dat") #self.display.pre_built_scene=gl_scale.project_base_objects_from_m_2_screen(self.data.data) self.display.draw_electrical_mesh = False self.display.view.draw_device = False self.display.enable_draw_ray_mesh = False self.display.enable_draw_light_source = False self.display.enable_draw_rays = False self.display.view.render_photons = False self.display.force_redraw() #global_object_register("display_mesh_recalculate",self.recalculate) self.hbox.addWidget(self.display) self.setLayout(self.hbox)
def callback_one_fit(self, widget, data=None): my_server=server_get() my_server.clear_cache() my_server.add_job(os.getcwd(),"--1fit") my_server.set_callback_when_done(self.rod) my_server.start()
def callback_do_fit(self, widget, data=None): my_server=server_get() my_server.clear_cache() my_server.add_job(os.getcwd(),"--fit") my_server.start()
def callback_stop(self): my_server=server_get() my_server.force_stop()
def callback_do_fit(self): my_server=server_get() my_server.clear_cache() my_server.add_job(get_sim_path(),"--fit") my_server.start()
def callback_one_fit(self): my_server=server_get() my_server.clear_cache() my_server.add_job(get_sim_path(),"--1fit") my_server.set_callback_when_done(self.rod) my_server.start()
def __init__(self): self.undo_list=undo_list_class() super(gpvdm_main_window,self).__init__() self.setGeometry(200, 100, 1300, 600) self.setWindowTitle(_("General-purpose Photovoltaic Device Model (www.gpvdm.com)")) #super(gpvdm_main_window, self).__init__(parent, QtCore.Qt.FramelessWindowHint) #gobject.GObject.__init__(self) server_init() self.my_server=server_get() self.my_server.init(os.getcwd()) self.my_server.setup_gui(self.gui_sim_start) self.my_server.sim_finished.connect(self.gui_sim_stop) help_init() #help_window().help_set_help(["star.png",_("<big><b>Update available!</b></big><br>")]) self.win_list=windows() self.win_list.load() #self.show() if running_on_linux()==True: DBusQtMainLoop(set_as_default=True) self.bus = dbus.SessionBus() self.bus.add_match_string_non_blocking("type='signal',interface='org.my.gpvdm'") self.bus.add_message_filter(self.adbus) else: self.win_pipe=win_pipe() self.win_pipe.new_data.connect(self.win_dbus) self.win_pipe.start() self.notebook=gpvdm_notebook() self.setCentralWidget(self.notebook) self.show() self.statusBar() toolbar = self.addToolBar('Exit') toolbar.setIconSize(QSize(42, 42)) self.splash=splash_window() self.splash.init() temp_error=ver_error() print(temp_error) if len(temp_error)>0: msgBox = QMessageBox(self) msgBox.setIcon(QMessageBox.Critical) msgBox.setText(self.tr("gpvdm")) msgBox.setInformativeText(temp_error) msgBox.setStandardButtons(QMessageBox.Ok ) msgBox.setDefaultButton(QMessageBox.Ok) reply = msgBox.exec_() return self.experiment_window=None self.fxexperiment_window=None self.jvexperiment_window=None self.fit_window=None self.config_window=None self.qe_window=None self.lasers_window=None self.sim_info_window=None self.setWindowIcon(QIcon(os.path.join(get_image_file_path(),"image.jpg"))) self.show_tabs = True self.show_border = True menubar = self.menuBar() file_menu = menubar.addMenu('&File') self.menu_new=file_menu.addAction(_("&New simulation")) self.menu_new.triggered.connect(self.callback_new) self.menu_new_optical_material=file_menu.addAction(_("New optical material")) self.menu_export_open=file_menu.addAction(_("&Open simulation")) self.menu_export_open.triggered.connect(self.callback_open) self.menu_export_data=file_menu.addAction(_("&Export data")) self.menu_export_data.triggered.connect(self.callback_export) self.menu_import_data=file_menu.addAction(_("&Import data")) self.menu_import_data.triggered.connect(self.callback_import) self.menu_import_lib=file_menu.addAction(_("Import from library")) self.menu_import_lib.triggered.connect(self.callback_import_from_lib) self.menu_quit=file_menu.addAction(_("&Quit")) self.menu_quit.triggered.connect(self.close_now) simulation_menu = menubar.addMenu('&Simulation') self.menu_run=simulation_menu.addAction(_("&Run")) self.menu_run.triggered.connect(self.callback_simulate) self.menu_stop=simulation_menu.addAction(_("&Stop")) self.menu_stop.triggered.connect(self.callback_simulate_stop) self.menu_scan=simulation_menu.addAction(_("&Parameter scan")) self.menu_scan.triggered.connect(self.callback_scan) self.menu_configure=simulation_menu.addAction(_("&Configure")) self.menu_configure.triggered.connect(self.callback_config_window) view_menu = menubar.addMenu('&View') view_menu.addAction(_("&None")) plot_menu = menubar.addMenu('&Plot') self.plot_menu_plot=plot_menu.addAction(_("&Plot simulation result")) self.plot_menu_plot.triggered.connect(self.callback_plot_select) help_menu = menubar.addMenu('Help') help_web=help_menu.addAction(_("&Help window")) help_web.triggered.connect(self.callback_help) help_web=help_menu.addAction(_("&Online help")) help_web.triggered.connect(self.callback_on_line_help) help_web=help_menu.addAction(_("&License")) help_web.triggered.connect(self.callback_license) about=help_menu.addAction(_("&About")) about.triggered.connect(self.callback_about_dialog) if enable_webupdates()==False: self.help_menu_update=help_menu.addAction(_("&Check for updates")) self.help_menu_update.triggered.connect(self.callback_update) new_sim = QAction(QIcon(os.path.join(get_image_file_path(),"new.png")), _("Make a new simulation"), self) new_sim.triggered.connect(self.callback_new) toolbar.addAction(new_sim) open_sim = QAction(QIcon(os.path.join(get_image_file_path(),"open.png")), _("Open a simulation"), self) open_sim.triggered.connect(self.callback_open) toolbar.addAction(open_sim) toolbar.addSeparator() self.undo = QAction(QIcon(os.path.join(get_image_file_path(),"undo.png")), _("Undo"), self) self.undo.triggered.connect(self.callback_undo) toolbar.addAction(self.undo) #seperator self.run = QAction(QIcon(os.path.join(get_image_file_path(),"play.png")), _("Run the simulation"), self) self.run.triggered.connect(self.callback_simulate) toolbar.addAction(self.run) self.tb_run_scan = QAction(QIcon(os.path.join(get_image_file_path(),"forward.png")), _("Run parameter scan"), self) self.tb_run_scan.triggered.connect(self.callback_run_scan) self.tb_run_scan.setEnabled(False) toolbar.addAction(self.tb_run_scan) self.stop = QAction(QIcon(os.path.join(get_image_file_path(),"pause.png")), _("Stop the simulation"), self) self.stop.triggered.connect(self.callback_simulate_stop) toolbar.addAction(self.stop) self.stop.setEnabled(False) toolbar.addSeparator() self.param_scan = QAction(QIcon(os.path.join(get_image_file_path(),"scan.png")), _("Parameter scan"), self) self.param_scan.triggered.connect(self.callback_scan) toolbar.addAction(self.param_scan) self.param_scan.setEnabled(False) if enable_betafeatures()==True: self.tb_run_fit = QAction(QIcon(os.path.join(get_image_file_path(),"fit.png")), _("Run a fit command"), self) self.tb_run_fit.triggered.connect(self.callback_run_fit) toolbar.addAction(self.tb_run_fit) self.tb_run_fit.setEnabled(True) toolbar.addSeparator() self.plot_select = QAction(QIcon(os.path.join(get_image_file_path(),"plot.png")), _("Find a file to plot"), self) self.plot_select.triggered.connect(self.callback_plot_select) toolbar.addAction(self.plot_select) self.examine = QAction(QIcon(os.path.join(get_image_file_path(),"plot_time.png")), _("Examine results in time domain"), self) self.examine.triggered.connect(self.callback_examine) toolbar.addAction(self.examine) toolbar.addSeparator() self.tb_time_domain = QAction(QIcon(os.path.join(get_image_file_path(),"time.png")), _("Time domain simulation editor."), self) self.tb_time_domain.triggered.connect(self.callback_edit_experiment_window) toolbar.addAction(self.tb_time_domain) self.experiment_window_button = QAction(QIcon(os.path.join(get_image_file_path(),"spectrum.png")), _("Frequency domain simulation editor"), self) self.experiment_window_button.triggered.connect(self.callback_fxexperiment_window) toolbar.addAction(self.experiment_window_button) self.jv_button = QAction(QIcon(os.path.join(get_image_file_path(),"jv.png")), _("Steady state simulation editor"), self) self.jv_button.triggered.connect(self.callback_jv_window) toolbar.addAction(self.jv_button) self.laser_button = QAction(QIcon(os.path.join(get_image_file_path(),"lasers.png")), _("Lasers editor"), self) self.laser_button.triggered.connect(self.callback_configure_lasers) toolbar.addAction(self.laser_button) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.help = QAction(QIcon(os.path.join(get_image_file_path(),"help.png")), _("Help"), self) self.help.triggered.connect(self.callback_on_line_help) toolbar.addAction(self.help) self.addToolBarBreak() toolbar1=self.make_tool_box1() self.addToolBar(toolbar1) if enable_betafeatures()==True: self.hpc_toolbar=hpc_class(self.my_server) #self.addToolBarBreak() toolbar_hpc = self.addToolBar(self.hpc_toolbar) self.win_list.set_window(self,"main_window") # self.menubar.show() # self.make_window2(main_vbox) #help_window().show() self.change_dir_and_refresh_interface(os.getcwd()) # self.window.show() # process_events() self.show() self.light_button.changed.connect(self.notebook.update)