Ignore:
Timestamp:
Dec 18, 2012 10:55:24 AM (12 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:
6550b64
Parents:
0203ade
Message:

Added polarization and magnetic stuffs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • calculatorview/src/sans/perspectives/calculator/load_thread.py

    r7343319 r318b5bbb  
    4646            # Real code should not print, but this is an example... 
    4747            raise 
    48        
     48         
     49class GenReader(CalcThread): 
     50    """ 
     51        Load a sld data given a filename 
     52    """ 
     53    def __init__(self, path, loader,  
     54                 completefn=None, 
     55                 updatefn   = None, 
     56                 yieldtime  = 0.01, 
     57                 worktime   = 0.01 
     58                 ): 
     59        CalcThread.__init__(self, completefn, 
     60                 updatefn, 
     61                 yieldtime, 
     62                 worktime) 
     63        self.path = path 
     64        #Instantiate a loader  
     65        self.loader = loader 
     66        self.starttime = 0   
     67         
     68    def isquit(self): 
     69        """ 
     70             @raise KeyboardInterrupt: when the thread is interrupted 
     71        """ 
     72        try: 
     73            CalcThread.isquit(self) 
     74        except KeyboardInterrupt: 
     75            raise KeyboardInterrupt    
     76         
     77         
     78    def compute(self): 
     79        """ 
     80            read some data 
     81        """ 
     82        self.starttime = time.time() 
     83        try: 
     84            data =  self.loader.read(self.path) 
     85            self.complete(data=data) 
     86        except: 
     87            # Thread was interrupted, just proceed and re-raise. 
     88            # Real code should not print, but this is an example... 
     89            raise 
     90             
Note: See TracChangeset for help on using the changeset viewer.