Changeset 55f5a77 in sasview


Ignore:
Timestamp:
Jul 26, 2010 5:23:25 PM (14 years ago)
Author:
Gervaise Alina <gervyh@…>
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:
aebc4cc
Parents:
a94c4e1
Message:

working on guiframe load data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • prview/perspectives/pr/inversion_panel.py

    rf5038c06 r55f5a77  
    292292        return state 
    293293     
     294    def set_data(self, list=[], state=None): 
     295        """ 
     296        Receive  a list of data from gui_manager to compute pr 
     297        """ 
     298        msg = "Could not load: \n" 
     299        for data, path in list: 
     300            if data.__class__.__name__ != "Data2D": 
     301                name = os.path.basename(path) 
     302                if name not in self.data_cbbox.GetItems(): 
     303                    self.data_cbbox.Insert(item=name,pos=0,clientData=(data, path)) 
     304            else: 
     305                message = "Prview cannot load Data2D" 
     306                wx.PostEvent(self.manager.parent, StatusEvent(status=message,  
     307                                                              type="error")) 
     308        if list: 
     309            self.data_cbbox.Enable() 
     310            self.data_cbbox.SetSelection(0) 
     311            self.on_select_data(event=None) 
     312                 
     313    def on_select_data(self, event=None): 
     314        """ 
     315        Select data from combobox 
     316        """ 
     317        position = self.data_cbbox.GetCurrentSelection() 
     318        #For MAC 
     319        data, path = None, None 
     320        if position >= 0: 
     321            data, path = self.data_cbbox.GetClientData(position) 
     322            self._change_file(evt=None, filepath=path) 
     323     
    294324    def set_state(self, state): 
    295325        """ 
     
    364394        boxsizer1.SetMinSize((self._default_width,50)) 
    365395        pars_sizer = wx.GridBagSizer(5,5) 
    366  
     396         
     397        self.data_txt = wx.StaticText(self, -1,"Loaded Data: ") 
     398        self.data_cbbox = wx.ComboBox(self, -1, size=(260,20)) 
     399        self.data_cbbox.Disable() 
     400        wx.EVT_COMBOBOX(self.data_cbbox ,-1, self.on_select_data)  
     401         
    367402        iy = 0 
     403        pars_sizer.Add(self.data_txt, (iy,0), (1,1),  
     404                       wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     405        pars_sizer.Add(self.data_cbbox , (iy,1), (1,1), 
     406                        wx.EXPAND|wx.LEFT|wx.RIGHT|wx.ADJUST_MINSIZE, 15) 
     407         
     408        iy = 1 
    368409        self.file_radio = wx.StaticText(self, -1, "Data:") 
    369410        pars_sizer.Add(self.file_radio, (iy,0), (1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
     
    783824            if npts>0 and nfunc>npts: 
    784825                message = "Number of function terms should be smaller than the number of points" 
    785                 wx.PostEvent(self.manager.parent, StatusEvent(status=message)) 
     826                wx.PostEvent(self.manager.parent, StatusEvent(status=message,  
     827                                                              type="warning")) 
    786828                raise ValueError, message 
    787829            self.nfunc_ctl.SetBackgroundColour(wx.WHITE) 
Note: See TracChangeset for help on using the changeset viewer.