Changeset dafc36f in sasview


Ignore:
Timestamp:
Oct 16, 2011 12:59:57 PM (13 years ago)
Author:
Jae Cho <jhjcho@…>
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:
e7281fd
Parents:
a490860
Message:

minor changes for better flow

Location:
fittingview/src/sans/perspectives/fitting
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • fittingview/src/sans/perspectives/fitting/basepage.py

    r70e439f rdafc36f  
    294294    def on_set_focus(self, event): 
    295295        """ 
     296        On Set Focus, update guimanger and menu 
    296297        """ 
    297298        if self._manager is not None: 
    298299            wx.PostEvent(self._manager.parent, PanelOnFocusEvent(panel=self)) 
    299             chain_menu = self._manager.menu1.FindItemById(self._manager.id_reset_flag) 
    300             chain_menu.Enable(self.batch_on) 
     300            if self._manager.menu1 != None: 
     301                chain_menu = self._manager.menu1.FindItemById(\ 
     302                                                        self._manager.id_reset_flag) 
     303                chain_menu.Enable(self.batch_on) 
     304                sim_menu = self._manager.menu1.FindItemById(self._manager.id_simfit) 
     305                sim_menu.Enable(not self.batch_on and self.data.is_data\ 
     306                                and (self.model!=None)) 
     307                
    301308 
    302309    class ModelTextCtrl(wx.TextCtrl): 
     
    21322139                return self.model 
    21332140             
    2134  
    21352141        ## post state to fit panel 
    21362142        self.state.parameters =[] 
  • fittingview/src/sans/perspectives/fitting/fitpage.py

    r1363416 rdafc36f  
    7878        fill sizer 0 with data info 
    7979        """ 
    80         box_description= wx.StaticBox(self, -1, 'I(q) Data Source') 
    81         boxsizer1 = wx.StaticBoxSizer(box_description, wx.VERTICAL) 
     80        self.data_box_description = wx.StaticBox(self, -1, 'I(q) Data Source') 
     81        if check_data_validity(self.data): 
     82            dname_color = wx.BLUE 
     83        else: 
     84            dname_color = wx.RED 
     85        self.data_box_description.SetForegroundColour(dname_color) 
     86        boxsizer1 = wx.StaticBoxSizer(self.data_box_description, wx.VERTICAL) 
    8287        #---------------------------------------------------------- 
    8388        sizer_data = wx.BoxSizer(wx.HORIZONTAL) 
     
    123128            self.state.qmin = self.qmin_x 
    124129            self.state.qmax = self.qmax_x 
    125              
     130        is_data = False     
    126131        for data in self.data_list: 
    127132            if data is not None: 
    128133                self.dataSource.Append(str(data.name), clientData=data) 
     134                if not is_data: 
     135                    is_data = check_data_validity(data) 
    129136        self.dataSource.SetSelection(0) 
    130137        self.on_select_data(event=None) 
     
    212219        #Sizers 
    213220        box_description_range = wx.StaticBox(self, -1,str(title)) 
     221        box_description_range.SetForegroundColour(wx.BLUE) 
    214222        boxsizer_range = wx.StaticBoxSizer(box_description_range, wx.VERTICAL)       
    215223        self.sizer_set_smearer = wx.BoxSizer(wx.VERTICAL) 
     
    571579        self.mbox_description= wx.StaticBox(self, -1,str(title)) 
    572580        boxsizer1 = wx.StaticBoxSizer(self.mbox_description, wx.VERTICAL) 
    573          
     581        self.mbox_description.SetForegroundColour(wx.RED) 
    574582        id = wx.NewId() 
    575583        self.model_help =wx.Button(self,id,'Details', size=(80,23)) 
     
    12701278    
    12711279            self._manager._on_model_panel(evt=evt) 
    1272             self.mbox_description.SetLabel("Model [%s]" % str(self.model.name)) 
     1280            self.mbox_description.SetLabel("Model [ %s ]" % str(self.model.name)) 
     1281            self.mbox_description.SetForegroundColour(wx.BLUE) 
    12731282            self.state.model = self.model.clone() 
    12741283            self.state.model.name = self.model.name 
     
    19191928                self.btEditMask.Enable()   
    19201929                self.EditMask_title.Enable()  
     1930     
    19211931        self.Npts_total.SetValue(str(npts)) 
    19221932        #default:number of data points selected to fit 
     
    19321942        # send graph_id to page_finder  
    19331943        self._manager.set_graph_id(uid=self.uid, graph_id=self.graph_id) 
     1944        #focus the page 
     1945        if check_data_validity(data): 
     1946            self.data_box_description.SetForegroundColour(wx.BLUE) 
     1947        self.on_set_focus(None) 
     1948        self.Refresh() 
    19341949        #update model plot with new data information 
    19351950        if flag: 
  • fittingview/src/sans/perspectives/fitting/fitpanel.py

    r2ada16c rdafc36f  
    364364        self._manager.page_finder[panel.uid].add_data(panel.get_data()) 
    365365        self.enable_close_button() 
     366        panel.on_set_focus(None) 
    366367        return panel  
    367368     
     
    426427        for p in self.opened_pages.values(): 
    427428            #check if there is an empty page to fill up  
    428             if not check_data_validity(p.get_data()): 
     429            if not check_data_validity(p.get_data()) and p.batch_on: 
    429430                page = p 
    430                 self.batch_page_index += 1 
     431                #self.batch_page_index += 1 
    431432                break 
    432433        if data_1d_list and data_2d_list: 
     
    496497            #check if the selected data existing in the fitpanel 
    497498            pos = self.GetPageIndex(page) 
    498             if not check_data_validity(page.get_data()): 
     499            if not check_data_validity(page.get_data()) and not page.batch_on: 
    499500                #make sure data get placed in 1D empty tab if data is 1D 
    500501                #else data get place on 2D tab empty tab 
     
    505506                    page._set_save_flag(not page.batch_on) 
    506507                    page.fill_data_combobox(data_list) 
    507                     caption = "FitPage" + str(self.fit_page_index) 
    508                     self.SetPageText(pos, caption) 
     508                    #caption = "FitPage" + str(self.fit_page_index) 
     509                    self.SetPageText(pos, page.window_caption) 
    509510                    self.SetSelection(pos) 
    510511                    return page 
  • fittingview/src/sans/perspectives/fitting/fitting.py

    r70e439f rdafc36f  
    105105        self.scipy_id = wx.NewId() 
    106106        self.park_id = wx.NewId() 
     107        self.menu1 = None 
    107108         
    108109        self.temp_state = [] 
     
    165166        wx.EVT_MENU(owner, id1, self.on_add_new_page) 
    166167        self.menu1.AppendSeparator() 
    167         id1 = wx.NewId() 
     168        self.id_simfit = wx.NewId() 
    168169        simul_help = "Simultaneous Fit" 
    169         self.menu1.Append(id1, '&Simultaneous Fit',simul_help) 
    170         wx.EVT_MENU(owner, id1, self.on_add_sim_page) 
     170        self.menu1.Append(self.id_simfit, '&Simultaneous Fit',simul_help) 
     171        wx.EVT_MENU(owner, self.id_simfit, self.on_add_sim_page) 
     172        sim_menu = self.menu1.FindItemById(self.id_simfit) 
     173        sim_menu.Enable(False)  
     174         
    171175        self.menu1.AppendSeparator() 
    172176        #Set park engine 
    173          
    174177        scipy_help= "Scipy Engine: Perform Simple fit. More in Help window...." 
    175178        self.menu1.AppendCheckItem(self.scipy_id, "Simple FitEngine [LeastSq]", 
     
    585588        ftol_help = "Change the current FTolerance (=%s) " % str(self.ftol) 
    586589        ftol_help += "of Simple FitEngine..."  
    587         self.menu1.SetHelpString(self.id_tol, ftol_help) 
     590        if self.menu1 != None: 
     591            self.menu1.SetHelpString(self.id_tol, ftol_help) 
    588592         
    589593    def show_ftol_dialog(self, event=None): 
     
    13431347        """ 
    13441348        event.Skip() 
     1349        if self.menu1 == None: 
     1350            return 
    13451351        menu_item = self.menu1.FindItemById(self.id_reset_flag) 
    13461352        flag = menu_item.IsChecked() 
  • fittingview/src/sans/perspectives/fitting/simfitpage.py

    r9e9be13 rdafc36f  
    795795        sizer.Clear(True) 
    796796         
    797         new_name = wx.StaticText(self, -1, 'New Model Name',  
     797        new_name = wx.StaticText(self, -1, '  Model Title ', 
    798798                                 style=wx.ALIGN_CENTER) 
    799799        new_name.SetBackgroundColour('orange') 
     800        new_name.SetForegroundColour(wx.WHITE) 
    800801        sizer.Add(new_name,(iy, ix),(1,1), 
    801802                            wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    802803        ix += 2  
    803         model_type = wx.StaticText(self, -1, '  Model Type') 
     804        model_type = wx.StaticText(self, -1, '  Model ') 
    804805        model_type.SetBackgroundColour('grey') 
     806        model_type.SetForegroundColour(wx.WHITE) 
    805807        sizer.Add(model_type,(iy, ix),(1,1), 
    806808                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    807809        ix += 1  
    808         data_used = wx.StaticText(self, -1, '  Used Data') 
     810        data_used = wx.StaticText(self, -1, '  Data ') 
    809811        data_used.SetBackgroundColour('grey') 
     812        data_used.SetForegroundColour(wx.WHITE) 
    810813        sizer.Add(data_used,(iy, ix),(1,1), 
    811814                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
    812815        ix += 1  
    813         tab_used = wx.StaticText(self, -1, '  Fit Tab') 
     816        tab_used = wx.StaticText(self, -1, '  FitPage ') 
    814817        tab_used.SetBackgroundColour('grey') 
     818        tab_used.SetForegroundColour(wx.WHITE) 
    815819        sizer.Add(tab_used,(iy, ix),(1,1), 
    816820                            wx.EXPAND|wx.ADJUST_MINSIZE, 0)  
     
    821825                ix = 0 
    822826                for fitproblem in value.get_fit_problem(): 
    823                     if  not self.parent.get_page_by_id(id).batch_on: 
    824                         iy += 1  
    825                         data = fitproblem.get_fit_data() 
    826                         model = fitproblem.get_model() 
    827                         name = '_' 
    828                         if model is not None: 
    829                             name = str(model.name) 
    830                         cb = wx.CheckBox(self, -1, name) 
    831                         cb.SetValue(False) 
    832                         cb.Enable(model is not None and data.is_data) 
    833                         sizer.Add(cb, (iy, ix), (1, 1),  
    834                                    wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    835                         wx.EVT_CHECKBOX(self, cb.GetId(), self.check_model_name) 
    836                         ix += 2  
    837                         type = model.__class__.__name__ 
    838                         model_type = wx.StaticText(self, -1, str(type)) 
    839                         sizer.Add(model_type, (iy, ix), (1, 1),  
    840                                   wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    841                         name = '-' 
    842                         if data is not None and data.is_data: 
    843                             name = str(data.name) 
    844                         data_used = wx.StaticText(self, -1, name) 
    845                         ix += 1  
    846                         sizer.Add(data_used, (iy, ix), (1, 1),  
    847                                   wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    848                         ix += 1  
    849                         caption = value.get_fit_tab_caption() 
    850                         tab_caption_used= wx.StaticText(self, -1, str(caption)) 
    851                         sizer.Add(tab_caption_used, (iy, ix), (1, 1),  
    852                                   wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    853                      
    854                         self.model_list.append([cb,value,id,model]) 
     827                    if  self.parent.get_page_by_id(id).batch_on: 
     828                        continue 
     829                    data = fitproblem.get_fit_data() 
     830                    if not data.is_data: 
     831                        continue 
     832                    model = fitproblem.get_model() 
     833                    if model == None: 
     834                        continue 
     835                    iy += 1  
     836                    name = '_' 
     837                    if model is not None: 
     838                        name = str(model.name) 
     839                    cb = wx.CheckBox(self, -1, name) 
     840                    cb.SetValue(False) 
     841                    cb.Enable(model is not None and data.is_data) 
     842                    sizer.Add(cb, (iy, ix), (1, 1),  
     843                               wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     844                    wx.EVT_CHECKBOX(self, cb.GetId(), self.check_model_name) 
     845                    ix += 2  
     846                    type = model.__class__.__name__ 
     847                    model_type = wx.StaticText(self, -1, str(type)) 
     848                    sizer.Add(model_type, (iy, ix), (1, 1),  
     849                              wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     850                    name = '-' 
     851                    if data is not None and data.is_data: 
     852                        name = str(data.name) 
     853                    data_used = wx.StaticText(self, -1, name) 
     854                    ix += 1  
     855                    sizer.Add(data_used, (iy, ix), (1, 1),  
     856                              wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
     857                    ix += 1  
     858                    caption = value.get_fit_tab_caption() 
     859                    tab_caption_used= wx.StaticText(self, -1, str(caption)) 
     860                    sizer.Add(tab_caption_used, (iy, ix), (1, 1),  
     861                              wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    855862                 
     863                    self.model_list.append([cb,value,id,model])    
    856864            except: 
    857865                raise 
Note: See TracChangeset for help on using the changeset viewer.