예제 #1
0
    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()
예제 #2
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)
예제 #3
0
	def __init__(self):

		gobject.GObject.__init__(self)

		self.my_server=server()
		self.my_server.init(os.getcwd())
		self.my_server.statusicon.connect('popup-menu', self.on_status_icon_right_click)
		self.my_server.setup_gui(self.gui_sim_start,self.gui_sim_stop)

		if running_on_linux()==True:
			DBusGMainLoop(set_as_default=True)
			self.bus = dbus.SessionBus()
			self.bus.add_match_string_non_blocking("type='signal',interface='org.my.opvdm'")
			self.bus.add_message_filter(self.adbus)

		else:
			self.win_pipe=win_pipe()
			self.win_pipe.connect('new-data', self.win_dbus)
			self.win_pipe.start()

		self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
		#self.window.set_size_request(-1,1000)
		self.window.set_border_width(10)
		self.window.set_title(_("Organic Photovoltaic Device Model (www.opvdm.com)"))

		splash=splash_window()
		splash.init()

		temp_error=ver_error()
		print temp_error
		if len(temp_error)>0:
				md = gtk.MessageDialog(self.window,gtk.DIALOG_DESTROY_WITH_PARENT, gtk.MESSAGE_ERROR, gtk.BUTTONS_CLOSE, temp_error)
				md.run()
				md.destroy()

		self.undo_list=undo_list_class()
		self.undo_list.init()


		self.experiment_window=None

		self.fxexperiment_window=None

		self.qe_window=None

		self.win_list=windows()
		self.win_list.load()

		self.config=config()
		#table = gtk.Table(3,6,False)

		self.window.set_icon_from_file(os.path.join(get_image_file_path(),"image.jpg"))

		

		self.show_tabs = True
		self.show_border = True

		self.menu_items = (
		    ( _("/_File"),         None,         None, 0, "<Branch>" ),
			(_("/File/_New simulation"), "<control>N", self.callback_new, 0, "<StockItem>", "gtk-new" ),
			(_("/File/_Open simulation"), "<control>O", self.callback_open, 0, "<StockItem>", "gtk-open" ),
		    ( _("/File/_Export data"),     None, self.callback_export, 0, "<StockItem>", "gtk-save" ),
		    ( _("/File/Import data"),     None, self.callback_import, 0 , "<StockItem>", "gtk-harddisk"),
		    ( _("/File/Import from library"),     None, self.callback_import_from_lib, 0 , "<StockItem>", "gtk-harddisk"),
		    ( _("/File/Quit"),     "<control>Q", gtk.main_quit, 0, "<StockItem>", "gtk-quit" ),
		    ( _("/_Simulate"),      None,         None, 0, "<Branch>" ),
		    ( _("/Simulate/Run"),  None,         self.callback_simulate, 0, "<StockItem>", "gtk-media-play" ),
		    ( _("/Simulate/Parameter scan"),  None,         self.callback_scan , 0, None ),
		    ( _("/Simulate/Start cluster server"),  None,         self.callback_start_cluster_server , 0, None ),
		    ( _("/_View"),      None,         None, 0, "<Branch>" ),
		    ( _("/_Plots"),      None,         None, 0, "<Branch>" ),
		    ( _("/Plots/Plot simulation result"),  None,         self.callback_plot_select, 0, "<StockItem>", "gtk-open"),
		    ( _("/_Plots/"),     None, None, 0, "<Separator>" ),
		    ( _("/_Help"),         None,         None, 0, "<LastBranch>" ),
			( _("/_Help/Help Index"),   None,         self.callback_help, 0, "<StockItem>", "gtk-help"  ),
			

		    ( _("/_Help/About"),   None, self.callback_about_dialog, 0, "<StockItem>", "gtk-about" ),
		    )
		pos=0

		self.menubar = self.get_main_menu(self.window)

		#a = (( "/Plots/Plot after simulation",  None, self.callback_plot_after_run_toggle, 0, "<ToggleItem>" ),   )
		#self.item_factory.create_items( a, )


		#a = (( "/Plots/One plot window",  None, self.callback_set_plot_auto_close, 0, "<ToggleItem>" ),   )
		#self.item_factory.create_items( a, )


		#table.show()
		self.window.connect("destroy", gtk.main_quit)

		self.tooltips = gtk.Tooltips()

		self.window.set_size_request(-1, 780)
		main_vbox = gtk.VBox(False, 5)
		main_vbox.set_border_width(1)
		self.window.add(main_vbox)
		#window.add(table)
		main_vbox.show()


		toolbar = gtk.Toolbar()
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(-1, 50)

		open_sim = gtk.ToolButton(gtk.STOCK_OPEN)
		self.tooltips.set_tip(open_sim, _("Open a simulation"))
		toolbar.insert(open_sim, pos)
		pos=pos+1

		#self.save_sim = gtk.ToolButton(gtk.STOCK_SAVE)
		#self.tooltips.set_tip(self.save_sim, "Save a simulation")
		#toolbar.insert(self.save_sim, pos)
		#pos=pos+1

		new_sim = gtk.ToolButton(gtk.STOCK_NEW)
		self.tooltips.set_tip(new_sim, _("Make a new simulation"))
		toolbar.insert(new_sim, pos)
		pos=pos+1

		sep_lhs = gtk.SeparatorToolItem()
		sep_lhs.set_draw(True)
		sep_lhs.set_expand(False)
		toolbar.insert(sep_lhs, pos)
		pos=pos+1

		self.undo = gtk.ToolButton(gtk.STOCK_UNDO)
		self.tooltips.set_tip(self.undo, "Undo")
		toolbar.insert(self.undo, pos)
		self.undo.connect("clicked", self.callback_undo)
		pos=pos+1

		sep_lhs = gtk.SeparatorToolItem()
		sep_lhs.set_draw(True)
		sep_lhs.set_expand(False)
		toolbar.insert(sep_lhs, pos)
		pos=pos+1

	        image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"play.png"))
		self.play = gtk.ToolButton(image)
		self.tooltips.set_tip(self.play, _("Run the simulation"))
		toolbar.insert(self.play, pos)
		self.play.connect("clicked", self.callback_simulate)
		pos=pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"forward.png"))
		self.tb_run_scan = gtk.ToolButton(image)
		self.tb_run_scan.connect("clicked", self.callback_run_scan)
		self.tooltips.set_tip(self.tb_run_scan, _("Run parameter scan"))
		toolbar.insert(self.tb_run_scan, pos)
		self.tb_run_scan.set_sensitive(False)
		pos=pos+1

		if debug_mode()==True:
			image = gtk.Image()
	   		image.set_from_file(os.path.join(get_image_file_path(),"fit.png"))
			self.tb_run_fit = gtk.ToolButton(image)
			self.tb_run_fit.connect("clicked", self.callback_run_fit)
			self.tooltips.set_tip(self.tb_run_fit, _("Run a fit command"))
			toolbar.insert(self.tb_run_fit, pos)
			self.tb_run_fit.set_sensitive(True)
			pos=pos+1

	        image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"pause.png"))
		self.stop = gtk.ToolButton(image )
		self.tooltips.set_tip(self.stop, _("Stop the simulation"))
		self.stop.connect("clicked", self.callback_simulate_stop)
		toolbar.insert(self.stop, pos)
		pos=pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(True)
		sep.set_expand(False)
		toolbar.insert(sep, pos)
		pos=pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"scan.png"))
		self.param_scan = gtk.ToolButton(image)
		self.param_scan.connect("clicked", self.callback_scan)
		self.tooltips.set_tip(self.param_scan, _("Parameter scan"))
		toolbar.insert(self.param_scan, pos)
		pos=pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(True)
		sep.set_expand(False)
		toolbar.insert(sep, pos)
		pos=pos+1

	        image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"plot.png"))
		self.plot_select = gtk.MenuToolButton(image,"hello")
		self.tooltips.set_tip(self.plot_select, _("Find a file to plot"))
		self.plotted_graphs = used_files_menu()
		self.plot_select.set_menu(self.plotted_graphs.menu)
		toolbar.insert(self.plot_select, pos)
		self.plot_select.connect("clicked", self.callback_plot_select)
		self.plot_select.set_sensitive(False)
		pos=pos+1

		#image = gtk.Image()
   		#image.set_from_file(os.path.join(get_image_file_path(),"refresh.png"))
		#self.plot_open = gtk.ToolButton(image)
		#self.tooltips.set_tip(self.plot_open, "Replot the graph")
		#toolbar.insert(self.plot_open, pos)
		#self.plot_open.set_sensitive(False)
		#os=pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"plot_time.png"))
		self.examine = gtk.ToolButton(image)
		self.tooltips.set_tip(self.examine, _("Examine results in time domain"))
		self.examine.connect("clicked", self.callback_examine)
		toolbar.insert(self.examine, pos)
		pos=pos+1

		sep = gtk.SeparatorToolItem()
		sep.set_draw(True)
		sep.set_expand(False)
		toolbar.insert(sep, pos)
		pos=pos+1



		image = gtk.Image()
	   	image.set_from_file(os.path.join(get_image_file_path(),"time.png"))
		self.experiment_window_button = gtk.ToolButton(image)
		self.tooltips.set_tip(self.experiment_window_button, _("Edit the time mesh"))
		self.experiment_window_button.connect("clicked", self.callback_edit_experiment_window)
		toolbar.insert(self.experiment_window_button, pos)
		pos=pos+1

		image = gtk.Image()
   		image.set_from_file(os.path.join(get_image_file_path(),"spectrum.png"))
		self.examine = gtk.ToolButton(image)
		self.tooltips.set_tip(self.examine, _("Frequency domain mesh editor"))
		self.examine.connect("clicked", self.callback_fxexperiment_window)
		toolbar.insert(self.examine, pos)
		pos=pos+1

		sep2 = gtk.SeparatorToolItem()
		sep2.set_draw(False)
		sep2.set_expand(True)
		toolbar.insert(sep2, pos)
		pos=pos+1


		help = gtk.ToolButton(gtk.STOCK_HELP)
		self.tooltips.set_tip(help, "Help")
		help.connect("clicked", self.callback_help)
		toolbar.insert(help, pos)
		pos=pos+1


		#quittb = gtk.ToolButton(gtk.STOCK_QUIT)
		#self.tooltips.set_tip(quittb, "Quit")
		#toolbar.insert(quittb, pos)
		#quittb.connect("clicked", gtk.main_quit)
		#pos=pos+1

		new_sim.connect("clicked", self.callback_new)
		open_sim.connect("clicked", self.callback_open)
		#self.save_sim.connect("clicked", self.callback_export)

		#self.plot_open.connect("clicked", self.callback_plot_open)

		toolbar1=self.make_tool_box1()


		toolbar.show_all()



		main_vbox.pack_start(self.menubar, False, True, 0)
		handlebox = gtk.HandleBox()
		handlebox.set_snap_edge(gtk.POS_LEFT)
		handlebox.show()

		toolbar.set_size_request(1000, -1)

		tb_vbox=gtk.VBox()
		tb_vbox.add(toolbar)
		tb_vbox.add(toolbar1)
		tb_vbox.show()



		handlebox.add(tb_vbox)

		main_vbox.pack_start(handlebox, False, False, 0)

		self.window.connect("delete-event", self.callback_close_window) 

		self.win_list.set_window(self.window,"main_window")



		self.menubar.show()

		self.make_window2(main_vbox)

		self.window.show()


		process_events()
예제 #4
0
파일: gpvdm.py 프로젝트: xj361685640/gpvdm
    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()