Changes in / [225aca8:ae2a197] in sasview


Ignore:
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sasview/sasview.py

    r199bb42b r199bb42b  
    9191APP_NAME = 'SasView' 
    9292 
     93class SasViewApp(gui_manager.ViewApp): 
     94    """ 
     95    """ 
     96   
     97 
    9398class SasView(): 
    9499    """ 
     
    99104        """ 
    100105        #from gui_manager import ViewApp 
    101         self.gui = gui_manager.SasViewApp(0) 
     106        self.gui = SasViewApp(0) 
    102107        # Set the application manager for the GUI 
    103108        self.gui.set_manager(self) 
     
    121126        try: 
    122127            import sas.perspectives.pr as module 
    123             pr_plug = module.Plugin() 
     128            pr_plug = module.Plugin(standalone=False) 
    124129            self.gui.add_perspective(pr_plug) 
    125130        except: 
     
    130135        try: 
    131136            import sas.perspectives.invariant as module 
    132             invariant_plug = module.Plugin() 
     137            invariant_plug = module.Plugin(standalone=False) 
    133138            self.gui.add_perspective(invariant_plug) 
    134139        except: 
     
    140145        try: 
    141146            import sas.perspectives.calculator as module 
    142             calculator_plug = module.Plugin() 
     147            calculator_plug = module.Plugin(standalone=False) 
    143148            self.gui.add_perspective(calculator_plug) 
    144149        except: 
  • src/sas/guiframe/gui_manager.py

    r957af0d r957af0d  
    235235        Initialize the Frame object 
    236236        """ 
     237 
    237238        PARENT_FRAME.__init__(self, parent=parent, title=title, pos=pos, size=size) 
    238239        # title 
     
    363364                    frame.SetIcon(icon) 
    364365                except: 
    365                     logging.error("ViewerFrame.put_icon: could not set icon") 
     366                    pass 
    366367 
    367368    def get_client_size(self): 
     
    751752            self._toolbar.Realize() 
    752753 
     754 
    753755    def build_gui(self): 
    754756        """ 
     
    776778        # Append item from plugin under menu file if necessary 
    777779        self._populate_file_menu() 
     780 
    778781 
    779782        if not wx.VERSION_STRING >= '3.0.0.0': 
     
    819822        # Load panels 
    820823        self._load_panels() 
     824        self.set_default_perspective() 
    821825 
    822826    def SetStatusText(self, *args, **kwds): 
     
    927931                        if hasattr(module, "PLUGIN_ID"): 
    928932                            try: 
    929                                 plugins.append(module.Plugin()) 
     933                                plug = module.Plugin() 
     934                                if plug.set_default_perspective(): 
     935                                    self._current_perspective = plug 
     936                                plugins.append(plug) 
     937 
    930938                                msg = "Found plug-in: %s" % module.PLUGIN_ID 
    931939                                logging.info(msg) 
     
    15031511                for item in plugin.populate_file_menu(): 
    15041512                    m_name, m_hint, m_handler = item 
    1505                     wx_id = wx.NewId() 
    1506                     self._file_menu.Append(wx_id, m_name, m_hint) 
    1507                     wx.EVT_MENU(self, wx_id, m_handler) 
     1513                    id = wx.NewId() 
     1514                    self._file_menu.Append(id, m_name, m_hint) 
     1515                    wx.EVT_MENU(self, id, m_handler) 
    15081516                self._file_menu.AppendSeparator() 
    15091517 
    15101518        style1 = self.__gui_style & GUIFRAME.MULTIPLE_APPLICATIONS 
    15111519        if OPEN_SAVE_MENU: 
    1512             wx_id = wx.NewId() 
     1520            id = wx.NewId() 
    15131521            hint_load_file = "read all analysis states saved previously" 
    1514             self._save_appl_menu = self._file_menu.Append(wx_id, '&Open Project', hint_load_file) 
    1515             wx.EVT_MENU(self, wx_id, self._on_open_state_project) 
     1522            self._save_appl_menu = self._file_menu.Append(id, '&Open Project', hint_load_file) 
     1523            wx.EVT_MENU(self, id, self._on_open_state_project) 
    15161524 
    15171525        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
     
    15191527            hint_load_file = "Read a status files and load" 
    15201528            hint_load_file += " them into the analysis" 
    1521             wx_id = wx.NewId() 
    1522             self._save_appl_menu = self._file_menu.Append(wx_id, 
     1529            id = wx.NewId() 
     1530            self._save_appl_menu = self._file_menu.Append(id, 
    15231531                                                          '&Open Analysis', hint_load_file) 
    1524             wx.EVT_MENU(self, wx_id, self._on_open_state_application) 
     1532            wx.EVT_MENU(self, id, self._on_open_state_application) 
    15251533        if OPEN_SAVE_MENU: 
    15261534            self._file_menu.AppendSeparator() 
    1527             wx_id = wx.NewId() 
    1528             self._file_menu.Append(wx_id, '&Save Project', 
     1535            id = wx.NewId() 
     1536            self._file_menu.Append(id, '&Save Project', 
    15291537                                   'Save the state of the whole analysis') 
    1530             wx.EVT_MENU(self, wx_id, self._on_save_project) 
     1538            wx.EVT_MENU(self, id, self._on_save_project) 
    15311539        if style1 == GUIFRAME.MULTIPLE_APPLICATIONS: 
    1532             wx_id = wx.NewId() 
    1533             self._save_appl_menu = self._file_menu.Append(wx_id, \ 
     1540            id = wx.NewId() 
     1541            self._save_appl_menu = self._file_menu.Append(id, \ 
    15341542                '&Save Analysis', 'Save state of the current active analysis panel') 
    1535             wx.EVT_MENU(self, wx_id, self._on_save_application) 
     1543            wx.EVT_MENU(self, id, self._on_save_application) 
    15361544        if not sys.platform == 'darwin': 
    15371545            self._file_menu.AppendSeparator() 
    1538             wx_id = wx.NewId() 
    1539             self._file_menu.Append(wx_id, '&Quit', 'Exit') 
    1540             wx.EVT_MENU(self, wx_id, self.Close) 
     1546            id = wx.NewId() 
     1547            self._file_menu.Append(id, '&Quit', 'Exit') 
     1548            wx.EVT_MENU(self, id, self.Close) 
    15411549 
    15421550    def _add_menu_file(self): 
     
    17091717        """ 
    17101718        """ 
     1719        message = "" 
    17111720        log_msg = '' 
     1721        output = [] 
     1722        error_message = "" 
    17121723        basename = os.path.basename(path) 
    1713         _, extension = os.path.splitext(basename) 
     1724        root, extension = os.path.splitext(basename) 
    17141725        if extension.lower() not in EXTENSIONS: 
    17151726            log_msg = "File Loader cannot " 
     
    22132224            if hasattr(item, "post_init"): 
    22142225                item.post_init() 
     2226 
     2227    def set_default_perspective(self): 
     2228        """ 
     2229        Choose among the plugin the first plug-in that has 
     2230        "set_default_perspective" method and its return value is True will be 
     2231        as a default perspective when the welcome page is closed 
     2232        """ 
     2233        for item in self.plugins: 
     2234            if hasattr(item, "set_default_perspective"): 
     2235                if item.set_default_perspective(): 
     2236                    item.on_perspective(event=None) 
     2237                    return 
    22152238 
    22162239    def set_perspective(self, panels): 
     
    23912414            total_plot_list.append(theory_data) 
    23922415        for new_plot in total_plot_list: 
     2416            id = new_plot.id 
    23932417            for group_id in new_plot.list_group_id: 
    2394                 wx.PostEvent(self, NewPlotEvent(id=new_plot.id, 
     2418                wx.PostEvent(self, NewPlotEvent(id=id, 
    23952419                                                group_id=group_id, 
    23962420                                                action='remove')) 
    23972421                #remove res plot: Todo: improve 
    2398                 wx.CallAfter(self._remove_res_plot, new_plot.id) 
     2422                wx.CallAfter(self._remove_res_plot, id) 
    23992423        self._data_manager.delete_data(data_id=data_id, 
    24002424                                       theory_id=theory_id) 
     
    24312455            ext_num = dlg.GetFilterIndex() 
    24322456            if ext_num == 0: 
    2433                 ext_format = '.txt' 
     2457                format = '.txt' 
    24342458            else: 
    2435                 ext_format = '.xml' 
    2436             path = os.path.splitext(path)[0] + ext_format 
     2459                format = '.xml' 
     2460            path = os.path.splitext(path)[0] + format 
    24372461            mypath = os.path.basename(path) 
    24382462 
    24392463            #Instantiate a loader 
    24402464            loader = Loader() 
    2441             ext_format = ".txt" 
    2442             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2465            format = ".txt" 
     2466            if os.path.splitext(mypath)[1].lower() == format: 
    24432467                # Make sure the ext included in the file name 
    24442468                # especially on MAC 
    2445                 fName = os.path.splitext(path)[0] + ext_format 
     2469                fName = os.path.splitext(path)[0] + format 
    24462470                self._onsaveTXT(data, fName) 
    2447             ext_format = ".xml" 
    2448             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2471            format = ".xml" 
     2472            if os.path.splitext(mypath)[1].lower() == format: 
    24492473                # Make sure the ext included in the file name 
    24502474                # especially on MAC 
    2451                 fName = os.path.splitext(path)[0] + ext_format 
    2452                 loader.save(fName, data, ext_format) 
     2475                fName = os.path.splitext(path)[0] + format 
     2476                loader.save(fName, data, format) 
    24532477            try: 
    24542478                self._default_save_location = os.path.dirname(path) 
     
    25742598            ext_num = dlg.GetFilterIndex() 
    25752599            if ext_num == 0: 
    2576                 ext_format = '.dat' 
     2600                format = '.dat' 
    25772601            else: 
    2578                 ext_format = '' 
    2579             path = os.path.splitext(path)[0] + ext_format 
     2602                format = '' 
     2603            path = os.path.splitext(path)[0] + format 
    25802604            mypath = os.path.basename(path) 
    25812605 
     
    25832607            loader = Loader() 
    25842608 
    2585             ext_format = ".dat" 
    2586             if os.path.splitext(mypath)[1].lower() == ext_format: 
     2609            format = ".dat" 
     2610            if os.path.splitext(mypath)[1].lower() == format: 
    25872611                # Make sure the ext included in the file name 
    25882612                # especially on MAC 
    2589                 fileName = os.path.splitext(path)[0] + ext_format 
    2590                 loader.save(fileName, data, ext_format) 
     2613                fileName = os.path.splitext(path)[0] + format 
     2614                loader.save(fileName, data, format) 
    25912615            try: 
    25922616                self._default_save_location = os.path.dirname(path) 
     
    31823206 
    31833207 
    3184 class SasViewApp(wx.App): 
     3208class ViewApp(wx.App): 
    31853209    """ 
    3186     SasView application 
     3210    Toy application to test this Frame 
    31873211    """ 
    31883212    def OnInit(self): 
     
    32703294            if len(os.listdir(model_folder)) > 0: 
    32713295                try: 
    3272                     for filename in os.listdir(model_folder): 
    3273                         file_path = os.path.join(model_folder, filename) 
     3296                    for file in os.listdir(model_folder): 
     3297                        file_path = os.path.join(model_folder, file) 
    32743298                        if os.path.isfile(file_path): 
    32753299                            os.remove(file_path) 
     
    32903314        """ 
    32913315        #try to load file at the start 
    3292         self.open_file() 
     3316        try: 
     3317            self.open_file() 
     3318        except: 
     3319            raise 
    32933320        self.frame.build_gui() 
    32943321 
  • src/sas/guiframe/local_perspectives/data_loader/data_loader.py

    rf21d496 rf76bf17  
    4141class Plugin(PluginBase): 
    4242 
    43     def __init__(self): 
    44         PluginBase.__init__(self, name="DataLoader") 
     43    def __init__(self, standalone=False): 
     44        PluginBase.__init__(self, name="DataLoader", standalone=standalone) 
    4545        # Default location 
    4646        self._default_save_location = DEFAULT_OPEN_FOLDER 
  • src/sas/guiframe/local_perspectives/plotting/plotting.py

    rf21d496 rc039589  
    3636    """ 
    3737 
    38     def __init__(self): 
    39         PluginBase.__init__(self, name="Plotting") 
     38    def __init__(self, standalone=False): 
     39        PluginBase.__init__(self, name="Plotting", standalone=standalone) 
    4040 
    4141        ## Plot panels 
  • src/sas/guiframe/plugin_base.py

    rf21d496 r373d4ee  
    3434    """ 
    3535 
    36     def __init__(self, name="Test_plugin"): 
     36    def __init__(self, name="Test_plugin", standalone=True): 
    3737        """ 
    3838        Abstract class for gui_manager Plugins. 
     
    4242        ## Plug-in name. It will appear on the application menu. 
    4343        self.sub_menu = name 
     44        #standalone flag 
     45        self.standalone = standalone 
    4446        ## Reference to the parent window. Filled by get_panels() below. 
    4547        self.parent = None 
     
    261263        pass 
    262264 
     265    def set_default_perspective(self): 
     266        """ 
     267       Call back method that True to notify the parent that the current plug-in 
     268       can be set as default  perspective. 
     269       when returning False, the plug-in is not candidate for an automatic 
     270       default perspective setting 
     271        """ 
     272        if self.standalone: 
     273            return True 
     274        return False 
     275 
    263276    def set_state(self, state=None, datainfo=None):     
    264277        """ 
  • src/sas/perspectives/calculator/calculator.py

    rf21d496 r49ab5d7  
    3333    for calculator perspective 
    3434    """ 
    35     def __init__(self): 
    36         PluginBase.__init__(self, name="Calculator") 
     35    def __init__(self, standalone=True): 
     36        PluginBase.__init__(self, name="Calculator", standalone=standalone) 
    3737        # Log startup 
    3838        logging.info("Calculator plug-in started") 
  • src/sas/perspectives/fitting/fitpage.py

    r098f3d2 r098f3d2  
    268268        weighting_box.Add(sizer_weighting) 
    269269 
     270        sizer_fit = wx.GridSizer(2, 5, 2, 6) 
     271 
    270272        # combobox for smear2d accuracy selection 
    271273        self.smear_accuracy = wx.ComboBox(self, -1, size=(50, -1), 
     
    280282 
    281283        #Fit button 
    282         self.btFit = wx.Button(self, wx.NewId(), 'Fit') 
     284        self.btFit = wx.Button(self, wx.NewId(), 'Fit', size=(88, 25)) 
    283285        self.default_bt_colour = self.btFit.GetDefaultAttributes() 
    284286        self.btFit.Bind(wx.EVT_BUTTON, self._onFit, id=self.btFit.GetId()) 
     
    286288 
    287289        #General Help button 
    288         self.btFitHelp = wx.Button(self, -1, 'Help') 
    289         self.btFitHelp.SetToolTipString("General fitting help.") 
     290        self.btFitHelp = wx.Button(self, -1, 'HELP') 
     291        self.btFitHelp.SetToolTipString("General Fitting Help.") 
    290292        self.btFitHelp.Bind(wx.EVT_BUTTON, self._onFitHelp) 
    291293         
     
    301303        self.btSmearHelp = wx.Button(self, -1, '?', style=wx.BU_EXACTFIT,\ 
    302304                                     size=size_q) 
    303         self.btSmearHelp.SetToolTipString("Resolution smearing help.") 
     305        self.btSmearHelp.SetToolTipString("Resolution Smearing Help.") 
    304306        self.btSmearHelp.Bind(wx.EVT_BUTTON, self._onSmearHelp) 
    305307         
     
    360362        self.disable_smearer.SetValue(True) 
    361363 
     364        # add 4 types of smearing to the sizer 
     365        # Note from June 14, 2015 
     366        # removed the extra (10,10) spaces to make room for help.  Actually 
     367        # don't see the need for those anyway as the wx.LEFT, xx should take 
     368        # care of spacing anyway though it does not seem to work for some 
     369        # reason.  Currently leaving as we are in "code freeze" only making 
     370        # minimal changes necessary for release 3.1.  We probably want to clean 
     371        # up the whole fitpage (and basepage and fitpanel etc) eventually. 
     372        #                          ---- PDB 
    362373        sizer_smearer.Add(self.disable_smearer, 0, wx.LEFT, 10) 
     374#        sizer_smearer.Add((10, 10)) 
    363375        sizer_smearer.Add(self.enable_smearer) 
     376#        sizer_smearer.Add((10, 10)) 
    364377        sizer_smearer.Add(self.pinhole_smearer) 
     378#        sizer_smearer.Add((10, 10)) 
    365379        sizer_smearer.Add(self.slit_smearer) 
     380#        sizer_smearer.Add((10, 10)) 
    366381        sizer_smearer.Add(self.btSmearHelp) 
    367382        sizer_smearer.Add((10, 10)) 
     
    382397 
    383398        # Update and Draw button 
    384         self.draw_button = wx.Button(self, wx.NewId(), 'Compute') 
     399        self.draw_button = wx.Button(self, wx.NewId(), 
     400                                     'Compute', size=(88, 24)) 
    385401        self.draw_button.Bind(wx.EVT_BUTTON, \ 
    386402                              self._onDraw, id=self.draw_button.GetId()) 
     
    398414        box_description_1 = wx.StaticText(self, -1, '   Chi2/Npts') 
    399415        box_description_2 = wx.StaticText(self, -1, 'Npts(Fit)') 
     416        #box_description_3 = wx.StaticText(self, -1, 'Total Npts') 
     417        #box_description_3.SetToolTipString( \ 
     418        #                        " Total Npts : total number of data points") 
     419 
     420        sizer_fit.Add(box_description_1, 0, 0) 
     421        sizer_fit.Add(box_description_2, 0, 0) 
     422        sizer_fit.Add(self.points_sizer, 0, 0) 
     423        #sizer_fit.Add(box_description_3, 0, 0) 
     424        sizer_fit.Add(self.draw_button, 0, 0) 
     425        sizer_fit.Add((-1,5)) 
     426        sizer_fit.Add(self.tcChi, 0, 0) 
     427        sizer_fit.Add(self.Npts_fit, 0, 0) 
     428        sizer_fit.Add(self.Npts_total, 0, 0) 
     429        sizer_fit.Add(self.btFit, 0, 0) 
     430        sizer_fit.Add(self.btFitHelp, 0, 0) 
    400431 
    401432        # StaticText for smear 
     
    545576        self.qmin.Bind(wx.EVT_TEXT, self.on_qrange_text) 
    546577        self.qmax.Bind(wx.EVT_TEXT, self.on_qrange_text) 
    547         wx_id = wx.NewId() 
    548         self.reset_qrange = wx.Button(self, wx_id, 'Reset') 
    549  
    550         self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=wx_id) 
     578        id = wx.NewId() 
     579        self.reset_qrange = wx.Button(self, id, 'Reset', size=(77, 20)) 
     580 
     581        self.reset_qrange.Bind(wx.EVT_BUTTON, self.on_reset_clicked, id=id) 
    551582        self.reset_qrange.SetToolTipString("Reset Q range to the default") 
    552583 
    553         sizer = wx.GridSizer(5, 5, 2, 6) 
    554  
    555         self.btEditMask = wx.Button(self, wx.NewId(), 'Editor') 
     584        sizer = wx.GridSizer(2, 4, 2, 6) 
     585 
     586        self.btEditMask = wx.Button(self, wx.NewId(), 'Editor', size=(88, 23)) 
    556587        self.btEditMask.Bind(wx.EVT_BUTTON, self._onMask, 
    557588                             id=self.btEditMask.GetId()) 
     
    563594        sizer.Add(wx.StaticText(self, -1, ' Max[1/A]')) 
    564595        sizer.Add(self.EditMask_title) 
    565         sizer.Add((-1,5)) 
    566  
    567596        sizer.Add(self.reset_qrange) 
    568597        sizer.Add(self.qmin) 
    569598        sizer.Add(self.qmax) 
     599        #sizer.Add(self.theory_npts_tcrtl) 
    570600        sizer.Add(self.btEditMask) 
    571         sizer.Add((-1,5)) 
    572  
    573         sizer.AddMany(5*[(-1,5)]) 
    574  
    575         sizer.Add(box_description_1, 0, 0) 
    576         sizer.Add(box_description_2, 0, 0) 
    577         sizer.Add(self.points_sizer, 0, 0) 
    578         sizer.Add(self.draw_button, 0, 0) 
    579         sizer.Add((-1,5)) 
    580          
    581         sizer.Add(self.tcChi, 0, 0) 
    582         sizer.Add(self.Npts_fit, 0, 0) 
    583         sizer.Add(self.Npts_total, 0, 0) 
    584         sizer.Add(self.btFit, 0, 0) 
    585         sizer.Add(self.btFitHelp, 0, 0) 
    586          
    587601        boxsizer_range.Add(sizer_chi2) 
     602        boxsizer_range.Add((10, 10)) 
    588603        boxsizer_range.Add(sizer) 
     604 
     605        boxsizer_range.Add((10, 15)) 
     606        boxsizer_range.Add(sizer_fit) 
    589607        if is_2Ddata: 
    590608            self.btEditMask.Enable() 
  • src/sas/perspectives/fitting/fitting.py

    r098f3d2 r098f3d2  
    6161    Fitting plugin is used to perform fit 
    6262    """ 
    63     def __init__(self): 
    64         PluginBase.__init__(self, name="Fitting") 
     63    def __init__(self, standalone=False): 
     64        PluginBase.__init__(self, name="Fitting", standalone=standalone) 
    6565 
    6666        #list of panel to send to guiframe 
     
    221221        Get the python editor panel 
    222222        """ 
    223         event_id = event.GetId() 
    224         label = self.edit_menu.GetLabel(event_id) 
     223        id = event.GetId() 
     224        label = self.edit_menu.GetLabel(id) 
    225225        from sas.perspectives.calculator.pyconsole import PyConsole 
    226226        filename = os.path.join(models.find_plugins_dir(), label) 
     
    236236        Delete custom model file 
    237237        """ 
    238         event_id = event.GetId() 
    239         label = self.delete_menu.GetLabel(event_id) 
     238        id = event.GetId() 
     239        label = self.delete_menu.GetLabel(id) 
    240240        toks = os.path.splitext(label) 
    241241        path = os.path.join(models.find_plugins_dir(), toks[0]) 
     
    256256                #                                      info='warning')) 
    257257            else: 
    258                 self.delete_menu.Delete(event_id) 
     258                self.delete_menu.Delete(id) 
    259259                for item in self.edit_menu.GetMenuItems(): 
    260260                    if item.GetLabel() == label: 
     
    272272        Edit summodel template and make one 
    273273        """ 
    274         event_id = event.GetId() 
     274        id = event.GetId() 
    275275        model_manager = models.ModelManager() 
    276276        model_list = model_manager.get_model_name_list() 
     
    290290            self.new_model_frame.Show(True) 
    291291        else: 
    292             event_id = event.GetId() 
     292            id = event.GetId() 
    293293            dir_path = models.find_plugins_dir() 
    294294            title = "New Custom Model Function" 
     
    332332        Set list of the edit model menu labels 
    333333        """ 
    334         wx_id = wx.NewId() 
     334        id = wx.NewId() 
    335335        #new_model_menu = wx.Menu() 
    336         self.edit_model_menu.Append(wx_id, 'New', 
     336        self.edit_model_menu.Append(id, 'New', 
    337337                                   'Add a new model function') 
    338         wx.EVT_MENU(owner, wx_id, self.make_new_model) 
    339         wx_id = wx.NewId() 
    340         self.edit_model_menu.Append(wx_id, 'Sum|Multi(p1, p2)', 
     338        wx.EVT_MENU(owner, id, self.make_new_model) 
     339        id = wx.NewId() 
     340        self.edit_model_menu.Append(id, 'Sum|Multi(p1, p2)', 
    341341                                    'Sum of two model functions') 
    342         wx.EVT_MENU(owner, wx_id, self.make_sum_model) 
     342        wx.EVT_MENU(owner, id, self.make_sum_model) 
    343343        e_id = wx.NewId() 
    344344        self.edit_menu = wx.Menu() 
     
    376376                        has_file = True 
    377377                if not has_file: 
    378                     wx_id = wx.NewId() 
    379                     submenu.Append(wx_id, name) 
    380                     wx.EVT_MENU(owner, wx_id, menu) 
     378                    id = wx.NewId() 
     379                    submenu.Append(id, name) 
     380                    wx.EVT_MENU(owner, id, menu) 
    381381                    has_file = False 
    382382 
     
    397397        Create a page to access simultaneous fit option 
    398398        """ 
    399         event_id = event.GetId() 
     399        id = event.GetId() 
    400400        caption = "Const & Simul Fit" 
    401401        page = self.sim_page 
    402         if event_id == self.id_batchfit: 
     402        if id == self.id_batchfit: 
    403403            caption = "Combined Batch" 
    404404            page = self.batch_page 
     
    719719        for uid, value in self.page_finder.iteritems(): 
    720720            if uid != sim_page_id and uid != self.batch_page.uid: 
    721                 model_list = value.get_model() 
    722                 model = model_list[0] 
     721                list = value.get_model() 
     722                model = list[0] 
    723723                if model.name == modelname: 
    724724                    value.set_model_param(names, values) 
     
    15681568        """ 
    15691569        if event.panel is not None: 
     1570            new_panel = event.panel 
    15701571            self.slicer_panels.append(event.panel) 
    15711572            # Set group ID if available 
     
    16511652            #find if this theory was already plotted and replace that plot given 
    16521653            #the same id 
    1653             self.page_finder[page_id].get_theory_data(fid=data.id) 
     1654            theory_data = self.page_finder[page_id].get_theory_data(fid=data.id) 
    16541655 
    16551656            if data.is_data: 
  • src/sas/perspectives/invariant/invariant.py

    rf21d496 r824e488  
    3333    """ 
    3434 
    35     def __init__(self): 
    36         PluginBase.__init__(self, name="Invariant") 
     35    def __init__(self, standalone=False): 
     36        PluginBase.__init__(self, name="Invariant", standalone=standalone) 
    3737 
    3838        # dictionary containing data name and error on dy of that data 
  • src/sas/perspectives/pr/inversion_panel.py

    rf21d496 r3db44fb  
    3535    oscillation_max = 1.5 
    3636 
    37     def __init__(self, parent, id=-1, plots=None, **kwargs): 
     37    def __init__(self, parent, id=-1, plots=None, standalone=False, **kwargs): 
    3838        """ 
    3939        """ 
     
    8383        ## Data manager 
    8484        self._manager = None 
     85        ## Standalone flage 
     86        self.standalone = standalone 
    8587        ## Default file location for save 
    8688        self._default_save_location = os.getcwd() 
  • src/sas/perspectives/pr/pr.py

    rf21d496 rc1c14ba  
    5454    DEFAULT_DMAX = 140.0 
    5555 
    56     def __init__(self): 
    57         PluginBase.__init__(self, name="Pr Inversion") 
     56    def __init__(self, standalone=True): 
     57        PluginBase.__init__(self, name="Pr Inversion", standalone=standalone) 
    5858        ## Simulation window manager 
    5959        self.simview = None 
     
    9494        ## Number of P(r) points to display on the output plot 
    9595        self._pr_npts = 51 
     96        ## Flag to let the plug-in know that it is running standalone 
     97        self.standalone = standalone 
    9698        self._normalize_output = False 
    9799        self._scale_output_unity = False 
     
    621623            return [] 
    622624        elif item.id == graph.selected_plottable: 
    623             if issubclass(item.__class__, Data1D): 
     625            if not self.standalone and issubclass(item.__class__, Data1D): 
    624626                return [["Compute P(r)", 
    625627                         "Compute P(r) from distribution", 
     
    12361238        self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 
    12371239        self.control_panel = InversionControl(self.frame, -1, 
    1238                                               style=wx.RAISED_BORDER) 
     1240                                              style=wx.RAISED_BORDER, 
     1241                                              standalone=self.standalone) 
    12391242        self.frame.set_panel(self.control_panel) 
    12401243        self._frame_set_helper() 
     
    13141317            [Somehow openGL needs this call] 
    13151318        """ 
    1316         pass 
     1319        if self.standalone: 
     1320            self.parent.set_perspective(self.perspective) 
Note: See TracChangeset for help on using the changeset viewer.