Changeset cfc7f37 in sasview


Ignore:
Timestamp:
Oct 3, 2018 10:11:00 AM (5 years ago)
Author:
smk78
Branches:
master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, unittest-saveload
Children:
fa053ff7
Parents:
22bcc5a (diff), db24ec1 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of https://github.com/SasView/sasview.git

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/perspectives/fitting/fitpage.py

    rdabcaf7 rba1c145  
    33    fitting  a model and one data 
    44""" 
     5from __future__ import print_function 
     6 
    57import sys 
    68import wx 
     
    12551257        if saved_pars: 
    12561258            self.get_paste_params(saved_pars) 
     1259 
     1260        # Make sure the model parameters correspond to the fit parameters 
     1261        self._update_paramv_on_fit() 
    12571262 
    12581263        if event is not None: 
  • src/sas/sasgui/perspectives/fitting/fitting.py

    raf7d2e5 raba4559  
    339339        Update custom model list in the fitpage combo box 
    340340        """ 
    341         custom_model = 'Plugin Models' 
    342341        try: 
    343342            # Update edit menus 
     
    347346            if not new_pmodel_list: 
    348347                return 
    349             # Set the new plugin model list for all fit pages 
     348 
     349            # Redraws to a page not in focus are showing up as if they are 
     350            # in the current page tab. 
     351            current_page_index = self.fit_panel.GetSelection() 
     352            current_page = self.fit_panel.GetCurrentPage() 
     353            last_drawn_page = current_page 
     354 
     355            # Set the new plugin model list for all fit pages; anticipating 
     356            # categories, the updated plugin may be in either the form factor 
     357            # or the structure factor combo boxes 
    350358            for uid, page in self.fit_panel.opened_pages.iteritems(): 
    351                 if hasattr(page, "formfactorbox"): 
    352                     page.model_list_box = new_pmodel_list 
    353                     mod_cat = page.categorybox.GetStringSelection() 
    354                     if mod_cat == custom_model: 
    355                         box = page.formfactorbox 
    356                         model_name = box.GetValue() 
    357                         model = (box.GetClientData(box.GetCurrentSelection()) 
    358                                  if model_name else None) 
    359                         page._show_combox_helper() 
    360                         new_index = box.FindString(model_name) 
    361                         new_model = (box.GetClientData(new_index) 
    362                                      if new_index >= 0 else None) 
    363                         if new_index >= 0: 
    364                             box.SetStringSelection(model_name) 
    365                         else: 
    366                             box.SetStringSelection('') 
    367                         if model and new_model != model: 
    368                             page._on_select_model(keep_pars=True) 
    369                     if hasattr(page, "structurebox"): 
    370                         selected_name = page.structurebox.GetStringSelection() 
    371  
    372                         page.structurebox.Clear() 
    373                         page.initialize_combox() 
    374  
    375                         index = page.structurebox.FindString(selected_name) 
    376                         if index == -1: 
    377                             index = 0 
    378                         page.structurebox.SetSelection(index) 
    379                         page._on_select_model() 
     359                pbox = getattr(page, "formfactorbox", None) 
     360                sbox = getattr(page, "structurebox", None) 
     361                if pbox is None: 
     362                    continue 
     363 
     364                # Set the new model list for the page 
     365                page.model_list_box = new_pmodel_list 
     366 
     367                # Grab names of the P and S models from the page.  Need to do 
     368                # this before resetting the form factor box since that clears 
     369                # the structure factor box. 
     370                old_struct = old_form = None 
     371                form_name = pbox.GetValue() 
     372                struct_name = sbox.GetStringSelection() 
     373                if form_name: 
     374                    old_form = pbox.GetClientData(pbox.GetCurrentSelection()) 
     375                if struct_name: 
     376                    old_struct = sbox.GetClientData(sbox.GetCurrentSelection()) 
     377 
     378                # Reset form factor combo box.  We are doing this for all 
     379                # categories not just plugins since eventually the category 
     380                # manager will allow plugin models to be anywhere. 
     381                page._show_combox_helper() 
     382                form_index = pbox.FindString(form_name) 
     383                pbox.SetSelection(form_index) 
     384                new_form = (pbox.GetClientData(form_index) 
     385                            if form_index != wx.NOT_FOUND else None) 
     386                #print("form: %r"%form_name, old_form, new_form) 
     387 
     388                # Reset structure factor combo box; even if the model list 
     389                # hasn't changed, the model may have.  Show the structure 
     390                # factor combobox if the selected model is a form factor. 
     391                sbox.Clear() 
     392                page.initialize_combox() 
     393                if new_form is not None and getattr(new_form, 'is_form_factor', False): 
     394                    sbox.Show() 
     395                    sbox.Enable() 
     396                    page.text2.Show() 
     397                    page.text2.Enable() 
     398                struct_index = sbox.FindString(struct_name) 
     399                sbox.SetSelection(struct_index) 
     400                new_struct = (sbox.GetClientData(struct_index) 
     401                              if struct_index != wx.NOT_FOUND else None) 
     402                #print("struct: %r"%struct_name, old_struct, new_struct) 
     403 
     404                # Update the page if P or S has changed 
     405                if old_form != new_form or old_struct != new_struct: 
     406                    #print("triggering model update") 
     407                    page._on_select_model(keep_pars=True) 
     408                    last_drawn_page = page 
     409 
     410            # If last drawn is not the current, then switch the current to the 
     411            # last drawn then switch back.  Very ugly. 
     412            if last_drawn_page != current_page: 
     413                for page_index in range(self.fit_panel.PageCount): 
     414                    if self.fit_panel.GetPage(page_index) == last_drawn_page: 
     415                        self.fit_panel.SetSelection(page_index) 
     416                        break 
     417                self.fit_panel.SetSelection(current_page_index) 
     418 
    380419        except Exception: 
    381420            logger.error("update_custom_combo: %s", sys.exc_value) 
  • docs/sphinx-docs/source/user/RELEASE.rst

    r9849f8a r22bcc5a  
    830830     and so on.  
    831831 
     832We are also aware of an issue that manifests itself if you click Compute  
     833or Fit in a FitPage containing 2D data with with the magnetic parameters  
     834turned on. The FitPage may become unresponsive if the model is changed. 
     835 
     836 * if this occurs, try gaining input focus elsewhere; the FitPage may recover. 
     837 
    8328384.1.x- All systems 
    833839------------------ 
Note: See TracChangeset for help on using the changeset viewer.