Changeset 12aa9b5 in sasview for guiframe


Ignore:
Timestamp:
Mar 5, 2009 11:46:57 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:
07a93a1
Parents:
6c0568b
Message:

class and method commented

Location:
guiframe
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • guiframe/aboutbox.py

    r2bd9927 r12aa9b5  
    146146 
    147147        self.Fit() 
    148 #        self.SetSize(size) 
    149 #       self.FitInside() 
    150148         
    151149 
     
    156154        self.label_title.SetFont(wx.Font(26, wx.DEFAULT, wx.NORMAL, wx.BOLD, 0, "")) 
    157155        self.label_version.SetFont(wx.Font(26, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, "")) 
    158         #self.hyperlink_license.Enable(False) 
    159         #self.hyperlink_license.Hide() 
     156       
    160157        self.hyperlink_paper.Enable(True) 
    161         #self.hyperlink_paper.Hide() 
     158         
    162159        self.bitmap_button_nsf.SetSize(self.bitmap_button_nsf.GetBestSize()) 
    163160        self.bitmap_button_danse.SetSize(self.bitmap_button_danse.GetBestSize()) 
  • guiframe/dataFitting.py

    ra644dc4 r12aa9b5  
    1  
     1""" 
     2    Adapters for fitting module 
     3""" 
    24from danse.common.plottools.plottables import Data1D as plotData1D 
    35from danse.common.plottools.plottables import Theory1D as plotTheory1D 
     
    68 
    79class Data1D(plotData1D,DataInfo): 
     10     
    811    def __init__(self,x=[],y=[],dx=None,dy=None,dxl=None, dxw=None): 
    912        plotData1D.__init__(self, x, y, dx, dy) 
  • guiframe/data_loader.py

    r6d920cd r12aa9b5  
    8383     
    8484    if not  output.__class__.__name__=="list": 
     85        ## smearing info 
    8586        try: 
    86             dxl=output.dxl 
    87             dxw=output.dxw 
     87            dxl = output.dxl 
     88            dxw = output.dxw 
    8889        except: 
    89             dxl=None 
    90             dxw=None 
     90            dxl = None 
     91            dxw = None 
     92        ## data 's name 
     93        if output.filename==None: 
     94            output.filename=str(filename) 
     95        ## Creating a Data2D with output 
    9196        if hasattr(output,'data'): 
    9297            temp = output.err_data 
    9398            temp[temp==0]=1 
    94  
    95             wx.PostEvent(parent, StatusEvent(status="Loading 2D error bars of value 1 \ 
    96             were added to : %s"% output.filename)) 
     99            msg= "Loading 2D error bars of value 1 were added to" 
     100            wx.PostEvent(parent, StatusEvent(status=" %s %s"% (msg,output.filename))) 
    97101            new_plot = Data2D(image=output.data,err_image=temp, 
    98102                              xmin=output.xmin,xmax=output.xmax, 
     
    100104            new_plot.x_bins=output.x_bins 
    101105            new_plot.y_bins=output.y_bins 
     106        ##Creating Data1D with output 
    102107        else: 
    103             
     108            ##dy values checked 
    104109            if output.dy ==None : 
    105110                new_plot = Theory1D(output.x,output.y, dxl, dxw) 
     111                 
    106112            elif len(output.dy[output.dy==0])==len(output.dy): 
    107113                output.dy[output.dy==0]=1  
    108                 wx.PostEvent(parent, StatusEvent(status="Loading 1D error bars of value 1 \ 
    109                     were added to : %s"%output.filename)) 
     114                msg="Loading 1D error bars of value 1 were added to " 
     115                wx.PostEvent(parent, StatusEvent(status= "%s %s"%(msg, output.filename))) 
    110116                new_plot = Theory1D(output.x,output.y,output.dy, dxl, dxw) 
    111117            else: 
    112                 new_plot = Data1D(x=output.x,y=output.y,dx=output.dx,dy=output.dy, dxl=dxl, dxw=dxw) 
    113         if output.filename==None: 
    114             output.filename=str(filename) 
     118                msg="Loading 1D data: " 
     119                wx.PostEvent(parent, StatusEvent(status= "%s %s"%(msg, output.filename))) 
     120                new_plot = Data1D(x=output.x, y=output.y, dx=output.dx, 
     121                                  dy=output.dy, dxl=dxl, dxw=dxw) 
     122                 
     123        ## source will request in dataLoader .manipulation module 
    115124        new_plot.source=output.source 
     125        ## name of the data allow to differentiate data when plotted 
    116126        new_plot.name = output.filename 
     127        ## allow to highlight data when plotted 
    117128        new_plot.interactive = True 
    118         new_plot.id = True 
     129        ## when 2 data have the same id override the 1 st plotted 
     130        new_plot.id = output.filename 
     131        ## info is a reference to output of dataloader that can be used 
     132        ## to save  data 1D as cansas xml file 
    119133        new_plot.info= output 
    120         if hasattr(output, "dxl"): 
    121             new_plot.dxl = output.dxl 
    122         if hasattr(output, "dxw"): 
    123             new_plot.dxw = output.dxw 
     134        ## detector used by dataLoader.manipulation module 
    124135        new_plot.detector =output.detector 
    125          
    126         # If the data file does not tell us what the axes are, just assume... 
     136        ## If the data file does not tell us what the axes are, just assume... 
    127137        new_plot.xaxis(output._xaxis,output._xunit) 
    128138        new_plot.yaxis(output._yaxis,output._yunit) 
     139        ##group_id specify on which panel to plot this data 
    129140        new_plot.group_id = output.filename 
    130         new_plot.id = output.filename 
    131         try: 
    132             title=output.filename 
    133         except: 
    134             title= filename 
     141        ##post data to plot 
     142        wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(output.filename))) 
    135143         
    136         wx.PostEvent(parent, NewPlotEvent(plot=new_plot, title=str(title))) 
     144    ## the output of the loader is a list , some xml files contain more than one data 
    137145    else: 
    138146        i=1 
    139147        for item in output: 
    140              
    141148            try: 
    142149                dxl=item.dxl 
     
    145152                dxl=None 
    146153                dxw=None 
     154                 
    147155            if item.dy ==None: 
    148156                new_plot = Theory1D(item.x,item.y,dxl,dxw) 
  • guiframe/local_perspectives/plotting/SlicerParameters.py

    rd468daa r12aa9b5  
    1919    def __init__(self, parent, *args, **kwargs): 
    2020        wx.Dialog.__init__(self, parent, *args, **kwargs) 
     21        """ 
     22            Dialog window that allow to edit parameters slicer  
     23            by entering new values 
     24        """ 
    2125        self.params = {} 
    2226        self.parent = parent 
     
    4145            @param event: EVT_SLICER event 
    4246        """ 
    43         #print "went here" 
    4447        event.Skip() 
    4548        if event.obj_class==None: 
     
    6568            iy = 0 
    6669            self.parameters = [] 
    67             #params = slicer.get_params() 
    6870            keys = params.keys() 
    6971            keys.sort() 
     
    7577                     
    7678                    text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 
    77                     #self.bck.Add(text, (iy,ix), flag = wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border = 15) 
    7879                    self.bck.Add(text, (iy,ix),(1,1), wx.LEFT|wx.EXPAND|wx.ADJUST_MINSIZE, 15) 
    7980                    ctl = wx.TextCtrl(self, -1, size=(80,20), style=wx.TE_PROCESS_ENTER) 
     
    8687                    ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
    8788                    self.parameters.append([item, ctl]) 
    88                     #self.bck.Add(ctl, (iy,ix), flag=wx.TOP|wx.BOTTOM, border = 0) 
    8989                    self.bck.Add(ctl, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 
    9090                     
     
    105105 
    106106    def onParamChange(self, evt): 
     107        """ 
     108            receive an event end reset value text fields 
     109            inside self.parameters 
     110        """ 
    107111        evt.Skip() 
    108112        if evt.type == "UPDATE": 
     
    131135        if has_error==False: 
    132136            # Post parameter event 
     137            ##parent hier is plotter2D 
    133138            event = SlicerParameterEvent(type=self.type, params=params) 
    134139            wx.PostEvent(self.parent, event) 
  • guiframe/local_perspectives/plotting/slicerpanel.py

    rd468daa r12aa9b5  
    2424    def __init__(self, parent,id=-1,type=None,base=None, params={}, *args, **kwargs): 
    2525        wx.Panel.__init__(self, parent,id, *args, **kwargs) 
    26         #print "panel created", base 
     26        ##  Initialization of the class      
    2727        self.base= base 
    2828        self.params = params 
     
    3939        else: 
    4040            self.set_slicer( type, params) 
    41         # Bindings 
    42         #self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 
     41        ## Bindings 
    4342        self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 
    4443        self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 
     44 
    4545 
    4646    def onEVT_SLICER(self, event): 
     
    4848            Process EVT_SLICER events 
    4949            When the slicer changes, update the panel 
    50              
    5150            @param event: EVT_SLICER event 
    5251        """ 
    53         #print "went here panel" 
    5452        event.Skip() 
    5553        if event.obj_class==None: 
    56             self.set_slicer(None, None) 
    57              
     54            self.set_slicer(None, None)  
    5855        else: 
    59             #print "when here not empty event",event.type, event.params 
    6056            self.set_slicer(event.type, event.params) 
     57         
    6158         
    6259    def set_slicer(self, type, params): 
     
    6663        self.bck.Clear(True)   
    6764        self.type = type   
    68         #print "in set slicer", type, params 
    6965        if type==None: 
    7066            title = wx.StaticText(self, -1, "Right-click on 2D plot for slicer options", style=wx.ALIGN_LEFT) 
    7167            self.bck.Add(title, (0,0), (1,2), flag=wx.LEFT|wx.ALIGN_CENTER_VERTICAL, border=15) 
    72  
    7368        else: 
    7469            title = wx.StaticText(self, -1, "Slicer Parameters", style=wx.ALIGN_LEFT) 
     
    7772            n = 1 
    7873            self.parameters = [] 
    79             #params = slicer.get_params() 
    8074            keys = params.keys() 
    8175            keys.sort() 
     
    8983                    ctl.SetToolTipString("Modify the value of %s to change the 2D slicer" % item) 
    9084                    ctl.SetValue(str(format_number(params[item]))) 
    91                     #ctl.Disable() 
     85 
    9286                    self.Bind(wx.EVT_TEXT_ENTER, self.onTextEnter) 
    9387                    ctl.Bind(wx.EVT_KILL_FOCUS, self.onTextEnter) 
     
    9690            for item in keys: 
    9791                if  item.lower() in ["errors", "count"]: 
    98                     #print "went here" 
    9992                    n += 1 
    10093                    text = wx.StaticText(self, -1, item+": ", style=wx.ALIGN_LEFT) 
     
    10497                    self.bck.Add(ctl, (n-1,1), flag=wx.TOP|wx.BOTTOM, border = 0) 
    10598                 
    106  
    10799        self.bck.Layout() 
    108100        self.bck.Fit(self) 
    109101        self.parent.GetSizer().Layout() 
     102         
     103         
    110104    def onParamChange(self, evt): 
    111         #print "parameters changed" 
     105        """ 
     106            Receive and event and reset the text field contained in self.parameters 
     107             
     108        """ 
    112109        evt.Skip() 
    113         #if evt.type == "UPDATE": 
    114110        for item in self.parameters:               
    115111            if item[0] in evt.params: 
     
    137133        if has_error==False: 
    138134            # Post parameter event 
    139             #print "post new param" 
     135            ## base is guiframe is this case 
    140136            event = SlicerParameterEvent(type=self.type, params=params) 
    141137            wx.PostEvent(self.base, event) 
    142             #print "panel slicer: self base ", self.base 
     138             
    143139         
  • guiframe/model_thread.py

    r6d920cd r12aa9b5  
    3232            CalcThread.isquit(self) 
    3333        except KeyboardInterrupt: 
    34             #printEVT("Calc %s interrupted" % self.model.name) 
    3534            wx.PostEvent(self.parent, StatusEvent(status=\ 
    3635                       "Calc %s interrupted" % self.model.name)) 
     
    108107        self.x = x 
    109108        self.y = y 
     109        ## the model on to calculate 
    110110        self.model = model 
    111111        self.starttime = 0 
     
    113113                    "Start Drawing model  ",curr_thread=self,type="start")) 
    114114         
     115         
    115116    def isquit(self): 
    116117        try: 
    117118            CalcThread.isquit(self) 
    118119        except KeyboardInterrupt: 
    119             #printEVT("Calc %s interrupted" % self.model.name) 
    120120            wx.PostEvent(self.parent, StatusEvent(status=\ 
    121121                       "Calc %s interrupted" % self.model.name)) 
     
    123123            raise KeyboardInterrupt 
    124124         
     125         
    125126    def update(self, output=None): 
    126          
     127        """ 
     128            Post a message if update available 
     129        """ 
    127130        wx.PostEvent(self.parent, StatusEvent(status="Plot \ 
    128131        #updating ... ",curr_thread=self,type="update")) 
     
    130133         
    131134    def compute(self): 
     135        """ 
     136            Compute the data given a model function 
     137        """ 
    132138        import numpy 
    133139        x = self.x 
     
    163169                       "Error computing %s at [%g,%g]" %(self.model.name, self.x[i_x],self.y[i_y]))) 
    164170                     pass 
    165         #print "model thread ouput",output        
     171         
    166172        elapsed = time.time()-self.starttime 
    167173        self.complete( 
  • guiframe/statusbar.py

    racd91458 r12aa9b5  
    33    def __init__(self,*args,**kargs): 
    44         wx.StatusBar.__init__(self, *args,**kargs) 
     5         """ 
     6             Implement statusbar functionalities  
     7         """ 
    58         #Layout of status bar 
    69         self.SetFieldsCount(2)  
     
    1215          
    1316         self.gauge.Hide() 
    14           
    15          #Progess  
    16  
    17          self.progress = 0       # Current progress value of the bar  
     17         ## Current progress value of the bar  
     18         self.progress = 0       
    1819         self.timer = wx.Timer(self,-1)  
    1920         self.timer_stop = wx.Timer(self,-1)  
     
    2223         self.Bind(wx.EVT_TIMER,self.OnTimer_stop, self.timer_stop)  
    2324         self.count=0 
     25         
    2426          
    2527    def OnTimer_stop(self, evt):  
    26         """Update the progress bar while the timer is running  
     28        """Clear the progress bar 
    2729        @param evt: wx.EVT_TIMER  
    2830   
     
    3436            self.SetStatusText( "", 0) 
    3537            self.count=0 
     38             
     39             
    3640    def OnTimer(self, evt):  
    3741        """Update the progress bar while the timer is running  
     
    4549        
    4650    def set_progress(self): 
     51        """     
     52            Set the gauge value given the status of a thread 
     53        """ 
    4754        self.gauge.Show(True) 
    4855        if self.timer.IsRunning():  
     
    5663                    self.progress =0 
    5764                    self.timer.Stop() 
    58                     #self.gauge.Hide() 
     65                     
    5966            self.timer.Stop() 
    6067            self.gauge.SetValue(90)  
    6168            self.progress =0 
    6269             
     70             
    6371    def clear_gauge(self, msg=""): 
     72        """ 
     73            Hide the gauge 
     74        """ 
    6475        self.timer.Stop() 
    6576        self.SetStatusText( str(msg), 0) 
     
    6980          
    7081    def set_status(self, type=None,msg="", thread=None): 
     82        """ 
     83            Update the status bar . 
     84            @param type: type of message send. 
     85            type  must be in ["start","progress","update","stop"] 
     86            @param msg: the message itself  as string 
     87            @param thread: if updatting using a thread status  
     88        """ 
    7189        if type==None: 
    7290            self.SetStatusText(str(msg),0) 
     
    8098                self.progress +=10 
    8199                self.gauge.SetValue(int(self.progress))  
    82                 #self.timer.Start(1000) 
    83                 #print "went here" 
    84                 #self.set_progress() 
     100               
    85101                self.progress +=10 
    86102                if self.progress < self.gauge.GetRange()-20: 
    87103                    self.gauge.SetValue(int(self.progress))  
     104                     
    88105            if type.lower()=="progress": 
    89106                self.timer.Start(100) 
    90107                self.SetStatusText( str(msg), 0) 
    91108                self.gauge.Pulse() 
    92                 #print "in progress" 
    93109                 
    94110            if  type.lower()=="update": 
  • guiframe/utils.py

    r2bd9927 r12aa9b5  
    11""" 
    2      Contains common classes 
     2     Contains common classes and functions 
    33""" 
    44import wx,re 
  • guiframe/welcome_panel.py

    r25c8653 r12aa9b5  
    5151 
    5252class PanelAbout(wx.Panel): 
    53     '''"About" Dialog 
    54      
     53    """ 
     54    Panel created like about box  as a welcome page 
    5555    Shows product name, current version, authors, and link to the product page. 
    5656    Current version is taken from version.py 
    57     ''' 
     57    """ 
    5858     
    5959    def __init__(self, *args, **kwds): 
Note: See TracChangeset for help on using the changeset viewer.