예제 #1
0
 def eh_ex_status_text(self, event): 
     # event.Skip()
     event_handlers.status_text(self, event)
예제 #2
0
    def __init__(self, show_startup, *args, **kwds):
        
        self.config = io.Config()
        
        #print _path
        #if _path != '':
        #    self.config.load_default(_path + '/genx.conf')
        #else:
        #    self.config.load_default('./genx.conf')
        self.config.load_default(_path + 'genx.conf')
        
        status_text = lambda event:event_handlers.status_text(self, event)
        
        # begin wxGlade: MainFrame.__init__
        kwds["style"] = wx.CAPTION|wx.CLOSE_BOX|wx.MINIMIZE_BOX|wx.MAXIMIZE|wx.MAXIMIZE_BOX|wx.SYSTEM_MENU|wx.RESIZE_BORDER
        wx.Frame.__init__(self, *args, **kwds)
        
        #self.config.load_default('./genx.conf')
        if show_startup:
            self.startup_dialog(_path)
        
        
        self.ver_splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER)
        self.main_panel = wx.Panel(self.ver_splitter, -1)
        self.hor_splitter = wx.SplitterWindow(self.main_panel, -1, style=wx.SP_3D|wx.SP_BORDER)
        self.input_panel = wx.Panel(self.hor_splitter, -1)
        self.input_notebook = wx.Notebook(self.input_panel, -1, style=wx.NB_BOTTOM)
        self.input_notebook_script = wx.Panel(self.input_notebook, -1)
        self.input_notebook_grid = wx.Panel(self.input_notebook, -1)
        self.plot_panel = wx.Panel(self.hor_splitter, -1)
        self.plot_notebook = wx.Notebook(self.plot_panel, -1, style=wx.NB_BOTTOM)
        self.plot_notebook_foms = wx.Panel(self.plot_notebook, -1)
        self.plot_notebook_Pars = wx.Panel(self.plot_notebook, -1)
        self.plot_notebook_fom = wx.Panel(self.plot_notebook, -1)
        self.plot_notebook_data = wx.Panel(self.plot_notebook, -1)
        self.data_panel = wx.Panel(self.ver_splitter, -1)
        self.data_notebook = wx.Notebook(self.data_panel, -1, style=wx.NB_BOTTOM)
        self.data_notebook_pane_2 = wx.Panel(self.data_notebook, -1)
        self.data_notebook_data = wx.Panel(self.data_notebook, -1)
        
        # Menu Bar
        self.main_frame_menubar = wx.MenuBar()
        self.mb_file = wx.Menu()
        self.mb_new = wx.MenuItem(self.mb_file, wx.NewId(), "New...\tCtrl+N", "Create a new model", wx.ITEM_NORMAL)
        self.mb_file.AppendItem(self.mb_new)
        self.mb_open = wx.MenuItem(self.mb_file, wx.NewId(), "Open...\tCtrl+O", "Open an existing model", wx.ITEM_NORMAL)
        self.mb_file.AppendItem(self.mb_open)
        self.mb_save = wx.MenuItem(self.mb_file, wx.NewId(), "Save...\tCtrl+S", "Save the current model", wx.ITEM_NORMAL)
        self.mb_file.AppendItem(self.mb_save)
        self.mb_saveas = wx.MenuItem(self.mb_file, wx.NewId(), "Save As...", "Save the active model with a new name", wx.ITEM_NORMAL)
        self.mb_file.AppendItem(self.mb_saveas)
        self.mb_file.AppendSeparator()
        mb_import = wx.Menu()
        self.mb_import_data = wx.MenuItem(mb_import, wx.NewId(), "Import Data...\tCtrl+D", "Import data to the active data set", wx.ITEM_NORMAL)
        mb_import.AppendItem(self.mb_import_data)
        self.mb_import_table = wx.MenuItem(mb_import, wx.NewId(), "Import Table...", "Import a table from an ASCII file", wx.ITEM_NORMAL)
        mb_import.AppendItem(self.mb_import_table)
        self.mb_import_script = wx.MenuItem(mb_import, wx.NewId(), "Import Script...", "Import a python model script", wx.ITEM_NORMAL)
        mb_import.AppendItem(self.mb_import_script)
        self.mb_file.AppendMenu(wx.NewId(), "Import", mb_import, "")
        mb_export = wx.Menu()
        self.mb_export_data = wx.MenuItem(mb_export, wx.NewId(), "Export Data...", "Export data in ASCII format", wx.ITEM_NORMAL)
        mb_export.AppendItem(self.mb_export_data)
        self.mb_export_table = wx.MenuItem(mb_export, wx.NewId(), "Export Table...", "Export table to an ASCII file", wx.ITEM_NORMAL)
        mb_export.AppendItem(self.mb_export_table)
        self.mb_export_script = wx.MenuItem(mb_export, wx.NewId(), "Export Script...", "Export the script to a Python file", wx.ITEM_NORMAL)
        mb_export.AppendItem(self.mb_export_script)
        self.mb_file.AppendMenu(wx.NewId(), "Export", mb_export, "")
        self.mb_file.AppendSeparator()
        mb_print = wx.Menu()
        self.mb_print_plot = wx.MenuItem(mb_print, wx.NewId(), "Print Plot...\tCtrl+P", "Print the current plot", wx.ITEM_NORMAL)
        mb_print.AppendItem(self.mb_print_plot)
        self.mb_print_grid = wx.MenuItem(mb_print, wx.NewId(), "Print Grid...", "Print the grid", wx.ITEM_NORMAL)
        mb_print.AppendItem(self.mb_print_grid)
        self.mb_print_script = wx.MenuItem(mb_print, wx.NewId(), "Print Script...", "Print the model script", wx.ITEM_NORMAL)
        mb_print.AppendItem(self.mb_print_script)
        self.mb_file.AppendMenu(wx.NewId(), "Print", mb_print, "")
        self.mb_file.AppendSeparator()
        self.mb_quit = wx.MenuItem(self.mb_file, wx.NewId(), "&Quit\tAlt+Q", "Quit the program", wx.ITEM_NORMAL)
        self.mb_file.AppendItem(self.mb_quit)
        self.main_frame_menubar.Append(self.mb_file, "File")
        self.mb_edit = wx.Menu()
        self.mb_copy_graph = wx.MenuItem(self.mb_edit, wx.NewId(), "Copy Graph\tCtrl+C", "Copy the current graph to the clipboard as a bitmap", wx.ITEM_NORMAL)
        self.mb_edit.AppendItem(self.mb_copy_graph)
        self.mb_copy_sim = wx.MenuItem(self.mb_edit, wx.NewId(), "Copy Simulation", "Copy the current simulation and data as ASCII text", wx.ITEM_NORMAL)
        self.mb_edit.AppendItem(self.mb_copy_sim)
        self.mb_copy_table = wx.MenuItem(self.mb_edit, wx.NewId(), "Copy Table", "Copy the parameter grid", wx.ITEM_NORMAL)
        self.mb_edit.AppendItem(self.mb_copy_table)
        self.mb_findreplace = wx.MenuItem(self.mb_edit, wx.NewId(), "&Find/Replace...\tCtrl+F", "Find and replace in the script", wx.ITEM_NORMAL)
        self.mb_edit.AppendItem(self.mb_findreplace)
        self.mb_edit_sub = wx.Menu()
        self.mb_new_data_set = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "&New data set\tAlt+N", "Append a new data set", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_new_data_set)
        self.mb_data_delete = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "&Delete\tAlt+D", "Delete the selected data set", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_data_delete)
        self.mb_data_move_down = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "&Lower item\tAlt+L", "Move selected item down", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_data_move_down)
        self.mb_data_move_up = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "&Raise item\tAlt+R", "Move selected data sets up", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_data_move_up)
        self.mb_edit_sub.AppendSeparator()
        self.mb_toggle_show = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "Toggle &Show\tAlt+S", "Toggle show on and off for the selected data sets", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_toggle_show)
        self.mb_toggle_use = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "Toggle &Use\tAlt+U", "Toggle use on and off for the selected data sets", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_toggle_use)
        self.mb_toggle_error = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "Toggle &Error\tAlt+E", "Turn the use of error on and off", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_toggle_error)
        self.mb_edit_sub.AppendSeparator()
        self.mb_toggle_calc = wx.MenuItem(self.mb_edit_sub, wx.NewId(), "&Calculations\tAlt+C", "Open dialog box to define dataset calculations", wx.ITEM_NORMAL)
        self.mb_edit_sub.AppendItem(self.mb_toggle_calc)
        self.mb_edit.AppendMenu(wx.NewId(), "Data", self.mb_edit_sub, "")
        self.main_frame_menubar.Append(self.mb_edit, "Edit")
        self.mb_view = wx.Menu()
        self.mb_view_zoom = wx.MenuItem(self.mb_view, wx.NewId(), "Zoom\tCtrl+Z", "Turn the zoom on/off", wx.ITEM_CHECK)
        self.mb_view.AppendItem(self.mb_view_zoom)
        self.mb_view_zoomall = wx.MenuItem(self.mb_view, wx.NewId(), "Zoom All\tCtrl+A", "Zoom to fit all data points", wx.ITEM_NORMAL)
        self.mb_view.AppendItem(self.mb_view_zoomall)
        mb_view_yscale = wx.Menu()
        self.mb_view_yscale_log = wx.MenuItem(mb_view_yscale, wx.NewId(), "log", "Set y-scale logarithmic", wx.ITEM_RADIO)
        mb_view_yscale.AppendItem(self.mb_view_yscale_log)
        self.mb_view_yscale_lin = wx.MenuItem(mb_view_yscale, wx.NewId(), "lin", "Set y-scale linear", wx.ITEM_RADIO)
        mb_view_yscale.AppendItem(self.mb_view_yscale_lin)
        self.mb_view.AppendMenu(wx.NewId(), "y scale", mb_view_yscale, "")
        self.mb_view_autoscale = wx.MenuItem(self.mb_view, wx.NewId(), "Autoscale", "Set autoscale on when plotting", wx.ITEM_CHECK)
        self.mb_view.AppendItem(self.mb_view_autoscale)
        self.mb_use_toggle_show = wx.MenuItem(self.mb_view, wx.NewId(), "Use Toggle Show", "Set if the plotted data should be toggled or selected by the mouse", wx.ITEM_CHECK)
        self.mb_view.AppendItem(self.mb_use_toggle_show)
        self.main_frame_menubar.Append(self.mb_view, "View")
        self.mb_fit = wx.Menu()
        self.mb_fit_simulate = wx.MenuItem(self.mb_fit, wx.NewId(), "&Simulate\tF9", "Compile the script and run the Sim function", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_simulate)
        self.mb_fit_evaluate = wx.MenuItem(self.mb_fit, wx.NewId(), "&Evaluate\tF5", "Evaluate the Sim function only - no recompiling", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_evaluate)
        self.mb_fit_start = wx.MenuItem(self.mb_fit, wx.NewId(), "Start &Fit\tCtrl+F", "Start fitting", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_start)
        self.mb_fit_stop = wx.MenuItem(self.mb_fit, wx.NewId(), "&Halt Fit\tCtrl+H", "Stop fitting", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_stop)
        self.mb_fit_resume = wx.MenuItem(self.mb_fit, wx.NewId(), "&Resume Fit\tCtrl+R", "Resume fitting without reinitialization of the optimizer", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_resume)
        self.mb_fit_analyze = wx.MenuItem(self.mb_fit, wx.NewId(), "Analyze fit", "Analyze the fit", wx.ITEM_NORMAL)
        self.mb_fit.AppendItem(self.mb_fit_analyze)
        self.main_frame_menubar.Append(self.mb_fit, "Fit")
        self.mb_set = wx.Menu()
        mb_set_plugins = wx.Menu()
        mb_set_plugins.AppendSeparator()
        self.mb_set.AppendMenu(wx.NewId(), "Plugins", mb_set_plugins, "")
        self.mb_set_opt = wx.MenuItem(self.mb_set, wx.NewId(), "Optimizer\tShift+Ctrl+O", "", wx.ITEM_NORMAL)
        self.mb_set.AppendItem(self.mb_set_opt)
        self.mb_set_dataloader = wx.MenuItem(self.mb_set, wx.NewId(), "Data Loader\tShift+Ctrl+D", "", wx.ITEM_NORMAL)
        self.mb_set.AppendItem(self.mb_set_dataloader)
        self.mb_set_import = wx.MenuItem(self.mb_set, wx.NewId(), "Import\tShift+Ctrl+I", "Import settings for the data sets", wx.ITEM_NORMAL)
        self.mb_set.AppendItem(self.mb_set_import)
        self.mb_set_dataplot = wx.MenuItem(self.mb_set, wx.NewId(), "Plot Markers\tShift+Ctrl+P", "Set the symbols and lines of data and simulations", wx.ITEM_NORMAL)
        self.mb_set.AppendItem(self.mb_set_dataplot)
        self.mb_set_startup_profile = wx.MenuItem(self.mb_set, wx.NewId(), "Startup Profile", "Set the startup profile", wx.ITEM_NORMAL)
        self.mb_set.AppendItem(self.mb_set_startup_profile)
        self.main_frame_menubar.Append(self.mb_set, "Settings")
        wxglade_tmp_menu = wx.Menu()
        mb_help = wx.Menu()
        self.mb_models_help = wx.MenuItem(mb_help, wx.NewId(), "Models...", "Show help for the models", wx.ITEM_NORMAL)
        mb_help.AppendItem(self.mb_models_help)
        self.mb_fom_help = wx.MenuItem(mb_help, wx.NewId(), "FOM...", "Show help about the fom", wx.ITEM_NORMAL)
        mb_help.AppendItem(self.mb_fom_help)
        self.mb_plugins_help = wx.MenuItem(mb_help, wx.NewId(), "Plugins...", "Show help for the plugins", wx.ITEM_NORMAL)
        mb_help.AppendItem(self.mb_plugins_help)
        self.mb_data_loaders_help = wx.MenuItem(mb_help, wx.NewId(), "Data loaders...", "Show help for the data loaders", wx.ITEM_NORMAL)
        mb_help.AppendItem(self.mb_data_loaders_help)
        wxglade_tmp_menu.AppendMenu(wx.NewId(), "Built-in Help", mb_help, "")
        self.mb_examples = wx.Menu()
        wxglade_tmp_menu.AppendMenu(wx.NewId(), "Examples", self.mb_examples, "")
        self.mb_misc_showman = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Show Manual...", "Show the manual", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.mb_misc_showman)
        self.mb_open_homepage = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Open Homepage...", "Open the homepage", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.mb_open_homepage)
        self.mb_misc_about = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "About...", "Show information about GenX", wx.ITEM_NORMAL)
        wxglade_tmp_menu.AppendItem(self.mb_misc_about)
        self.main_frame_menubar.Append(wxglade_tmp_menu, "Help ")
        self.SetMenuBar(self.main_frame_menubar)
        # Menu Bar end
        self.main_frame_statusbar = self.CreateStatusBar(3, 0)
        
        # Tool Bar
        self.main_frame_toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL|wx.TB_FLAT)
        self.SetToolBar(self.main_frame_toolbar)
        self.main_frame_toolbar.AddLabelTool(10001, "tb_new", (img.getnewBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "New model | Ctrl+N", "Create a new model | Ctrl+N")
        self.main_frame_toolbar.AddLabelTool(10002, "tb_open", (img.getopenBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Open | Ctrl+O", "Open an existing model | Ctrl+O")
        self.main_frame_toolbar.AddLabelTool(10003, "tb_save", (img.getsaveBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Save | Ctrl+S", "Save model to file | Ctrl+S")
        self.main_frame_toolbar.AddLabelTool(10004, "tb_simulate", (img.getsimulateBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Simulate | F9", "Simulate the model | F9")
        self.main_frame_toolbar.AddLabelTool(10005, "tb_start_fit", (img.getstart_fitBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Start fit | Ctrl+F", "Start fitting | Ctrl+F")
        self.main_frame_toolbar.AddLabelTool(10006, "tb_stop_fit", (img.getstop_fitBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Stop fit | Ctrl+H", "Stop fitting | Ctrl+H")
        self.main_frame_toolbar.AddLabelTool(10007, "tb_restart_fit", (img.getrestart_fitBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Restart fit | Ctrl+R", "Restart the fit | Ctrl+R")
        self.main_frame_toolbar.AddLabelTool(1008, "tb_calc_error_bars", (img.getcalc_error_barBitmap()), wx.NullBitmap, wx.ITEM_NORMAL, "Calculate errorbars", "Calculate errorbars")
        self.main_frame_toolbar.AddLabelTool(10009, "tb_zoom", (img.getzoomBitmap()), wx.NullBitmap, wx.ITEM_CHECK, "Zoom | Ctrl+Z", "Turn the zoom on/off  | Ctrl+Z")
        # Tool Bar end
        self.data_list = datalist.DataListControl(self.data_notebook_data, -1, self.config, status_text)
        self.label_2 = wx.StaticText(self.data_notebook_pane_2, -1, "  Data set: ")
        self.data_grid_choice = wx.Choice(self.data_notebook_pane_2, -1, choices=["test2", "test1"])
        self.static_line_1 = wx.StaticLine(self.data_notebook_pane_2, -1)
        self.data_grid = wx.grid.Grid(self.data_notebook_pane_2, -1, size=(1, 1))
        self.plot_data = plotpanel.DataPlotPanel(self.plot_notebook_data, config = self.config, config_name = 'data plot', )
        self.plot_fom = plotpanel.ErrorPlotPanel(self.plot_notebook_fom, config = self.config, config_name = 'fom plot', )
        self.plot_pars = plotpanel.ParsPlotPanel(self.plot_notebook_Pars, config = self.config, config_name = 'pars plot', )
        self.plot_fomscan = plotpanel.FomScanPlotPanel(self.plot_notebook_foms, config = self.config, config_name = 'fom scan plot', )
        self.paramter_grid = parametergrid.ParameterGrid(self.input_notebook_grid, self, )
        self.script_editor = wx.py.editwindow.EditWindow(self.input_notebook_script, -1)
        self.example_handler = help.ExampleHandler(self, self.mb_examples, _path + 'examples/')
        
        self.__set_properties()
        self.__do_layout()

        self.Bind(wx.EVT_MENU, self.eh_mb_new, self.mb_new)
        self.Bind(wx.EVT_MENU, self.eh_mb_open, self.mb_open)
        self.Bind(wx.EVT_MENU, self.eh_mb_save, self.mb_save)
        self.Bind(wx.EVT_MENU, self.eh_mb_saveas, self.mb_saveas)
        self.Bind(wx.EVT_MENU, self.eh_mb_import_data, self.mb_import_data)
        self.Bind(wx.EVT_MENU, self.eh_mb_import_table, self.mb_import_table)
        self.Bind(wx.EVT_MENU, self.eh_mb_import_script, self.mb_import_script)
        self.Bind(wx.EVT_MENU, self.eh_mb_export_data, self.mb_export_data)
        self.Bind(wx.EVT_MENU, self.eh_mb_export_table, self.mb_export_table)
        self.Bind(wx.EVT_MENU, self.eh_mb_export_script, self.mb_export_script)
        self.Bind(wx.EVT_MENU, self.eh_mb_print_plot, self.mb_print_plot)
        self.Bind(wx.EVT_MENU, self.eh_mb_print_grid, self.mb_print_grid)
        self.Bind(wx.EVT_MENU, self.eh_mb_print_script, self.mb_print_script)
        self.Bind(wx.EVT_MENU, self.eh_mb_quit, self.mb_quit)
        self.Bind(wx.EVT_MENU, self.eh_mb_copy_graph, self.mb_copy_graph)
        self.Bind(wx.EVT_MENU, self.eh_mb_copy_sim, self.mb_copy_sim)
        self.Bind(wx.EVT_MENU, self.eh_mb_copy_table, self.mb_copy_table)
        self.Bind(wx.EVT_MENU, self.eh_mb_findreplace, self.mb_findreplace)
        self.Bind(wx.EVT_MENU, self.eh_data_new_set, self.mb_new_data_set)
        self.Bind(wx.EVT_MENU, self.eh_data_delete, self.mb_data_delete)
        self.Bind(wx.EVT_MENU, self.eh_data_move_down, self.mb_data_move_down)
        self.Bind(wx.EVT_MENU, self.eh_data_move_up, self.mb_data_move_up)
        self.Bind(wx.EVT_MENU, self.eh_data_toggle_show, self.mb_toggle_show)
        self.Bind(wx.EVT_MENU, self.eh_data_toggle_use, self.mb_toggle_use)
        self.Bind(wx.EVT_MENU, self.eh_data_toggle_error, self.mb_toggle_error)
        self.Bind(wx.EVT_MENU, self.eh_data_calc, self.mb_toggle_calc)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_zoom, self.mb_view_zoom)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_zoomall, self.mb_view_zoomall)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_yscale_log, self.mb_view_yscale_log)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_yscale_linear, self.mb_view_yscale_lin)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_autoscale, self.mb_view_autoscale)
        self.Bind(wx.EVT_MENU, self.eh_mb_view_use_toggle_show, self.mb_use_toggle_show)
        self.Bind(wx.EVT_MENU, self.eh_tb_simulate, self.mb_fit_simulate)
        self.Bind(wx.EVT_MENU, self.eh_mb_fit_evaluate, self.mb_fit_evaluate)
        self.Bind(wx.EVT_MENU, self.eh_mb_fit_start, self.mb_fit_start)
        self.Bind(wx.EVT_MENU, self.eh_mb_fit_stop, self.mb_fit_stop)
        self.Bind(wx.EVT_MENU, self.eh_mb_fit_resume, self.mb_fit_resume)
        self.Bind(wx.EVT_MENU, self.eh_mb_fit_analyze, self.mb_fit_analyze)
        self.Bind(wx.EVT_MENU, self.eh_mb_set_opt, self.mb_set_opt)
        self.Bind(wx.EVT_MENU, self.eh_mb_set_dal, self.mb_set_dataloader)
        self.Bind(wx.EVT_MENU, self.eh_data_import, self.mb_set_import)
        self.Bind(wx.EVT_MENU, self.eh_data_plots, self.mb_set_dataplot)
        self.Bind(wx.EVT_MENU, self.eh_show_startup_dialog, self.mb_set_startup_profile)
        self.Bind(wx.EVT_MENU, self.eh_mb_models_help, self.mb_models_help)
        self.Bind(wx.EVT_MENU, self.eh_mb_fom_help, self.mb_fom_help)
        self.Bind(wx.EVT_MENU, self.eh_mb_plugins_help, self.mb_plugins_help)
        self.Bind(wx.EVT_MENU, self.eh_mb_data_loaders_help, self.mb_data_loaders_help)
        self.Bind(wx.EVT_MENU, self.eh_mb_misc_showman, self.mb_misc_showman)
        self.Bind(wx.EVT_MENU, self.eh_mb_misc_openhomepage, self.mb_open_homepage)
        self.Bind(wx.EVT_MENU, self.eh_mb_misc_about, self.mb_misc_about)
        self.Bind(wx.EVT_TOOL, self.eh_tb_new, id=10001)
        self.Bind(wx.EVT_TOOL, self.eh_tb_open, id=10002)
        self.Bind(wx.EVT_TOOL, self.eh_tb_save, id=10003)
        self.Bind(wx.EVT_TOOL, self.eh_tb_simulate, id=10004)
        self.Bind(wx.EVT_TOOL, self.eh_tb_start_fit, id=10005)
        self.Bind(wx.EVT_TOOL, self.eh_tb_stop_fit, id=10006)
        self.Bind(wx.EVT_TOOL, self.eh_tb_restart_fit, id=10007)
        self.Bind(wx.EVT_TOOL, self.eh_tb_calc_error_bars, id=1008)
        self.Bind(wx.EVT_TOOL, self.eh_tb_zoom, id=10009)
        self.Bind(wx.EVT_CHOICE, self.eh_data_grid_choice, self.data_grid_choice)
        self.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.eh_plot_page_changed, self.plot_notebook)
        # end wxGlade
        
        #### Begin Manual Config
        
        # Create objects needed
        # Set the style on the toolbar to
        # style=wx.TB_HORIZONTAL|wx.TB_FLAT
        #self.main_frame_fom_text = wx.StaticText(self.main_frame_toolbar, -1,\
        #    '        FOM: ', size = (200, -1))
        #font = wx.Font(15, wx.FONTFAMILY_DEFAULT, wx.NORMAL, wx.NORMAL)
        #self.main_frame_fom_text.SetFont(font)
        #self.main_frame_fom_text.SetLabel('        FOM: None')
        ##self.main_frame_fom_text.SetEditable(False)
        #self.main_frame_toolbar.AddSeparator()
        #self.main_frame_toolbar.AddControl(self.main_frame_fom_text)
        
        
        self.model = model.Model(config = self.config)
        self.solver_control = solvergui.SolverController(self, self.config)
    
        self.plugin_control = \
                add_on.PluginController(self, mb_set_plugins, self.config)
        
        # Bind all the events that are needed to occur when a new model has
        # been loaded
        # Update the parameter grid
        self.Bind(event_handlers.EVT_NEW_MODEL, self.paramter_grid.OnNewModel\
            , self)
        self.Bind(event_handlers.EVT_NEW_MODEL, \
            self.data_list.eh_external_new_model, self)
        # Update the script
        self.Bind(event_handlers.EVT_NEW_MODEL, \
            self.eh_new_model, self)
        # Event that the plot should respond to
        self.Bind(datalist.EVT_DATA_LIST, self.plot_data.OnDataListEvent,\
                    self.data_list.list_ctrl)
        self.Bind(datalist.EVT_DATA_LIST,\
            self.eh_external_update_data_grid_choice,\
            self.data_list.list_ctrl)
        self.Bind(datalist.EVT_DATA_LIST,\
            self.eh_external_update_data,\
            self.data_list.list_ctrl)
        
        self.Bind(event_handlers.EVT_SIM_PLOT, self.plot_data.OnSimPlotEvent,\
                    self)
        self.Bind(event_handlers.EVT_SIM_PLOT, self.eh_external_fom_value,\
                    self)
        # Update events from the solver
        self.Bind(solvergui.EVT_UPDATE_PLOT, self.eh_external_fom_value)
        self.Bind(solvergui.EVT_UPDATE_PLOT, self.plot_data.OnSolverPlotEvent)
        self.Bind(solvergui.EVT_UPDATE_PLOT, self.plot_fom.OnSolverPlotEvent)
        
        self.Bind(solvergui.EVT_SOLVER_UPDATE_TEXT, \
                            self.eh_ex_status_text)
        self.Bind(solvergui.EVT_UPDATE_PARAMETERS,\
                            self.paramter_grid.OnSolverUpdateEvent)
        self.Bind(solvergui.EVT_UPDATE_PARAMETERS,\
                            self.plot_pars.OnSolverParameterEvent)
        # For picking a point in a plot
        self.Bind(plotpanel.EVT_PLOT_POSITION,\
            self.eh_ex_point_pick)
        # This is needed to be able to create the events
        self.plot_data.SetCallbackWindow(self)
        self.plot_fom.SetCallbackWindow(self)
        self.plot_pars.SetCallbackWindow(self)
        self.plot_fomscan.SetCallbackWindow(self)
        self.Bind(plotpanel.EVT_PLOT_SETTINGS_CHANGE,\
                    self.eh_ex_plot_settings_changed)
                    
        # Binding events which means model changes
        self.Bind(parametergrid.EVT_PARAMETER_GRID_CHANGE,\
            self.eh_external_model_changed)
        self.Bind(wx.stc.EVT_STC_MODIFIED, self.eh_external_model_changed, \
            self.script_editor)
        self.Bind(datalist.EVT_DATA_LIST, self.eh_external_model_changed,\
                    self.data_list.list_ctrl)

        # Stuff for the find and replace functionallity
        self.findreplace_data = wx.FindReplaceData()
        # Make search down as default
        self.findreplace_data.SetFlags(1)
        self.findreplace_dlg = wx.FindReplaceDialog(self,\
                                                  self.findreplace_data,\
                                                  "Find & replace",\
                                                  wx.FR_REPLACEDIALOG)
        self.Bind(wx.EVT_FIND, self.eh_external_find)
        self.Bind(wx.EVT_FIND_NEXT, self.eh_external_find)
        self.Bind(wx.EVT_FIND_REPLACE, self.eh_external_find)
        self.Bind(wx.EVT_FIND_REPLACE_ALL, self.eh_external_find)
        self.Bind(wx.EVT_FIND_CLOSE, self.eh_external_find)
        
                    
        # Adding close event so I can take care of it...
        self.Bind(wx.EVT_CLOSE, self.eh_mb_quit)
        
        proj_func = lambda row: event_handlers.project_fom_parameter(self, row)
        scan_func = lambda row: event_handlers.scan_parameter(self, row)
        self.paramter_grid.SetFOMFunctions(proj_func, scan_func)
        
        # Initiializations..
        # To force an update of the menubar...
        self.plot_data.SetZoom(False)

        self.model.saved = True