Changeset f21d496 in sasview for src


Ignore:
Timestamp:
Jul 2, 2015 11:13:55 AM (9 years ago)
Author:
Doucet, Mathieu <doucetm@…>
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
78f75d02
Parents:
3a5f7c8
Message:

Cleaning up old "standalone" code

Location:
src/sas
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • src/sas/guiframe/gui_manager.py

    rf7d2f4a rf21d496  
    818818        # Load panels 
    819819        self._load_panels() 
    820         self.set_default_perspective() 
    821820 
    822821    def SetStatusText(self, *args, **kwds): 
     
    927926                        if hasattr(module, "PLUGIN_ID"): 
    928927                            try: 
    929                                 plug = module.Plugin() 
    930                                 if plug.set_default_perspective(): 
    931                                     self._current_perspective = plug 
    932                                 plugins.append(plug) 
    933  
     928                                plugins.append(module.Plugin()) 
    934929                                msg = "Found plug-in: %s" % module.PLUGIN_ID 
    935930                                logging.info(msg) 
     
    21992194                item.post_init() 
    22002195 
    2201     def set_default_perspective(self): 
    2202         """ 
    2203         Choose among the plugin the first plug-in that has 
    2204         "set_default_perspective" method and its return value is True will be 
    2205         as a default perspective when the welcome page is closed 
    2206         """ 
    2207         for item in self.plugins: 
    2208             if hasattr(item, "set_default_perspective"): 
    2209                 if item.set_default_perspective(): 
    2210                     item.on_perspective(event=None) 
    2211                     return 
    2212  
    22132196    def set_perspective(self, panels): 
    22142197        """ 
  • src/sas/guiframe/local_perspectives/data_loader/data_loader.py

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

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

    r373d4ee rf21d496  
    3434    """ 
    3535 
    36     def __init__(self, name="Test_plugin", standalone=True): 
     36    def __init__(self, name="Test_plugin"): 
    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 
    4644        ## Reference to the parent window. Filled by get_panels() below. 
    4745        self.parent = None 
     
    263261        pass 
    264262 
    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  
    276263    def set_state(self, state=None, datainfo=None):     
    277264        """ 
  • src/sas/perspectives/calculator/calculator.py

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

    re1442d4 rf21d496  
    6161    Fitting plugin is used to perform fit 
    6262    """ 
    63     def __init__(self, standalone=False): 
    64         PluginBase.__init__(self, name="Fitting", standalone=standalone) 
     63    def __init__(self): 
     64        PluginBase.__init__(self, name="Fitting") 
    6565 
    6666        #list of panel to send to guiframe 
     
    221221        Get the python editor panel 
    222222        """ 
    223         id = event.GetId() 
    224         label = self.edit_menu.GetLabel(id) 
     223        event_id = event.GetId() 
     224        label = self.edit_menu.GetLabel(event_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         id = event.GetId() 
    239         label = self.delete_menu.GetLabel(id) 
     238        event_id = event.GetId() 
     239        label = self.delete_menu.GetLabel(event_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(id) 
     258                self.delete_menu.Delete(event_id) 
    259259                for item in self.edit_menu.GetMenuItems(): 
    260260                    if item.GetLabel() == label: 
     
    272272        Edit summodel template and make one 
    273273        """ 
    274         id = event.GetId() 
     274        event_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             id = event.GetId() 
     292            event_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         id = wx.NewId() 
     334        wx_id = wx.NewId() 
    335335        #new_model_menu = wx.Menu() 
    336         self.edit_model_menu.Append(id, 'New', 
     336        self.edit_model_menu.Append(wx_id, 'New', 
    337337                                   'Add a new model function') 
    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)', 
     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)', 
    341341                                    'Sum of two model functions') 
    342         wx.EVT_MENU(owner, id, self.make_sum_model) 
     342        wx.EVT_MENU(owner, wx_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                     id = wx.NewId() 
    379                     submenu.Append(id, name) 
    380                     wx.EVT_MENU(owner, id, menu) 
     378                    wx_id = wx.NewId() 
     379                    submenu.Append(wx_id, name) 
     380                    wx.EVT_MENU(owner, wx_id, menu) 
    381381                    has_file = False 
    382382 
     
    397397        Create a page to access simultaneous fit option 
    398398        """ 
    399         id = event.GetId() 
     399        event_id = event.GetId() 
    400400        caption = "Const & Simul Fit" 
    401401        page = self.sim_page 
    402         if id == self.id_batchfit: 
     402        if event_id == self.id_batchfit: 
    403403            caption = "Combined Batch" 
    404404            page = self.batch_page 
     
    516516        selected_data_list = [] 
    517517        if self.batch_on: 
    518             page = self.add_fit_page(data=data_list) 
     518            self.add_fit_page(data=data_list) 
    519519        else: 
    520520            if len(data_list) > MAX_NBR_DATA: 
     
    537537                        if group_id not in data.list_group_id: 
    538538                            data.list_group_id.append(group_id) 
    539                         page = self.add_fit_page(data=[data]) 
     539                        self.add_fit_page(data=[data]) 
    540540            except: 
    541541                msg = "Fitting Set_data: " + str(sys.exc_value) 
     
    715715        for uid, value in self.page_finder.iteritems(): 
    716716            if uid != sim_page_id and uid != self.batch_page.uid: 
    717                 list = value.get_model() 
    718                 model = list[0] 
     717                model_list = value.get_model() 
     718                model = model_list[0] 
    719719                if model.name == modelname: 
    720720                    value.set_model_param(names, values) 
     
    15641564        """ 
    15651565        if event.panel is not None: 
    1566             new_panel = event.panel 
    15671566            self.slicer_panels.append(event.panel) 
    15681567            # Set group ID if available 
     
    16481647            #find if this theory was already plotted and replace that plot given 
    16491648            #the same id 
    1650             theory_data = self.page_finder[page_id].get_theory_data(fid=data.id) 
     1649            self.page_finder[page_id].get_theory_data(fid=data.id) 
    16511650 
    16521651            if data.is_data: 
  • src/sas/perspectives/invariant/invariant.py

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

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

    rc1c14ba rf21d496  
    5454    DEFAULT_DMAX = 140.0 
    5555 
    56     def __init__(self, standalone=True): 
    57         PluginBase.__init__(self, name="Pr Inversion", standalone=standalone) 
     56    def __init__(self): 
     57        PluginBase.__init__(self, name="Pr Inversion") 
    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 
    9896        self._normalize_output = False 
    9997        self._scale_output_unity = False 
     
    623621            return [] 
    624622        elif item.id == graph.selected_plottable: 
    625             if not self.standalone and issubclass(item.__class__, Data1D): 
     623            if issubclass(item.__class__, Data1D): 
    626624                return [["Compute P(r)", 
    627625                         "Compute P(r) from distribution", 
     
    12381236        self.frame = MDIFrame(self.parent, None, 'None', (100, 200)) 
    12391237        self.control_panel = InversionControl(self.frame, -1, 
    1240                                               style=wx.RAISED_BORDER, 
    1241                                               standalone=self.standalone) 
     1238                                              style=wx.RAISED_BORDER) 
    12421239        self.frame.set_panel(self.control_panel) 
    12431240        self._frame_set_helper() 
     
    13171314            [Somehow openGL needs this call] 
    13181315        """ 
    1319         if self.standalone: 
    1320             self.parent.set_perspective(self.perspective) 
     1316        pass 
Note: See TracChangeset for help on using the changeset viewer.