Changeset e88ebfd in sasview for prview


Ignore:
Timestamp:
Mar 11, 2011 4:39:00 PM (13 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:
ee2b492
Parents:
14cd91b1
Message:

working on guiframe

File:
1 edited

Legend:

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

    ra3149c5 re88ebfd  
    219219        new_plot.xaxis("\\rm{r}", 'A') 
    220220        new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
    221         group_id = "P_{obs}(r)" 
    222         if group_id not in new_plot.group_id: 
    223             new_plot.group_id.append(group_id) 
     221        new_plot.group_id = "P_{obs}(r)" 
    224222        new_plot.id = "P_{obs}(r)" 
    225223        new_plot.title = title 
     
    255253        new_plot.yaxis("\\rm{P(r)} ","cm^{-3}") 
    256254        new_plot.id = "P_{true}(r)" 
    257         group_id = "P_{true}(r)" 
    258         if group_id not in new_plot.group_id: 
    259             new_plot.group_id.append(group_id) 
     255        new_plot.group_id = "P_{true}(r)" 
    260256        self.parent.append_theory(data_id=self.current_plottable.id, 
    261257                                       theory=new_plot) 
     
    316312        # If we have a group ID, use it 
    317313        if pr.info.has_key("plot_group_id"): 
    318             if len( pr.info["plot_group_id"]) > 0: 
    319                 index =  len( pr.info["plot_group_id"]) - 1 
    320                 new_plot.group_id.append( pr.info["plot_group_id"][index]) 
     314            new_plot.group_id = pr.info["plot_group_id"] 
    321315        new_plot.id = IQ_FIT_LABEL 
    322316        self.parent.append_theory(data_id=self.current_plottable.id, 
     
    345339            # If we have a group ID, use it 
    346340            if pr.info.has_key("plot_group_id"): 
    347                 if len( pr.info["plot_group_id"]) > 0: 
    348                     index =  len( pr.info["plot_group_id"]) - 1 
    349                     new_plot.group_id.append( pr.info["plot_group_id"][index]) 
    350             
     341              new_plot.group_id = pr.info["plot_group_id"] 
    351342            new_plot.id = IQ_SMEARED_LABEL 
    352343            new_plot.title = title 
     
    418409        new_plot.xtransform = "x" 
    419410        new_plot.ytransform = "y"   
    420         group_id = "P(r) fit" 
    421         if group_id not in new_plot.group_id: 
    422             new_plot.group_id.append(group_id)    
     411        new_plot.group_id = "P(r) fit" 
    423412        self.parent.append_theory(data_id=self.current_plottable.id, 
    424413                                       theory=new_plot)             
     
    674663            new_plot = Data1D(self._added_plots[plot].x, y) 
    675664            new_plot.symbol = GUIFRAME_ID.CURVE_SYMBOL_NUM 
    676             index  = len(self._added_plots[plot].group_id) - 1 
    677             if group_id not in new_plot.group_id: 
    678                 new_plot.group_id.append(group_id) 
     665            new_plot.group_id = self._added_plots[plot].group_id 
    679666            new_plot.id = self._added_plots[plot].id 
    680667            new_plot.title = self._added_plots[plot].title 
     
    888875            new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
    889876            if pr.info.has_key("plot_group_id"): 
    890                 new_plot.group_id.append(pr.info["plot_group_id"]) 
     877                new_plot.group_id = pr.info["plot_group_id"] 
    891878            new_plot.id = IQ_DATA_LABEL 
    892879            self.parent.append_theory(data_id=self.current_plottable.id, 
     
    937924        new_plot.yaxis("\\rm{Intensity} ","cm^{-1}") 
    938925        new_plot.interactive = True 
    939         new_plot.group_id.append(IQ_DATA_LABEL) 
     926        new_plot.group_id = IQ_DATA_LABEL  
    940927        new_plot.id = IQ_DATA_LABEL 
    941928        new_plot.title = "I(q)" 
     
    10491036        # Keep track of the plot window title to ensure that 
    10501037        # we can overlay the plots 
    1051         if self.current_plottable.group_id: 
    1052             index = len(self.current_plottable.group_id) - 1 
    1053             group_id = self.current_plottable.group_id[index] 
    1054             pr.info["plot_group_id"] = self.current_plottable.group_id 
     1038        pr.info["plot_group_id"] = self.current_plottable.group_id 
    10551039         
    10561040        # Fill in errors if none were provided 
     
    13501334        return [self.control_panel] 
    13511335     
    1352     def set_data(self, data_list=None, theory_list=None): 
     1336    def set_data(self, data_list=None): 
    13531337        """ 
    13541338        receive a list of data to compute pr 
     
    13561340        if data_list is None: 
    13571341            data_list = [] 
    1358         if len(data_list) > 1: 
    1359             msg = "Pr panel does not allow multiple Data.\n" 
    1360             msg += "Please select one!\n" 
    1361             from pr_widgets import DataDialog 
    1362             dlg = DataDialog(data_list=data_list, text=msg) 
    1363             if dlg.ShowModal() == wx.ID_OK: 
    1364                 data = dlg.get_data() 
    1365                 if issubclass(data.__class__, Data1D): 
     1342        if len(data_list) >= 1: 
     1343            if len(data_list) == 1: 
     1344                data = data_list[0] 
     1345            else: 
     1346                msg = "Pr panel does not allow multiple Data.\n" 
     1347                msg += "Please select one!\n" 
     1348                from pr_widgets import DataDialog 
     1349                dlg = DataDialog(data_list=data_list, text=msg) 
     1350                if dlg.ShowModal() == wx.ID_OK: 
     1351                    data = dlg.get_data() 
     1352            if data is None: 
     1353                return 
     1354            if issubclass(data.__class__, Data1D): 
     1355                try: 
    13661356                    self.control_panel._change_file(evt=None, data=data) 
    1367                 else:     
    1368                     msg = "Pr cannot be computed for data of " 
    1369                     msg += "type %s" % (data_list[0].__class__.__name__) 
    1370                     wx.PostEvent(self.parent,  
    1371                              StatusEvent(status=msg, info='error')) 
    1372         elif len(data_list) == 1: 
    1373             if issubclass(data_list[0].__class__, Data1D): 
    1374                 self.control_panel._change_file(evt=None, data=data_list[0]) 
    1375             else: 
    1376                 msg = "Pr cannot be computed for" 
    1377                 msg += " data of type %s" % (data_list[0].__class__.__name__) 
     1357                except: 
     1358                     msg = "Prview Set_data: " + str(sys.exc_value) 
     1359                     wx.PostEvent(self.parent, StatusEvent(status=msg, 
     1360                                                            info="error")) 
     1361            else:     
     1362                msg = "Pr cannot be computed for data of " 
     1363                msg += "type %s" % (data_list[0].__class__.__name__) 
    13781364                wx.PostEvent(self.parent,  
    1379                              StatusEvent(status=msg, info='error')) 
     1365                         StatusEvent(status=msg, info='error')) 
    13801366        else: 
    13811367            msg = "Pr contain no data" 
Note: See TracChangeset for help on using the changeset viewer.