Changeset 8bd764d in sasview for guiframe


Ignore:
Timestamp:
Feb 25, 2009 9:37:41 AM (15 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:
25579e8
Parents:
72b524b
Message:

context menu improve for xml

Location:
guiframe
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • guiframe/data_loader.py

    r18eba35 r8bd764d  
    9191            temp[temp==0]=1 
    9292 
    93             wx.PostEvent(parent, StatusEvent(status="Loading 2D error bars of 1 \ 
    94             created for : %s"% str(temp[temp==0]))) 
     93            wx.PostEvent(parent, StatusEvent(status="Loading 2D error bars of value 1 \ 
     94            were added to : %s"% output.filename)) 
    9595            new_plot = Data2D(image=output.data,err_image=temp, 
    9696                              xmin=output.xmin,xmax=output.xmax, 
     
    101101        else: 
    102102            #print "output.dx, output.dy",output.dx, output.dy 
    103             if output.dy ==None: 
    104                 #print "went here theory1D" 
     103            if output.dy ==None : 
    105104                new_plot = Theory1D(output.x,output.y, dxl, dxw) 
     105            elif len(output.dy[output.dy==0])==len(output.dy): 
     106                output.dy[output.dy==0]=1  
     107                wx.PostEvent(parent, StatusEvent(status="Loading 1D error bars of value 1 \ 
     108                    were added to : %s"%output.filename)) 
     109                new_plot = Theory1D(output.x,output.y,output.dy, dxl, dxw) 
    106110            else: 
    107                 new_plot = Data1D(x=output.x,y=output.y,dy=output.dy, dxl=dxl, dxw=dxw) 
    108         #print "dataloader",output[0],output[1] 
    109          
     111                     
     112                new_plot = Data1D(x=output.x,y=output.y,dx=output.dx,dy=output.dy, dxl=dxl, dxw=dxw) 
     113        
    110114        new_plot.source=output.source 
    111115        new_plot.name = output.filename 
     
    129133        except: 
    130134            title= filename 
    131         print "dataloader title", title,output.filename 
     135         
    132136        wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title))) 
    133137    else: 
     
    144148                new_plot = Theory1D(item.x,item.y,dxl,dxw) 
    145149            else: 
    146                 new_plot = Data1D(x=item.x,y=item.y,dy=item.dy,dxl=dxl,dxw=dxw) 
     150                new_plot = Data1D(x=item.x,y=item.y,dx=item.dx,dy=item.dy,dxl=dxl,dxw=dxw) 
    147151            
    148152            new_plot.source=item.source 
  • guiframe/local_perspectives/plotting/Plotter1D.py

    r18eba35 r8bd764d  
    213213            self.action_ids[str(id)] = plot 
    214214            wx.EVT_MENU(self, id, self._onSave) 
     215            #save as cansas 
     216            id = wx.NewId() 
     217            slicerpop.Append(id, "&Save %s canSAS XML" % name) 
     218            self.action_ids[str(id)] = plot 
     219            wx.EVT_MENU(self, id, self._onSaveXML) 
    215220                 
    216221            # Option to delete plottable 
     
    364369             
    365370            self.graph.render(self) 
    366             self.subplot.figure.canvas.draw_idle()     
    367      
     371            self.subplot.figure.canvas.draw_idle()  
     372                
     373    def _onSaveXML(self, evt): 
     374        import os 
     375        id = str(evt.GetId()) 
     376        if id in self.action_ids:          
     377            path = None 
     378            dlg = wx.FileDialog(self, "Choose a file", os.getcwd(), "", "*.xml", wx.SAVE) 
     379            if dlg.ShowModal() == wx.ID_OK: 
     380                path = dlg.GetPath() 
     381                mypath = os.path.basename(path) 
     382                #print path 
     383            dlg.Destroy() 
     384             
     385            if not path == None: 
     386                out = open(path, 'w') 
     387                from DataLoader.readers import cansas_reader 
     388                reader = cansas_reader.Reader() 
     389                datainfo= self.plots[self.graph.selected_plottable].info 
     390                reader.write( path, datainfo) 
     391            return  
     392                 
     393                 
     394                 
     395                 
    368396    def _onSave(self, evt): 
    369397        """ 
  • guiframe/local_perspectives/plotting/Plotter2D.py

    r18eba35 r8bd764d  
    209209         
    210210                slicerpop.AppendSeparator() 
     211         
    211212        id = wx.NewId() 
    212213        slicerpop.Append(id, '&Edit Detector Parameters') 
     
    262263        pos = self.ScreenToClient(pos) 
    263264        self.PopupMenu(slicerpop, pos) 
    264          
     265    
    265266    def _onEditDetector(self, event): 
    266267        print "edit detortor param",self.zmin_2D, self.zmax_2D 
Note: See TracChangeset for help on using the changeset viewer.