Changeset f22b43c in sasview


Ignore:
Timestamp:
Oct 10, 2016 3:29:45 PM (7 years ago)
Author:
krzywon
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, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
f2261c2
Parents:
8662a58
Message:

If structurefactor, formfactor, and categorycombobox are loaded in as strings instead of unicode, now able to find the category, form factor and structure factor.

File:
1 edited

Legend:

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

    r8662a58 rf22b43c  
    10991099        self.Refresh() 
    11001100 
     1101    def get_cat_combo_box_pos(self, state): 
     1102        """ 
     1103        Iterate through the categories to find the structurefactor 
     1104        :return: combo_box_position 
     1105        """ 
     1106        for key, value in self.master_category_dict.iteritems(): 
     1107            for list_item in value: 
     1108                if state.formfactorcombobox in list_item: 
     1109                    return self.categorybox.Items.index(key) 
     1110 
    11011111    def reset_page_helper(self, state): 
    11021112        """ 
     
    11451155            category_pos = int(state.categorycombobox) 
    11461156        except: 
     1157            state.formfactorcombobox = unicode(state.formfactorcombobox.lower()) 
     1158            state.categorycombobox = unicode(state.categorycombobox) 
    11471159            category_pos = 0 
    1148             for ind_cat in range(self.categorybox.GetCount()): 
    1149                 if self.categorybox.GetString(ind_cat) == \ 
    1150                                         state.categorycombobox: 
    1151                     category_pos = int(ind_cat) 
    1152                     break 
     1160            if state.categorycombobox in self.categorybox.Items: 
     1161                category_pos = self.categorybox.Items.index( 
     1162                    state.categorycombobox) 
     1163            else: 
     1164                # Look in master list for model name (model.lower) 
     1165                category_pos = self.get_cat_combo_box_pos(state) 
    11531166 
    11541167        self.categorybox.Select(category_pos) 
     
    11711184            structfactor_pos = int(state.structurecombobox) 
    11721185        except: 
    1173             structfactor_pos = 0 
    1174             for ind_struct in range(self.structurebox.GetCount()): 
    1175                 if self.structurebox.GetString(ind_struct) == \ 
    1176                                                     (state.structurecombobox): 
    1177                     structfactor_pos = int(ind_struct) 
    1178                     break 
     1186            if state.structurecombobox is not None: 
     1187                structfactor_pos = 0 
     1188                state.structurecombobox = unicode(state.structurecombobox) 
     1189                for ind_struct in range(self.structurebox.GetCount()): 
     1190                    if self.structurebox.GetString(ind_struct) == \ 
     1191                                                        (state.structurecombobox): 
     1192                        structfactor_pos = int(ind_struct) 
     1193                        break 
    11791194 
    11801195        self.structurebox.SetSelection(structfactor_pos) 
Note: See TracChangeset for help on using the changeset viewer.