def Show(self): ''' Overiding the default method since any resizing has to come AFTER the calls to Show ''' wx.Frame.Show(self) if os.name == 'mac' or os.name == 'posix' or os.name == '': self.Maximize() self.ver_splitter.SetSashPosition(self.GetSizeTuple()[0]/4.) self.hor_splitter.SetSashPosition(self.GetSizeTuple()[1]*5.5/10.) else: size = wx.DisplaySize() #print size self.SetSize((size[0]*3./4., size[1]*3./4.)) #print self.GetSize() self.ver_splitter.SetSashPosition(self.GetSizeTuple()[0]/3.) self.hor_splitter.SetSashPosition(self.GetSizeTuple()[1]*6.0/10.) self.Centre() ## Begin Manual Config #Gravity sets how much the upper/left window is resized default 0 self.hor_splitter.SetSashGravity(0.75) #self.plugin_control.LoadDefaultPlugins() #self.Maximize() ## End Manual Config event_handlers.new(self, None)
def eh_tb_new(self, event): # wxGlade: MainFrame.<event_handler> #event.Skip() event_handlers.new(self, event)
def eh_mb_new(self, event): # wxGlade: MainFrame.<event_handler> event_handlers.new(self, event)
def __init__(self, *args, **kwds): self.config = io.Config() 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) # 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", "Creates 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", "Opens 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", "Saves 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...", "Saves 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...\tAlt+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...", "Prints the grid", wx.ITEM_NORMAL) mb_print.AppendItem(self.mb_print_grid) self.mb_print_script = wx.MenuItem(mb_print, wx.NewId(), "Print Script...", "Prints 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", "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", "Appends 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", "Deletes the selected data sets", 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", "Moves 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 set", 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", "OPens 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 yscale 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", "Sets 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 shold be toggled or selcted 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", "Resumes fitting without reinitilazation 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.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 Help...", "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 Help", "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 Helps...", "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 Help...", "Show help for the data loaders", wx.ITEM_NORMAL) mb_help.AppendItem(self.mb_data_loaders_help) wxglade_tmp_menu.AppendMenu(wx.NewId(), "Help", mb_help, "") self.mb_misc_showman = wx.MenuItem(wxglade_tmp_menu, wx.NewId(), "Open 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...", "Shows information about GenX", wx.ITEM_NORMAL) wxglade_tmp_menu.AppendItem(self.mb_misc_about) self.main_frame_menubar.Append(wxglade_tmp_menu, "Misc") 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 zoom on/off | Ctrl+Z") # Tool Bar end self.ver_splitter = wx.SplitterWindow(self, -1, style=wx.SP_3D|wx.SP_BORDER) 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_data = wx.Panel(self.data_notebook, -1) self.data_list = datalist.DataListControl(self.data_notebook_data, -1, self.config, status_text) self.data_notebook_pane_2 = wx.Panel(self.data_notebook, -1) 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.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.plot_panel = wx.Panel(self.hor_splitter, -1) self.plot_notebook = wx.Notebook(self.plot_panel, -1, style=wx.NB_BOTTOM) self.plot_notebook_data = wx.Panel(self.plot_notebook, -1) self.plot_data = plotpanel.DataPlotPanel(self.plot_notebook_data, config = self.config, config_name = 'data plot', ) self.plot_notebook_fom = wx.Panel(self.plot_notebook, -1) self.plot_fom = plotpanel.ErrorPlotPanel(self.plot_notebook_fom, config = self.config, config_name = 'fom plot', ) self.plot_notebook_Pars = wx.Panel(self.plot_notebook, -1) self.plot_pars = plotpanel.ParsPlotPanel(self.plot_notebook_Pars, config = self.config, config_name = 'pars plot', ) self.plot_notebook_foms = wx.Panel(self.plot_notebook, -1) self.plot_fomscan = plotpanel.FomScanPlotPanel(self.plot_notebook_foms, config = self.config, config_name = 'fom scan plot', ) 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_grid = wx.Panel(self.input_notebook, -1) self.paramter_grid = parametergrid.ParameterGrid(self.input_notebook_grid, self, ) self.input_notebook_script = wx.Panel(self.input_notebook, -1) self.script_editor = wx.py.editwindow.EditWindow(self.input_notebook_script, -1) 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_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_UPDATE_PLOT, self.plugin_control.OnFittingUpdate) 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) event_handlers.new(self, None)