示例#1
0
    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)
示例#2
0
	def callback_cluster(self, widget, data=None):
		if self.cluster_window==None:
			self.cluster_window=hpc_class()
			self.cluster_window.init(self.hpc_root_dir,self.myserver.terminal)

		print self.cluster_window.get_property("visible")

		if self.cluster_window.get_property("visible")==True:
			self.cluster_window.hide()
		else:
			self.cluster_window.show()
示例#3
0
	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)