def __init__(self): ribbon_base.__init__(self) self.setMaximumHeight(130) #self.setStyleSheet("QWidget { background-color:cyan; }") self.about = QToolButton(self) self.about.setText(_("About")) self.about.pressed.connect(self.callback_about_dialog) self.setCornerWidget(self.about) w=self.scan() self.addTab(w,_("Scan")) w=self.simulations() self.addTab(w,_("Simulations")) w=self.advanced() if enable_betafeatures()==True: self.addTab(w,_("Advanced")) w=self.nested() if enable_betafeatures()==True: self.addTab(w,_("Nested")) w=self.ml() if enable_betafeatures()==True: self.addTab(w,_("ML")) sheet=self.readStyleSheet(os.path.join(get_css_path(),"style.css")) if sheet!=None: sheet=str(sheet,'utf-8') self.setStyleSheet(sheet)
def update_interface(self): if self.notebook.is_loaded() == True: self.check_sim_exists.set_dir(get_sim_path()) help_window().help_set_help([ "media-playback-start", _("<big><b>Now run the simulation</b></big><br> Click on the play icon to start a simulation." ) ]) if enable_betafeatures() == True: self.ribbon.simulations.qe.setVisible(True) else: self.check_sim_exists.set_dir("") help_window().help_set_help([ "icon.png", _("<big><b>Hi!</b></big><br> I'm the on-line help system :). If you have any questions or find any bugs please send them to <a href=\"mailto:" + get_email() + "\">" + get_email() + "</a>."), "document-new.png", _("Click on the new icon to make a new simulation directory.") ]) language_advert() if enable_betafeatures() == True: self.ribbon.simulations.qe.setVisible(True)
def update_interface(self): if self.notebook.load()==True: #self.ti_light.connect('refresh', self.notebook.main_tab.update) self.check_sim_exists.set_dir(get_sim_path()) self.ribbon.home.setEnabled(True) self.ribbon.simulations.setEnabled(True) #self.save_sim.setEnabled(True) #self.ribbon.device.setEnabled(True) help_window().help_set_help(["media-playback-start",_("<big><b>Now run the simulation</b></big><br> Click on the play icon to start a simulation.")]) self.ribbon.home_export.setEnabled(True) #self.menu_import_lib.setEnabled(True) self.ribbon.configure.setEnabled(True) self.ribbon.goto_page(_("Home")) if enable_betafeatures()==True: self.ribbon.simulations.qe.setVisible(True) else: self.check_sim_exists.set_dir("") self.ribbon.home.setEnabled(False) self.ribbon.simulations.setEnabled(False) #self.ribbon.device.setEnabled(False) self.ribbon.goto_page(_("File")) help_window().help_set_help(["icon.png",_("<big><b>Hi!</b></big><br> I'm the on-line help system :). If you find any bugs please report them to <a href=\"mailto:[email protected]\">[email protected]</a>."),"document-new.png",_("Click on the new icon to make a new simulation directory.")]) language_advert() self.ribbon.home_export.setEnabled(False) self.ribbon.configure.setEnabled(False) if enable_betafeatures()==True: self.ribbon.simulations.qe.setVisible(True)
def draw_graph(self): if (len(self.time)>0): mul,unit=time_with_units(float(self.time[len(self.time)-1]-self.time[0])) else: mul=1.0 unit="s" time=[] for i in range(0,len(self.time)): time.append(self.time[i]*mul) self.fig.clf() self.fig.subplots_adjust(bottom=0.2) self.fig.subplots_adjust(left=0.1) self.ax1 = self.fig.add_subplot(111) self.ax1.ticklabel_format(useOffset=False) #ax2 = ax1.twinx() #x_pos=0.0 #layer=0 #color =['r','g','b','y','o','r','g','b','y','o'] self.ax1.set_ylabel(_("Voltage (Volts)")) voltage, = self.ax1.plot(time,self.voltage, 'ro-', linewidth=3 ,alpha=1.0) self.ax1.set_xlabel(_("Time (")+unit+')') self.ax2 = self.ax1.twinx() self.ax2.set_ylabel(_("Magnitude (au)")) #ax2.set_ylabel('Energy (eV)') sun, = self.ax2.plot(time,self.sun, 'go-', linewidth=3 ,alpha=1.0) if enable_betafeatures()==True: laser, = self.ax2.plot(time,self.laser, 'bo-', linewidth=3 ,alpha=1.0) fs_laser_enabled=False if self.fs_laser_time!=-1: if len(self.time)>2: dt=(self.time[len(time)-1]-self.time[0])/100 start=self.fs_laser_time-dt*5 stop=self.fs_laser_time+dt*5 x = linspace(start,stop,100) y=self.gaussian(x,self.fs_laser_time,dt) #print y fs_laser, = self.ax2.plot(x*mul,y, 'g-', linewidth=3 ,alpha=1.0) fs_laser_enabled=True self.ax2.ticklabel_format(style='sci', axis='x', scilimits=(0,0)) if enable_betafeatures()==True: if fs_laser_enabled==True: self.fig.legend((voltage, sun, laser,fs_laser), (_("Voltage"), _("Sun"), _("CW laser"), _("fs laser")), 'upper right') else: self.fig.legend((voltage, sun, laser), (_("Voltage"), _("Sun"), _("CW laser")), 'upper right') else: if fs_laser_enabled==True: self.fig.legend((voltage, sun, fs_laser), (_("Voltage"), _("Sun"), _("fs laser")), 'upper right') else: self.fig.legend((voltage, sun), (_("Voltage"), _("Sun")), 'upper right')
def init(self): self.cpus = multiprocessing.cpu_count() self.tab.setTabsClosable(True) self.tab.setMovable(True) self.tab.setTabBar(QHTabBar()) self.tab.setTabPosition(QTabWidget.West) self.terminals = [] self.process = [] for i in range(0, self.cpus): term = output_box("local_cpu") proc = QProcess(self) proc.readyRead.connect(functools.partial(self.dataReady, i)) self.process.append(proc) self.terminals.append(term) self.tab.addTab(term, _("CPU") + " " + str(i)) self.cluster_output = output_box("cluster_node") self.tab.addTab(self.cluster_output, _("Cluster")) self.jview = jobs_view() #self.jview.load_data(self.myserver.cluster_jobs) self.tab.addTab(self.jview, "Jobs list") if enable_betafeatures() == True: self.cluster = hpc_class() self.tab.addTab(self.cluster, _("Nodes")) global_object_register("cluster_tab", self.cluster) self.my_server.new_message.connect(self.data_from_cluster)
def create_model(self): self.tab.clear() self.tab.setColumnCount(6) if enable_betafeatures() == False: self.tab.setColumnHidden(5, True) self.tab.setColumnHidden(4, True) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.tab.setHorizontalHeaderLabels([ _("Layer name"), _("Thicknes"), _("Optical material"), _("Layer type"), _("DoS Layer"), _("PL Layer") ]) self.tab.setColumnWidth(2, 250) self.tab.setRowCount(epitaxy_get_layers()) for i in range(0, epitaxy_get_layers()): thick = epitaxy_get_width(i) material = epitaxy_get_mat_file(i) dos_layer = epitaxy_get_electrical_layer(i) pl_file = epitaxy_get_pl_file(i) name = epitaxy_get_name(i) self.add_row(i, thick, material, dos_layer, pl_file, name) return
def __init__(self): QToolBar.__init__(self) self.setToolButtonStyle(Qt.ToolButtonTextUnderIcon) self.setIconSize(QSize(42, 42)) self.materials = QAction(QIcon_load("organic_material"), _("Materials\ndatabase"), self) self.materials.triggered.connect(self.callback_view_materials) self.addAction(self.materials) self.spectra_file = QAction(QIcon_load("spectra_file"), _("Optical\ndatabase"), self) self.spectra_file.triggered.connect(self.callback_view_optical) self.addAction(self.spectra_file) if enable_betafeatures() == True: self.tb_import_pvlighthouse = QAction( QIcon_load("sync"), _("Update materials\nfrom PVLighthouse"), self) self.tb_import_pvlighthouse.triggered.connect( self.callback_pvlighthouse) self.addAction(self.tb_import_pvlighthouse) self.tb_import_refractiveindex = QAction( QIcon_load("sync"), _("Update materials\nfrom refractiveindex.info"), self) self.tb_import_refractiveindex.triggered.connect( self.callback_refractiveindex) self.addAction(self.tb_import_refractiveindex)
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 update(self): self.mode.blockSignals(True) self.mode.clear() self.mode.addItem("is") if enable_betafeatures() == True: self.mode.addItem("imps") self.mode.blockSignals(False)
def __init__(self): QWidgetSavePos.__init__(self,"electrical") self.setFixedSize(1000, 600) self.setWindowIcon(QIcon_load("preferences-system")) self.setWindowTitle(_("Electrical parameter editor")+" (https://www.gpvdm.com)") self.main_vbox = QVBoxLayout() toolbar=QToolBar() toolbar.setIconSize(QSize(48, 48)) spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) toolbar.addWidget(spacer) self.undo = QAction(QIcon_load("help"), _("Help"), self) self.undo.setStatusTip(_("Help")) self.undo.triggered.connect(self.callback_help) toolbar.addAction(self.undo) self.main_vbox.addWidget(toolbar) self.notebook = QTabWidget() self.notebook.setMovable(True) self.main_vbox.addWidget(self.notebook) widget=tab_class() widget.init("device.inp",_("Device")) self.notebook.addTab(widget,_("Device")) widget=dos_main() widget.update() self.notebook.addTab(widget,_("Electrical parameters")) if enable_betafeatures()==True: widget=tab_bands() widget.update() self.notebook.addTab(widget,_("Complex DoS")) widget=pl_main() widget.update() self.notebook.addTab(widget,_("Luminescence")) self.setLayout(self.main_vbox) #self.connect("delete-event", self.callback_close_window) self.notebook.currentChanged.connect(self.changed_click)
def setEnabled(self, val): self.undo.setEnabled(val) self.run.setEnabled(val) self.stop.setEnabled(val) self.scan.setEnabled(val) self.plot.setEnabled(val) self.time.setEnabled(val) self.sun.setEnabled(val) self.help.setEnabled(val) if enable_betafeatures() == True: self.fit.setEnabled(val)
def error_han(type, value, tback): if enable_betafeatures()==False: #formatted_lines = traceback.format_exc().splitlines() long_trace=traceback.format_exception(type, value, tback) long_trace=str("<br>".join(long_trace)) trace=long_trace.replace("<br>","") trace=trace.replace(" ","") dialog=widget_error_han(long_trace,trace) dialog.exec_() sys.__excepthook__(type, value, tback) return True
def error_han(type, value, tback): if enable_betafeatures() == False: #formatted_lines = traceback.format_exc().splitlines() long_trace = traceback.format_exception(type, value, tback) long_trace = str("<br>".join(long_trace)) trace = long_trace.replace("<br>", "") trace = trace.replace(" ", "") dialog = widget_error_han(long_trace, trace) dialog.exec_() sys.__excepthook__(type, value, tback) return True
def get_main_menu(self, window): accel_group = gtk.AccelGroup() item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group) item_factory.create_items(self.menu_items) if enable_betafeatures()==False: item_factory.delete_item(_("/Advanced")) window.add_accel_group(accel_group) self.item_factory = item_factory return item_factory.get_widget("<main>")
def error_han(type, value, tback): print("error=", value, tback, "rod") if value == KeyboardInterrupt: print("hello") if enable_betafeatures() == False: #formatted_lines = traceback.format_exc().splitlines() long_trace = traceback.format_exception(type, value, tback) long_trace = str("<br>".join(long_trace)) trace = long_trace.replace("<br>", "") trace = trace.replace(" ", "") dialog = widget_error_han(long_trace, trace) dialog.exec_() sys.__excepthook__(type, value, tback) return True
def make_tool_box1(self): toolbar=QToolBar() toolbar.setIconSize(QSize(42, 42)) if enable_betafeatures()==True: self.qe_button = QAction(QIcon(os.path.join(get_image_file_path(),"qe.png")), _("Quantum efficiency"), self) self.qe_button.triggered.connect(self.callback_qe_window) toolbar.addAction(self.qe_button) self.qe_button.setEnabled(False) self.sim_mode_button=tb_item_sim_mode() toolbar.addWidget(self.sim_mode_button) self.sim_mode_button.setEnabled(False) self.light_button=tb_item_sun() toolbar.addWidget(self.light_button) self.light_button.setEnabled(False) return toolbar
def create_model(self): self.tab.clear() self.tab.setColumnCount(6) if enable_betafeatures()==False: self.tab.setColumnHidden(5, True) self.tab.setColumnHidden(4, True) self.tab.setSelectionBehavior(QAbstractItemView.SelectRows) self.tab.setHorizontalHeaderLabels([_("Layer name"), _("Thicknes"), _("Optical material"), _("Layer type"), _("DoS Layer"),_("PL Layer")]) self.tab.setRowCount(epitaxy_get_layers()) for i in range(0,epitaxy_get_layers()): thick=epitaxy_get_width(i) material=epitaxy_get_mat_file(i) dos_layer=epitaxy_get_electrical_layer(i) pl_file=epitaxy_get_pl_file(i) name=epitaxy_get_name(i) self.add_row(i,thick,material,dos_layer,pl_file,name) return
def change_dir_and_refresh_interface(self,new_dir): scan_items_clear() os.chdir(new_dir) calculate_paths() epitaxy_load() contacts_load() mesh_load_all() #print "rod",os.getcwd(),new_dir self.statusBar().showMessage(os.getcwd()) #self.plot_open.setEnabled(False) #self.notebook.set_item_factory(self.item_factory) if self.notebook.load()==True: self.sim_mode_button.update() #self.ti_light.connect('refresh', self.notebook.main_tab.update) self.run.setEnabled(True) self.stop.setEnabled(True) self.examine.setEnabled(True) self.param_scan.setEnabled(True) self.plot_select.setEnabled(True) self.undo.setEnabled(True) self.jv_button.setEnabled(True) self.laser_button.setEnabled(True) self.tb_time_domain.setEnabled(True) #self.save_sim.setEnabled(True) self.experiment_window_button.setEnabled(True) self.light_button.setEnabled(True) self.light_button.update() help_window().help_set_help(["play.png",_("<big><b>Now run the simulation</b></big><br> Click on the play icon to start a simulation.")]) self.menu_new_optical_material.setEnabled(True) self.menu_export_data.setEnabled(True) self.menu_import_data.setEnabled(True) self.menu_import_lib.setEnabled(True) self.menu_run.setEnabled(True) self.menu_stop.setEnabled(True) self.menu_scan.setEnabled(True) self.menu_configure.setEnabled(True) self.sim_mode_button.setEnabled(True) if enable_betafeatures()==True: self.tb_run_fit.setEnabled(True) self.qe_button.setEnabled(True) else: self.run.setEnabled(False) self.stop.setEnabled(False) self.examine.setEnabled(False) self.param_scan.setEnabled(False) self.plot_select.setEnabled(False) self.undo.setEnabled(False) self.jv_button.setEnabled(False) #self.save_sim.setEnabled(False) self.experiment_window_button.setEnabled(False) self.laser_button.setEnabled(False) self.tb_time_domain.setEnabled(False) self.sim_mode_button.setEnabled(False) self.light_button.setEnabled(False) help_window().help_set_help(["icon.png",_("<big><b>Hi!</b></big><br> I'm the on-line help system :). If you find any bugs please report them to [email protected]."),"new.png",_("Click on the new icon to make a new simulation directory.")]) self.menu_new_optical_material.setEnabled(False) self.menu_export_data.setEnabled(False) self.menu_import_data.setEnabled(False) self.menu_import_lib.setEnabled(False) self.menu_run.setEnabled(False) self.menu_stop.setEnabled(False) self.menu_scan.setEnabled(False) self.menu_configure.setEnabled(False) if enable_betafeatures()==True: self.tb_run_fit.setEnabled(False) self.qe_button.setEnabled(False) if self.notebook.terminal!=None: self.my_server.set_terminal(self.notebook.terminal) #self.plotted_graphs.init(os.getcwd(),self.callback_last_menu_click) #set_active_name(self.light, inp_get_token_value("light.inp", "#Psun")) scan_item_add("sim.inp","#simmode","sim mode",1) scan_item_add("light.inp","#Psun","light intensity",1) #scan_populate_from_file("light.inp") if self.scan_window!=None: del self.scan_window self.scan_window=None if self.experiment_window!=None: del self.experiment_window self.experiment_window=None if self.fxexperiment_window!=None: del self.fxexperiment_window self.fxexperiment_window=None if self.jvexperiment_window!=None: del self.jvexperiment_window self.jvexperiment_window=None if self.sim_info_window!=None: del self.sim_info_window self.sim_info_window=None if self.fit_window!=None: del self.fit_window self.fit_window=None if self.lasers_window!=None: del self.lasers_window self.lasers_window=None if self.config_window!=None: del self.config_window self.config_window=None if self.qe_window!=None: del self.qe_window self.qe_window=None
def __init__(self): ribbon_base.__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.help_message = QLabel_click( _(get_lock().question + " <a href=\"" + get_lock().my_email + "\">" + get_lock().my_email + "</a>")) self.help_message.clicked.connect(self.callback_questions) self.about = QToolButton(self) self.about.setText(_("About")) self.about.pressed.connect(self.callback_about_dialog) self.cluster_button = QAction(icon_get("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.help_message) self.hbox.addWidget(self.toolbar) self.hbox.addWidget(self.about) self.setCornerWidget(self.holder) self.file = ribbon_file() self.addTab(self.file, _("File")) self.home = ribbon_home() self.addTab(self.home, _("Home")) self.ribbon_sim_mode = ribbon_sim_mode() self.addTab(self.ribbon_sim_mode, _("Simulation type")) self.simulations = ribbon_simulations() self.addTab(self.simulations, _("Simulation Editors")) self.simulations.experiments_changed.connect( self.ribbon_sim_mode.update) self.configure = ribbon_configure() self.addTab(self.configure, _("Configure")) #self.device=ribbon_device() #self.addTab(self.device,_("Device")) #self.electrical=ribbon_electrical() #self.addTab(self.electrical,_("Electrical")) self.thermal = ribbon_thermal() self.addTab(self.thermal, _("Thermal")) 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") self.currentChanged.connect(self.changed_click)
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)
my_data("", "#fxdomain_Rload", "Ohms", _("Load resistor"), "e", 1.0, "QLineEdit")) lib.append( my_data("", "#fxdomain_points", "au", _("fx domain mesh points"), "e", 1.0, "QLineEdit")) lib.append( my_data("", "#fxdomain_n", "au", _("Cycles to simulate"), "e", 1.0, "QLineEdit")) lib.append( my_data("", "#fxdomain_Vexternal", "au", _("V_{external}"), "e", 1.0, "QLineEdit")) lib.append( my_data("", "#fxdomain_voltage_modulation_max", "au", _("Voltage modulation depth"), "e", 1.0, "QLineEdit")) if enable_betafeatures() == True: lib.append( my_data("", "#fxdomain_light_modulation_depth", "au", _("Light modulation depth"), "e", 1.0, "QLineEdit")) lib.append( my_data("", "#fxdomain_do_fit", "au", _("Run fit after simulation"), "e", 1.0, "gtkswitch")) lib.append( my_data("", "#periods_to_fit", "au", _("Periods to fit"), "e", 1.0, "QLineEdit")) #crypto.inp lib.append( my_data("", "#iv", "au", _("Initialization vector"), "e", 1.0, "QLineEdit")) lib.append(
def draw_graph(self): if (len(self.time) > 0): mul, unit = time_with_units( float(self.time[len(self.time) - 1] - self.time[0])) else: mul = 1.0 unit = "s" time = [] for i in range(0, len(self.time)): time.append(self.time[i] * mul) self.fig.clf() self.fig.subplots_adjust(bottom=0.2) self.fig.subplots_adjust(left=0.1) self.ax1 = self.fig.add_subplot(211) self.ax1.ticklabel_format(useOffset=False) self.ax1.spines['right'].set_visible(False) self.ax1.spines['top'].set_visible(False) self.ax1.yaxis.set_ticks_position('left') self.ax1.xaxis.set_ticks_position('bottom') self.ax1.yaxis.set_major_locator(ticker.MaxNLocator(4)) self.ax1.set_ylabel(_("Voltage (Volts)")) self.ax1.set_xticklabels([]) self.ax1.grid(True) voltage, = self.ax1.plot(time, self.voltage, 'ro-', linewidth=3, alpha=1.0) self.ax2 = self.fig.add_subplot(212) self.ax2.spines['right'].set_visible(False) self.ax2.spines['top'].set_visible(False) self.ax2.yaxis.set_ticks_position('left') self.ax2.xaxis.set_ticks_position('bottom') self.ax2.yaxis.set_major_locator(ticker.MaxNLocator(4)) self.ax2.set_ylabel(_("Suns") + " (Suns)") self.ax2.set_xlabel(_("Time") + " (" + unit + ')') self.ax2.grid(True) sun, = self.ax2.plot(time, self.sun, 'go-', linewidth=3, alpha=1.0) if enable_betafeatures() == True: laser, = self.ax2.plot(time, self.laser, 'bo-', linewidth=3, alpha=1.0) fs_laser_enabled = False if self.fs_laser_time != -1: if len(self.time) > 2: dt = (self.time[len(time) - 1] - self.time[0]) / 100 start = self.fs_laser_time - dt * 5 stop = self.fs_laser_time + dt * 5 x = linspace(start, stop, 100) y = self.gaussian(x, self.fs_laser_time, dt) #print y fs_laser, = self.ax2.plot(x * mul, y, 'g-', linewidth=3, alpha=1.0) fs_laser_enabled = True self.ax2.ticklabel_format(style='sci', axis='x', scilimits=(0, 0)) self.fig.subplots_adjust(hspace=0)
def draw_graph(self): if (len(self.time) > 0): mul, unit = time_with_units( float(self.time[len(self.time) - 1] - self.time[0])) else: mul = 1.0 unit = "s" time = [] for i in range(0, len(self.time)): time.append(self.time[i] * mul) self.fig.clf() self.fig.subplots_adjust(bottom=0.2) self.fig.subplots_adjust(left=0.1) self.ax1 = self.fig.add_subplot(111) self.ax1.ticklabel_format(useOffset=False) #ax2 = ax1.twinx() #x_pos=0.0 #layer=0 #color =['r','g','b','y','o','r','g','b','y','o'] self.ax1.set_ylabel(_("Voltage (Volts)")) voltage, = self.ax1.plot(time, self.voltage, 'ro-', linewidth=3, alpha=1.0) self.ax1.set_xlabel(_("Time") + " (" + unit + ')') self.ax2 = self.ax1.twinx() self.ax2.set_ylabel(_("Magnitude") + " (au)") #ax2.set_ylabel('Energy (eV)') sun, = self.ax2.plot(time, self.sun, 'go-', linewidth=3, alpha=1.0) if enable_betafeatures() == True: laser, = self.ax2.plot(time, self.laser, 'bo-', linewidth=3, alpha=1.0) fs_laser_enabled = False if self.fs_laser_time != -1: if len(self.time) > 2: dt = (self.time[len(time) - 1] - self.time[0]) / 100 start = self.fs_laser_time - dt * 5 stop = self.fs_laser_time + dt * 5 x = linspace(start, stop, 100) y = self.gaussian(x, self.fs_laser_time, dt) #print y fs_laser, = self.ax2.plot(x * mul, y, 'g-', linewidth=3, alpha=1.0) fs_laser_enabled = True self.ax2.ticklabel_format(style='sci', axis='x', scilimits=(0, 0)) if enable_betafeatures() == True: if fs_laser_enabled == True: self.fig.legend( (voltage, sun, laser, fs_laser), (_("Voltage"), _("Sun"), _("CW laser"), _("fs laser")), 'upper right') else: self.fig.legend((voltage, sun, laser), (_("Voltage"), _("Sun"), _("CW laser")), 'upper right') else: if fs_laser_enabled == True: self.fig.legend((voltage, sun, fs_laser), (_("Voltage"), _("Sun"), _("fs laser")), 'upper right') else: self.fig.legend((voltage, sun), (_("Voltage"), _("Sun")), 'upper right')
def init(self): self.data = dat_file() self.fig = Figure(figsize=(5, 4), dpi=100) self.canvas = FigureCanvas(self.fig) self.canvas.figure.patch.set_facecolor('white') self.main_vbox = QVBoxLayout() toolbar = QToolBar() toolbar.setIconSize(QSize(48, 48)) self.tb_save = QAction(QIcon_load("document-save-as"), _("Save image"), self) self.tb_save.triggered.connect(self.callback_save) toolbar.addAction(self.tb_save) self.tb_ref = QAction(QIcon_load("ref"), _("Insert reference information"), self) self.tb_ref.triggered.connect(self.callback_ref) toolbar.addAction(self.tb_ref) self.import_data = QAction(QIcon_load("import"), _("Import data"), self) self.import_data.triggered.connect(self.callback_import) toolbar.addAction(self.import_data) if self.show_solar_spectra == True: if enable_betafeatures() == True: self.solar_spectra = QAction(QIcon_load("weather-few-clouds"), _("Solar spectra"), self) self.solar_spectra.triggered.connect( self.callback_solar_spectra) toolbar.addAction(self.solar_spectra) self.file_select = tb_item_mat_file(self.path, self.token) #self.file_select.changed.connect(self.callback_sun) toolbar.addWidget(self.file_select) self.main_vbox.addWidget(toolbar) self.main_vbox.addWidget(self.canvas) #toolbar 2 toolbar2 = QToolBar() toolbar2.setIconSize(QSize(32, 32)) self.tb_add = QAction(QIcon_load("list-add"), _("Add section"), self) self.tb_add.triggered.connect(self.callback_add_section) toolbar2.addAction(self.tb_add) self.tb_remove = QAction(QIcon_load("list-remove"), _("Delete section"), self) self.tb_remove.triggered.connect(self.callback_remove_item) toolbar2.addAction(self.tb_remove) self.tb_move = QAction(QIcon_load("go-down"), _("Move down"), self) self.tb_move.triggered.connect(self.callback_move_down) toolbar2.addAction(self.tb_move) self.tb_move_up = QAction(QIcon_load("go-up"), _("Move up"), self) self.tb_move_up.triggered.connect(self.callback_move_up) toolbar2.addAction(self.tb_move_up) self.tb_play = QAction(QIcon_load("media-playback-start"), _("Calculate"), self) self.tb_play.triggered.connect(self.callback_play) toolbar2.addAction(self.tb_play) self.tb_fit = QAction(QIcon_load("fit"), _("Fit data"), self) self.tb_fit.triggered.connect(self.callback_fit) toolbar2.addAction(self.tb_fit) self.main_vbox.addWidget(toolbar2) self.tab = QTableWidget() self.tab.resizeColumnsToContents() self.tab.verticalHeader().setVisible(False) self.main_vbox.addWidget(self.tab) self.setLayout(self.main_vbox) self.load_data() self.build_mesh() self.draw_graph() self.tab.cellChanged.connect(self.on_cell_edited)