コード例 #1
0
ファイル: tmesh.py プロジェクト: roderickmackenzie/opvdm
	def draw_graph(self):

		n=0
		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 debug_mode()==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 debug_mode()==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')
コード例 #2
0
ファイル: tmesh.py プロジェクト: roderickmackenzie/opvdm
	def create_columns(self, treeview):

		model=treeview.get_model()
		renderer = gtk.CellRendererText()
		renderer.connect("edited", self.on_cell_edited_length, model)
		renderer.set_property('editable', True)
		column = gtk.TreeViewColumn(_("Length"), renderer, text=SEG_LENGTH)
		column.set_sort_column_id(SEG_LENGTH)
		treeview.append_column(column)

		renderer = gtk.CellRendererText()
		renderer.connect("edited", self.on_cell_edited_dt, model)
		column = gtk.TreeViewColumn("dt", renderer, text=SEG_DT)
		renderer.set_property('editable', True)
		column.set_sort_column_id(SEG_DT)
		treeview.append_column(column)

		renderer = gtk.CellRendererText()
		renderer.connect("edited", self.on_cell_edited_voltage_start, model)
		column = gtk.TreeViewColumn(_("Start Voltage"), renderer, text=SEG_VOLTAGE_START)
		renderer.set_property('editable', True)
		column.set_sort_column_id(SEG_VOLTAGE_START)
		treeview.append_column(column)

		renderer = gtk.CellRendererText()
		renderer.connect("edited", self.on_cell_edited_voltage_stop, model)
		column = gtk.TreeViewColumn(_("Stop Voltage"), renderer, text=SEG_VOLTAGE_STOP)
		renderer.set_property('editable', True)
		column.set_sort_column_id(SEG_VOLTAGE_STOP)
		treeview.append_column(column)

		renderer = gtk.CellRendererText()
		renderer.connect("edited", self.on_cell_edited_mul, model)
		renderer.set_property('editable', True)
		column = gtk.TreeViewColumn(_("Multiply"), renderer, text=SEG_MUL)
		column.set_sort_column_id(SEG_MUL)
		treeview.append_column(column)

		if debug_mode()==True:
			renderer = gtk.CellRendererText()
			renderer.connect("edited", self.on_cell_edited_sun, model)
			renderer.set_property('editable', True)
			column = gtk.TreeViewColumn(_("Sun"), renderer, text=SEG_SUN)
			column.set_sort_column_id(SEG_SUN)
			treeview.append_column(column)

		if debug_mode()==True:
			renderer = gtk.CellRendererText()
			renderer.connect("edited", self.on_cell_edited_laser, model)
			renderer.set_property('editable', True)
			column = gtk.TreeViewColumn(_("CW laser"), renderer, text=SEG_LASER)
			column.set_sort_column_id(SEG_LASER)
			treeview.append_column(column)
コード例 #3
0
ファイル: experiment.py プロジェクト: roderickmackenzie/opvdm
	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 debug_mode()==False:
			item_factory.delete_item(_("/Advanced"))

		window.add_accel_group(accel_group)

		self.item_factory = item_factory

		return item_factory.get_widget("<main>")
コード例 #4
0
	def init(self):
		self.__gobject_init__()

		self.mesh_model = gtk.ListStore(str,str)

		self.load()

		#spacer
		label=gtk.Label("\n\n    ")
		label.show()
		#self.attach(label, 4, 5, 1, 2,gtk.SHRINK ,gtk.SHRINK)
		self.pack_start(label, True, True, 0)


		#mesh editor
		frame = gtk.Frame()
		frame.set_label("Mesh")
		vbox_mesh = gtk.VBox(False, 2)
		treeview = gtk.TreeView(self.mesh_model)
		treeview.set_size_request(200, 100)
		treeview.set_rules_hint(True)
		treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)
		self.__add_columns_mesh(treeview)
		vbox_mesh.pack_start(treeview, False, False, 0)

		if debug_mode()==True:
			add_button = gtk.Button("Add",gtk.STOCK_ADD)
			add_button.connect("clicked", self.on_add_mesh_clicked, self.mesh_model)

			delete_button = gtk.Button("Delete",gtk.STOCK_DELETE)
			delete_button.connect("clicked", self.on_remove_from_mesh_click, treeview)

			hbox = gtk.HBox(False, 2)
			
			hbox.pack_start(add_button, False, False, 0)
			hbox.pack_start(delete_button, False, False, 0)

			vbox_mesh.pack_start(hbox, False, False, 0)

		frame.add(vbox_mesh)

		self.pack_start(frame, True, True, 0)

		self.mesh_dump_ctl=mesh_dump_ctl()
		self.mesh_dump_ctl.init()
		self.mesh_dump_ctl.show()
		self.pack_start(self.mesh_dump_ctl, True, True, 0)

		self.show_all()
コード例 #5
0
	def __add_columns_mesh(self, treeview):

		model = treeview.get_model()

		# Thicknes
		render = gtk.CellRendererText()
		render.connect("edited", self.on_mesh_edited, model)
		render.set_data("column", MESH_THICKNES)
		render.set_property("editable", True)

		column = gtk.TreeViewColumn("Thicknes", render, text=MESH_THICKNES, editable=True)
		if debug_mode()==False:
			column.set_visible(False)
		treeview.append_column(column)


		# Thicknes
		render = gtk.CellRendererText()
		render.connect("edited", self.on_mesh_edited, model)
		render.set_data("column", MESH_POINTS)
		render.set_property("editable", True)

		column = gtk.TreeViewColumn("Points", render, text=MESH_POINTS, editable=True)
		treeview.append_column(column)
コード例 #6
0
ファイル: opvdm.py プロジェクト: roderickmackenzie/opvdm
	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()
コード例 #7
0
ファイル: opvdm.py プロジェクト: roderickmackenzie/opvdm
	def make_tool_box1(self):
		pos=0
		toolbar = gtk.Toolbar()
		toolbar.set_style(gtk.TOOLBAR_ICONS)
		toolbar.set_size_request(900, 50)
		toolbar.show()

		if debug_mode()==True:
			image = gtk.Image()
	   		image.set_from_file(os.path.join(get_image_file_path(),"qe.png"))
			self.qe_button = gtk.ToolButton(image)
			self.tooltips.set_tip(self.qe_button, _("Quantum efficiency"))
			self.qe_button.connect("clicked", self.callback_qe_window)
			toolbar.insert(self.qe_button, pos)
			self.qe_button.show_all()
			pos=pos+1

		self.sim_mode=tb_item_sim_mode()
		self.sim_mode.init()
		global_object_register("tb_item_sim_mode_update",self.sim_mode.update)
		toolbar.insert(self.sim_mode, pos)
		pos=pos+1

		self.ti_light=tb_item_sun()
		self.light=self.ti_light.light

		toolbar.insert(self.ti_light, pos)
		pos=pos+1

		ti_progress = gtk.ToolItem()
		hbox = gtk.HBox(False, 2)

		sep = gtk.SeparatorToolItem()

		sep.set_draw(False)
		sep.set_expand(True)
		sep.show_all()

		toolbar.insert(sep, pos)
		pos=pos+1

		self.spin=gtk.Spinner()
		self.spin.set_size_request(32, 32)
		self.spin.show()
		self.spin.stop()


		gap=gtk.Label(" ")
		hbox.add(gap)
		hbox.add(self.spin)	
		hbox.set_child_packing(self.spin, False, False, 0, 0)


		gap.show()
		hbox.show()

		ti_progress.add(hbox)

		toolbar.insert(ti_progress, pos)
		pos=pos+1
		ti_progress.show()
		return toolbar
コード例 #8
0
ファイル: scan.py プロジェクト: roderickmackenzie/opvdm
	def init(self,my_server):
		self.cluster_window=None
		self.win_list=windows()
		self.win_list.load()
		self.win_list.set_window(self,"scan_window")
		print "constructur"

		self.rod=[]
		if os.path.isfile("scan_window.inp"):
			f = open("scan_window.inp")
			lines = f.readlines()
			f.close()

			path=lines[0].strip()
			if path.startswith(os.getcwd()):
				self.sim_dir=path
			else:
				self.sim_dir=os.getcwd()
		else:
			self.sim_dir=os.getcwd()

		self.tooltips = gtk.Tooltips()

		self.set_border_width(2)
		self.set_title(_("Parameter scan - opvdm"))

		n=0

		self.hpc_root_dir= os.path.abspath(os.getcwd()+'/../')

		self.number_of_tabs=0
		items=0

		self.status_bar = gtk.Statusbar()      

		self.status_bar.show()

		self.context_id = self.status_bar.get_context_id("Statusbar example")

		box=gtk.HBox()
		box.add(self.status_bar)
		box.set_child_packing(self.status_bar, True, True, 0, 0)
		box.show()


		self.menu_items = (
		    ( _("/_File"),         None,         None, 0, "<Branch>" ),
		    ( _("/File/Change dir"),     None, self.callback_change_dir, 0, None ),
		    ( _("/File/Close"),     None, self.callback_close, 0, None ),
		    ( _("/Simulations/_New"),     None, self.callback_add_page, 0, "<StockItem>", "gtk-new" ),
		    ( _("/Simulations/_Delete simulaton"),     None, self.callback_delete_page, 0, "<StockItem>", "gtk-delete" ),
		    ( _("/Simulations/_Rename simulation"),     None, self.callback_rename_page, 0, "<StockItem>", "gtk-edit" ),
		    ( _("/Simulations/_Clone simulation"),     None, self.callback_copy_page, 0, "<StockItem>", "gtk-copy" ),
			( _("/Simulations/sep1"),     None, None, 0, "<Separator>" ),
		    ( _("/Simulations/_Run simulation"),     None, self.callback_run_simulation, 0, "<StockItem>", "gtk-media-play" ),
		    ( _("/Advanced/_Build simulation"),     None, self.callback_build_simulation, 0, "<StockItem>", "gtk-cdrom" ),
			( _("/Advanced/_Run (no build)"),     None, self.callback_run_simulation_no_build, 0, "<StockItem>", "gtk-media-play" ),
			( _("/Advanced/_Run nested simulation"),     None, self.callback_nested_simulation, 0, "<StockItem>", "gtk-media-play" ),
			( _("/Advanced/_Clean simulation"),     None, self.callback_clean_simulation, 0, "<StockItem>", "gtk-clear" ),
			( _("/Advanced/_Clean unconverged simulation"),     None, self.callback_clean_unconverged_simulation, 0, "<StockItem>", "gtk-clear" ),
			( _("/Advanced/_Clean simulation output"),     None, self.callback_clean_simulation_output, 0, "<StockItem>", "gtk-clear" ),
			( _("/Advanced/sep2"),     None, None, 0, "<Separator>" ),
			( _("/Advanced/_Import from hpc"),     None, self.callback_import_from_hpc, 0, "<StockItem>", "gtk-open" ),
			( _("/Advanced/_Push to hpc"),     None, self.callback_push_to_hpc, 0, "<StockItem>", "gtk-save" ),
			( _("/Advanced/_Push unconverged to hpc"),     None, self.callback_push_unconverged_to_hpc, 0, "<StockItem>", "gtk-save" ),
			( _("/Advanced/_Set hpc dir"),     None, self.callback_set_hpc_dir, 0, "<StockItem>", "gtk-open" ),

		    ( _("/Advanced/_Cluster sleep"),     None, self.callback_cluster_sleep, 0, "<StockItem>", "gtk-copy" ),
		    ( _("/Advanced/_Cluster poweroff"),     None, self.callback_cluster_poweroff, 0, "<StockItem>", "gtk-copy" ),
		    ( _("/Advanced/_Cluster wake"),     None, self.callback_wol, 0, "<StockItem>", "gtk-copy" ),

		    ( _("/Advanced/_Remove all results"),     None, self.callback_remove_all_results, 0, "<StockItem>", "gtk-copy" ),
		    ( _("/_Help"),         None,         None, 0, "<LastBranch>" ),
		    ( _("/_Help/Help"),   None,         self.callback_help, 0, None ),
		    ( _("/_Help/About"),   None,         about_dialog_show, 0, "<StockItem>", "gtk-about" ),
		    )


		
		main_vbox = gtk.VBox(False, 3)

		menubar = self.get_main_menu(self)
		main_vbox.pack_start(menubar, False, False, 0)
		menubar.show()

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

		#image = gtk.Image()
		#image.set_from_file(os.path.join(get_image_file_path(),"new-tab.png"))
		tb_new_scan = gtk.MenuToolButton(gtk.STOCK_NEW)
		tb_new_scan.connect("clicked", self.callback_add_page)
		self.tooltips.set_tip(tb_new_scan, _("New simulation"))

		self.tab_menu=gtk.Menu()
		tb_new_scan.set_menu(self.tab_menu)

		toolbar.insert(tb_new_scan, pos)
		pos=pos+1

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

		delete = gtk.ToolButton(gtk.STOCK_DELETE)
		delete.connect("clicked", self.callback_delete_page,None)
		self.tooltips.set_tip(delete, _("Delete simulation"))
		toolbar.insert(delete, pos)
		pos=pos+1

		copy = gtk.ToolButton(gtk.STOCK_COPY)
		copy.connect("clicked", self.callback_copy_page,None)
		self.tooltips.set_tip(copy, _("Clone simulation"))
		toolbar.insert(copy, pos)
		pos=pos+1


		rename = gtk.ToolButton(gtk.STOCK_EDIT)
		rename.connect("clicked", self.callback_rename_page,None)
		self.tooltips.set_tip(rename, _("Rename simulation"))
		toolbar.insert(rename, 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(),"forward2.png"))
		tb_simulate = gtk.ToolButton(image)
		tb_simulate.connect("clicked", self.callback_run_all_simulations)
		self.tooltips.set_tip(tb_simulate, _("Run all simulation"))
		toolbar.insert(tb_simulate, pos)
		pos=pos+1

		if debug_mode()==True:
			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(),"server.png"))
			cluster = gtk.ToolButton(image)
			cluster.connect("clicked", self.callback_cluster)
			self.tooltips.set_tip(cluster, _("Configure cluster"))
			toolbar.insert(cluster, pos)
			cluster.show()
			pos=pos+1

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

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


		toolbar.show_all()
		main_vbox.pack_start(toolbar, False, False, 0)
		#main_vbox.add(toolbar)

		main_vbox.set_border_width(1)
		self.add(main_vbox)
		main_vbox.show()
		self.myserver=my_server
		

		self.notebook = gtk.Notebook()
		self.notebook.show()
		self.notebook.set_tab_pos(gtk.POS_LEFT)

		self.load_tabs()
		main_vbox.pack_start(self.notebook, True, True, 0)
		main_vbox.pack_start(box, False, False, 0)

		self.connect("delete-event", self.callback_close)
		self.notebook.connect("switch-page",self.switch_page)
		self.set_icon_from_file(os.path.join(get_image_file_path(),"image.jpg"))

		self.hide()